OpenCores
URL https://opencores.org/ocsvn/xucpu/xucpu/trunk

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [ss/] [arch/] [board.vhdl] - Blame information for rev 41

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 lcdsgmtr
-- This is the architecture of the board
2
-- It defines the bus system and is used as the main structure
3
-- to add devices.
4
-- These devices can be:
5
-- - Memory
6
-- - Cache controller
7
-- - CPU
8
-- - Input devices
9
-- - Output devices
10
 
11
-- The main goal of the system is to provide the bus, the bus
12
-- controller for arbitration between bus masters, the control
13
-- signals, the data and address signals, the data protocol
14
-- and the address decoding.
15
 
16
-- It should be possible to generate this file based upon a
17
-- description of the different devices.
18
 
19
ARCHITECTURE Structural OF board IS
20
 
21 38 lcdsgmtr
  -- System constants
22
  CONSTANT nr_of_masters : INTEGER := 2;
23
  CONSTANT nr_of_devices : INTEGER := 5;
24
 
25
  CONSTANT addr_width : INTEGER := 15;
26
  CONSTANT data_width : INTEGER := 16;
27
 
28 37 lcdsgmtr
  -- Definition of bus signals
29 36 lcdsgmtr
 
30 37 lcdsgmtr
  SIGNAL data_bus    : STD_LOGIC_VECTOR(15 DOWNTO 0);
31
  SIGNAL address_bus : STD_LOGIC_VECTOR(14 DOWNTO 0);
32
  SIGNAL bus_read    : STD_LOGIC;
33
  SIGNAL bus_write   : STD_LOGIC;
34
  SIGNAL bus_wait    : STD_LOGIC;
35
  SIGNAL bus_ack     : STD_LOGIC;
36
 
37 38 lcdsgmtr
  -- Interconnection signals
38
 
39
  TYPE data_bus_array IS ARRAY (INTEGER RANGE <>) OF STD_LOGIC_VECTOR(data_width - 1 DOWNTO 0);
40
  SIGNAL device_data_out : data_bus_array(0 TO nr_of_devices - 1);
41
 
42
  TYPE address_bus_array IS ARRAY (INTEGER RANGE <>) OF STD_LOGIC_VECTOR(addr_width - 1 DOWNTO 0);
43
  SIGNAL device_address_out : address_bus_array(0 TO nr_of_masters - 1);
44
 
45
  -- Board level components
46
  -- Clock buffer
47
  SIGNAL clk : STD_LOGIC := '0';
48
 
49
  -- From asynchronous reset to synchronous reset
50
  SIGNAL rst : STD_LOGIC := '0';
51
 
52 37 lcdsgmtr
  -- Definition of components related to the bus
53
 
54
  COMPONENT data_mux IS
55
    PORT (
56
      data_in : IN STD_LOGIC_VECTOR(15 DOWNTO 0));
57
  END COMPONENT data_mux;
58
 
59
  COMPONENT address_mux IS
60
    PORT (
61
      address_in : IN STD_LOGIC_VECTOR(14 DOWNTO 0));
62
  END COMPONENT address_mux;
63
 
64
  COMPONENT address_decoder IS
65
    PORT (
66
      address_in : IN STD_LOGIC_VECTOR(14 DOWNTO 0));
67
  END COMPONENT address_decoder;
68
 
69
  COMPONENT bus_arbiter IS
70 39 lcdsgmtr
    PORT (
71
      clk        : IN  STD_LOGIC;
72
      rst        : IN  STD_LOGIC;
73
      rd_rq      : IN  STD_LOGIC_VECTOR(nr_of_masters - 1 DOWNTO 0);
74
      wr_rq      : IN  STD_LOGIC_VECTOR(nr_of_masters - 1 DOWNTO 0);
75
      master_ack : OUT STD_LOGIC_VECTOR(nr_of_masters - 1 DOWNTO 0));
76 37 lcdsgmtr
  END COMPONENT bus_arbiter;
77
 
78 39 lcdsgmtr
  SIGNAL rd_rq      : STD_LOGIC_VECTOR(nr_of_masters - 1 DOWNTO 0);
79
  SIGNAL wr_rq      : STD_LOGIC_VECTOR(nr_of_masters - 1 DOWNTO 0);
80
  SIGNAL master_ack : STD_LOGIC_VECTOR(nr_of_masters - 1 DOWNTO 0);
81
 
82 38 lcdsgmtr
  -- Definition of master devices attached to the bus
83
  COMPONENT icache IS
84
    PORT (
85 39 lcdsgmtr
      clk        : IN  STD_LOGIC;
86
      rst        : IN  STD_LOGIC;
87
      data_in    : IN  STD_LOGIC_VECTOR(data_width - 1 DOWNTO 0);
88
      addr_out   : OUT STD_LOGIC_VECTOR(addr_width - 1 DOWNTO 0);
89
      data_rd    : OUT STD_LOGIC;
90
      bus_wait   : IN  STD_LOGIC;
91
      master_ack : IN  STD_LOGIC);
92 38 lcdsgmtr
  END COMPONENT icache;
93 37 lcdsgmtr
 
94 38 lcdsgmtr
  COMPONENT dcache IS
