@@ -10,6 +10,8 @@ use ieee.numeric_std.all;
1010
1111use work.queue_pkg.all ;
1212use work.sync_pkg.all ;
13+ use work.queue_pkg.all ;
14+ use work.check_pkg.all ;
1315
1416package body bus_master_pkg is
1517
@@ -96,6 +98,34 @@ package body bus_master_pkg is
9698 write_bus(net, bus_handle, to_address(bus_handle, address), data, byte_enable);
9799 end ;
98100
101+ procedure burst_write_bus(signal net : inout network_t;
102+ constant bus_handle : bus_master_t;
103+ constant address : std_logic_vector ;
104+ constant burst_length : positive ;
105+ constant data : queue_t) is
106+ variable request_msg : msg_t := new_msg(bus_burst_write_msg);
107+ variable full_address : std_logic_vector (bus_handle.p_address_length- 1 downto 0 ) := (others => '0' );
108+ variable full_data : std_logic_vector (bus_handle.p_data_length- 1 downto 0 ) := (others => '0' );
109+ begin
110+ full_address(address'length - 1 downto 0 ) := address;
111+ push_std_ulogic_vector(request_msg, full_address);
112+ push_integer(request_msg, burst_length);
113+ for i in 0 to burst_length- 1 loop
114+ full_data(bus_handle.p_data_length- 1 downto 0 ) := pop(data);
115+ push_std_ulogic_vector(request_msg, full_data);
116+ end loop ;
117+ send(net, bus_handle.p_actor, request_msg);
118+ end procedure ;
119+
120+ procedure burst_write_bus(signal net : inout network_t;
121+ constant bus_handle : bus_master_t;
122+ constant address : natural ;
123+ constant burst_length : positive ;
124+ constant data : queue_t) is
125+ begin
126+ burst_write_bus(net, bus_handle, to_address(bus_handle, address), burst_length, data);
127+ end procedure ;
128+
99129 procedure check_bus(signal net : inout network_t;
100130 constant bus_handle : bus_master_t;
101131 constant address : std_logic_vector ;
@@ -158,6 +188,30 @@ package body bus_master_pkg is
158188 read_bus(net, bus_handle, to_address(bus_handle, address), reference);
159189 end ;
160190
191+ procedure burst_read_bus(signal net : inout network_t;
192+ constant bus_handle : bus_master_t;
193+ constant address : std_logic_vector ;
194+ constant burst_length : positive ;
195+ variable reference : inout bus_reference_t) is
196+ variable full_address : std_logic_vector (bus_handle.p_address_length- 1 downto 0 ) := (others => '0' );
197+ alias request_msg : msg_t is reference;
198+ begin
199+ request_msg := new_msg(bus_burst_read_msg);
200+ full_address(address'length - 1 downto 0 ) := address;
201+ push_std_ulogic_vector(request_msg, full_address);
202+ push_integer(request_msg, burst_length);
203+ send(net, bus_handle.p_actor, request_msg);
204+ end procedure ;
205+
206+ procedure burst_read_bus(signal net : inout network_t;
207+ constant bus_handle : bus_master_t;
208+ constant address : natural ;
209+ constant burst_length : positive ;
210+ variable reference : inout bus_reference_t) is
211+ begin
212+ burst_read_bus(net, bus_handle, to_address(bus_handle, address), burst_length, reference);
213+ end procedure ;
214+
161215 -- Await read bus reply
162216 procedure await_read_bus_reply(signal net : inout network_t;
163217 variable reference : inout bus_reference_t;
@@ -171,6 +225,25 @@ package body bus_master_pkg is
171225 delete(reply_msg);
172226 end procedure ;
173227
228+ procedure await_burst_read_bus_reply(signal net : inout network_t;
229+ constant bus_handle : bus_master_t;
230+ constant data : queue_t;
231+ variable reference : inout bus_reference_t) is
232+ variable reply_msg : msg_t;
233+ alias request_msg : msg_t is reference;
234+ variable d : std_logic_vector (bus_handle.p_data_length- 1 downto 0 );
235+ variable burst_length : positive ;
236+ begin
237+ receive_reply(net, request_msg, reply_msg);
238+ burst_length := pop_integer(reply_msg);
239+ for i in 0 to burst_length- 1 loop
240+ d := pop_std_ulogic_vector(reply_msg)(d'range );
241+ push(data, d);
242+ end loop ;
243+ delete(request_msg);
244+ delete(reply_msg);
245+ end procedure ;
246+
174247 -- Blocking read with immediate reply
175248 procedure read_bus(signal net : inout network_t;
176249 constant bus_handle : bus_master_t;
@@ -191,6 +264,26 @@ package body bus_master_pkg is
191264 read_bus(net, bus_handle, to_address(bus_handle, address), data);
192265 end ;
193266
267+ procedure burst_read_bus(signal net : inout network_t;
268+ constant bus_handle : bus_master_t;
269+ constant address : std_logic_vector ;
270+ constant burst_length : positive ;
271+ constant data : queue_t) is
272+ variable reference : bus_reference_t;
273+ begin
274+ burst_read_bus(net, bus_handle, address, burst_length, reference);
275+ await_burst_read_bus_reply(net, bus_handle, data, reference);
276+ end procedure ;
277+
278+ procedure burst_read_bus(signal net : inout network_t;
279+ constant bus_handle : bus_master_t;
280+ constant address : natural ;
281+ constant burst_length : positive ;
282+ constant data : queue_t) is
283+ begin
284+ burst_read_bus(net, bus_handle, to_address(bus_handle, address), burst_length, data);
285+ end procedure ;
286+
194287 procedure wait_until_read_equals(
195288 signal net : inout network_t;
196289 bus_handle : bus_master_t;
0 commit comments