Project

General

Profile

Download (2.9 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
-- Copyright (C) 1996 Morgan Kaufmann Publishers, Inc
3

    
4
-- This file is part of VESTs (Vhdl tESTs).
5

    
6
-- VESTs is free software; you can redistribute it and/or modify it
7
-- under the terms of the GNU General Public License as published by the
8
-- Free Software Foundation; either version 2 of the License, or (at
9
-- your option) any later version. 
10

    
11
-- VESTs is distributed in the hope that it will be useful, but WITHOUT
12
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14
-- for more details. 
15

    
16
-- You should have received a copy of the GNU General Public License
17
-- along with VESTs; if not, write to the Free Software Foundation,
18
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
19

    
20
-- ---------------------------------------------------------------------
21
--
22
-- $Id: ch_16_fg_16_08.vhd,v 1.2 2001-10-26 16:29:36 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
entity processor_node is
28
end entity processor_node;
29

    
30

    
31
-- code from book
32

    
33
architecture dataflow of processor_node is
34

    
35
  -- not in book
36

    
37
  subtype word is bit_vector(31 downto 0);
38
  type word_vector is array (natural range <>) of word;
39

    
40
  function resolve_unique ( drivers : word_vector ) return word is
41
  begin
42
    if drivers'length > 0 then
43
      return drivers(drivers'left);
44
    else
45
      return X"00000000";
46
    end if;
47
  end function resolve_unique;
48

    
49
  -- end not in book
50

    
51
  signal address_bus : resolve_unique word bus;
52
  -- . . .
53

    
54
  -- not in book
55
  signal cache_miss, dirty, replace_section,
56
    snoop_hit, flag_update : bit := '0';
57
  constant tag_section0 : bit_vector(11 downto 0) := X"000";
58
  constant tag_section1 : bit_vector(11 downto 0) := X"001";
59
  constant set_index : bit_vector(15 downto 0) := X"6666";
60
  constant snoop_address : word := X"88888888";
61
  -- end not in book
62

    
63
begin
64

    
65
  cache_to_address_buffer : block ( cache_miss = '1' and dirty = '1' ) is
66
  begin
67
    address_bus <= guarded
68
                   tag_section0 & set_index & B"0000" when replace_section = '0' else
69
                   tag_section1 & set_index & B"0000";
70
  end block cache_to_address_buffer;
71

    
72
  snoop_to_address_buffer : block ( snoop_hit = '1' and flag_update = '1' ) is
73
  begin
74
    address_bus <= guarded snoop_address(31 downto 4) & B"0000";
75
  end block snoop_to_address_buffer;
76

    
77
  -- . . .
78

    
79
  -- not in book
80

    
81
  stimulus : process is
82
  begin
83
    wait for 10 ns;
84
    dirty <= '0';  cache_miss <= '1', '0' after 5 ns;  wait for 10 ns;
85
    dirty <= '1';  cache_miss <= '1', '0' after 5 ns;  wait for 10 ns;
86
    replace_section <= '1';
87
    cache_miss <= '1', '0' after 5 ns;  wait for 10 ns;
88
    flag_update <= '0'; snoop_hit <= '1', '0' after 5 ns;  wait for 10 ns;
89
    flag_update <= '1'; snoop_hit <= '1', '0' after 5 ns;  wait for 10 ns;
90

    
91
    wait;
92
  end process stimulus;
93

    
94
  -- end not in book
95

    
96
end architecture dataflow;
97

    
98
-- end code from book
(106-106/171)