95
    PORT (
96 39 lcdsgmtr
      clk        : IN  STD_LOGIC;
97
      rst        : IN  STD_LOGIC;
98
      data_in    : IN  STD_LOGIC_VECTOR(data_width - 1 DOWNTO 0);
99
      data_out   : OUT STD_LOGIC_VECTOR(data_width - 1 DOWNTO 0);
100
      addr_out   : OUT STD_LOGIC_VECTOR(addr_width - 1 DOWNTO 0);
101
      data_rd    : OUT STD_LOGIC;
102
      data_wr    : OUT STD_LOGIC;
103
      bus_wait   : IN  STD_LOGIC;
104
      master_ack : IN  STD_LOGIC);
105 38 lcdsgmtr
  END COMPONENT dcache;
106
 
107
  -- Definition of io devices attached to the bus
108
  COMPONENT led_out IS
109
    PORT (
110
      clk      : IN  STD_LOGIC;
111
      rst      : IN  STD_LOGIC;
112
      data_in  : IN  STD_LOGIC_VECTOR(7 DOWNTO 0);
113
      addr_in  : IN  STD_LOGIC_VECTOR(addr_width - 1 DOWNTO 0);
114
      port_out : OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
115
  END COMPONENT led_out;
116
 
117
  COMPONENT button_in IS
118
    PORT (
119
      clk      : IN  STD_LOGIC;
120
      rst      : IN  STD_LOGIC;
121
      data_out : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
122
      addr_in  : IN  STD_LOGIC_VECTOR(addr_width - 1 DOWNTO 0);
123
      port_in  : IN  STD_LOGIC_VECTOR(4 DOWNTO 0));
124
  END COMPONENT button_in;
125
 
126
  COMPONENT switch_in IS
127
    PORT (
128
      clk      : IN  STD_LOGIC;
129
      rst      : IN  STD_LOGIC;
130
      data_out : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
131
      addr_in  : IN  STD_LOGIC_VECTOR(addr_width - 1 DOWNTO 0);
132
      port_in  : IN  STD_LOGIC_VECTOR(7 DOWNTO 0));
133
  END COMPONENT switch_in;
134
 
135 36 lcdsgmtr
BEGIN  -- ARCHITECTURE Structural
136
 
137 37 lcdsgmtr
  -- Mapping of bus related components
138 39 lcdsgmtr
  bus_arbiter_1 : bus_arbiter
139
    PORT MAP (
140
      clk        => clk,
141
      rst        => rst,
142
      rd_rq      => rd_rq,
143
      wr_rq      => wr_rq,
144
      master_ack => master_ack);
145 36 lcdsgmtr
 
146 37 lcdsgmtr
  -- Mapping of system devices
147
 
148
  -- Main memory
149
 
150
  -- Instruction cache
151 41 lcdsgmtr
  icache_0 : icache
152 39 lcdsgmtr
    PORT MAP (
153
      clk        => clk,
154
      rst        => rst,
155
      data_in    => data_bus,
156
      addr_out   => device_address_out(0),
157
      data_rd    => rd_rq(0),
158
      bus_wait   => bus_wait,
159
      master_ack => master_ack(0));
160 37 lcdsgmtr
 
161
  -- Data cache
162 39 lcdsgmtr
  dcache_1 : dcache
163
    PORT MAP (
164
      clk        => clk,
165
      rst        => rst,
166
      data_in    => data_bus,
167
      data_out   => device_data_out(1),
168
      addr_out   => device_address_out(1),
169
      data_rd    => rd_rq(1),
170
      data_wr    => wr_rq(1),
171
      bus_wait   => bus_wait,
172
      master_ack => master_ack(0));
173 37 lcdsgmtr
 
174
  -- LED output device
175 41 lcdsgmtr
  led_out_2 : led_out
176 38 lcdsgmtr
    PORT MAP (
177
      clk      => clk,
178
      rst      => rst,
179
      data_in  => data_bus(7 DOWNTO 0),
180
      addr_in  => address_bus,
181
      port_out => led);
182 37 lcdsgmtr
 
183
  -- Push button input device
184 41 lcdsgmtr
  button_in_3 : button_in
185 38 lcdsgmtr
    PORT MAP (
186
      clk      => clk,
187
      rst      => rst,
188 39 lcdsgmtr
      data_out => device_data_out(3)(7 DOWNTO 0),
189 38 lcdsgmtr
      addr_in  => address_bus,
190
      port_in  => button);
191 37 lcdsgmtr
 
192
  -- Slide switch input device
193 41 lcdsgmtr
  switch_in_4 : switch_in
194 38 lcdsgmtr
    PORT MAP (
195
      clk      => clk,
196
      rst      => rst,
197 39 lcdsgmtr
      data_out => device_data_out(4)(7 DOWNTO 0),
198 38 lcdsgmtr
      addr_in  => address_bus,
199
      port_in  => switch);
200 37 lcdsgmtr
 
201
  -- Serial communication device
202
 
203
  -- MAC device
204
 
205
  -- DVI device
206
 
207
  -- Character based device
208
 
209 36 lcdsgmtr
END ARCHITECTURE Structural;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.