10 use ieee.std_logic_1164.
ALL;
11 use ieee.numeric_std.
ALL;
102 -- These are all the system bus signals.
104 signal bus_lines : (tim_bus_data_width-1 downto 0) := (others => 'Z');
105 signal bus_valid : := '0';
106 signal bus_enable : := '0';
107 signal bus_read_write : := '0';
111 -- These are the master device signals.
114 signal master_data : (tim_bus_data_width-1 downto 0) := (others => '1');
115 signal master_address : (tim_bus_data_width-1 downto 0) := (others => '0');
116 signal master_read_write : := '0';
117 signal master_pending : := '0';
118 signal master_acknowledge : := '0';
121 -- These are the slave device signals.
124 signal slave_0_read_write : := '0';
125 signal slave_0_address : (tim_bus_data_width-1 downto 0) := (others => 'Z');
126 signal slave_0_data : (tim_bus_data_width-1 downto 0) := (others => '0');
127 signal slave_0_pending : := '0';
128 signal slave_0_done : := '0';
130 signal slave_1_read_write : := '0';
131 signal slave_1_address : (tim_bus_data_width-1 downto 0) := (others => 'Z');
132 signal slave_1_data : (tim_bus_data_width-1 downto 0) := (others => '1');
133 signal slave_1_pending : := '0';
134 signal slave_1_done : := '0';
137 -- Testbench signals.
143 -- Continuous assignments
155 master_pending <= '0';
157 elsif(tb_clk'event and master_acknowledge = '0' and master_pending = '0') then
159 master_pending <= '1';
160 master_address <= ((master_address)+128);
162 elsif(tb_clk'event and master_acknowledge = '1') then
164 master_pending <= '0';
178 elsif(tb_clk'event and slave_0_pending = '0') then
182 elsif(tb_clk'event and slave_0_pending = '1') then
184 if(slave_0_read_write = '0') then
185 slave_0_data <= slave_0_address;
202 elsif(tb_clk'event and slave_1_pending = '0') then
206 elsif(tb_clk'event and slave_1_pending = '1') then
208 if(slave_1_read_write = '0') then
209 slave_1_data <= slave_1_address;
220 -- Entity declarations.
282 end architecture testbench;
slave_0_controltb_clk,tb_reset,slave_0_pending
Responsible for stimulating the master bus controller.
slave_1_controltb_clk,tb_reset,slave_1_pending
Responsible for stimulating the master bus controller.
out bus_read_writestd_logic
High if this transaction is a write, low if it is a read.
address_range_bottominteger :=0
The bottomof the range of addresses to which this slave controller will respond to requests...
The bus slave controller module which responds to requests from the master.
in bus_read_writestd_logic
High if this transaction is a write, low if it is a read.
tim_bus_master
The bus master controller module which arbitrates bus requests and responses.
tim_bus_slave entity_slave_1entity_slave_1
The second bus device.
out req_address_linesstd_logic_vector (data_width - 1 downto 0)
The address the bus transaction is targeting within the device.
in req_read_writestd_logic
Tells the controller if this is a read or write transaction. High == write, low == read...
data_widthinteger :=tim_bus_data_width
The number of data and address lines.
in bus_validstd_logic
Used to assert data written by the bus master to bus_lines is valid.
tim_bus_master entity_masterentity_master
The bus master object.
in req_address_linesstd_logic_vector (data_width - 1 downto 0)
Addresses for read and write operations are placed on these lines.
in resetstd_logic
Asynchonous reset signal.
in req_pendingstd_logic
This is put high to tell the controller a request is pending.
in resetstd_logic
Asynchonous reset signal.
address_range_topinteger :=1023
The top of the range of addresses to which this slave controller will respond to requests.
std_logic_vector (tim_bus_data_width - 1 downto 0) :=( others =>'Z' ) bus_lines
Testbench reset signal.
tim_bus_slave entity_slave_0entity_slave_0
The First bus device.
inout bus_linesstd_logic_vector (data_width - 1 downto 0)
The lines which carry data and addresses;.
in clkstd_logic
The main system clock.
out bus_validstd_logic
Used to assert data written by the bus master to bus_lines is valid.
std_logic :='1' tb_reset
Testbench clock signal.
master_controltb_clk,tb_reset,master_acknowledge
Responsible for stimulating the master bus controller.
out req_acknowledgestd_logic
std_logic :='0' tb_clk
Tells the controller the device has written/read all values from the address and data lines and can f...
inout req_data_linesstd_logic_vector (data_width - 1 downto 0)
Request write data is placed on these lines.
tim_bus_slave
This is put high to tell the requestor that the response is valid and its transaction is complete...
data_widthinteger :=tim_bus_data_width
The number of data and address lines.
out req_read_writestd_logic
Whether this is a read or write transaction the device must respond to.
out bus_enablestd_logic
Used to assert that the slave has read the bus lines and they can be updated.
in clkstd_logic
The main system clock.
Empty entity declaration of the bus testbench.
in req_donestd_logic
Tells the controller the device has written/read all values from the address and data lines and can f...
inout req_data_linesstd_logic_vector (data_width - 1 downto 0)
The data the transaction needs. Either read data is put onto this or write data is taken off it...
out req_pendingstd_logic
Tells the host device a bus request needs dealing with.
The bus master controller module which arbitrates bus requests and responses.
inout bus_linesstd_logic_vector (data_width - 1 downto 0)
The lines which carry data and addresses;.
This package contains entity declarations and shared constant values for the bus logic modules...
in bus_enablestd_logic
Used to assert that the slave has read the bus lines and they can be updated.