Producer/Consumer Model: Consumer Module
Consumer expects to receive a given number of packets from Producer.
I/O ports Consumer is connected to Master and Producer via blocking FIFO ports. A thread accessing such a port will be paused, if the FIFO is empty (on a read) or full (on a write). Consumer receives register read and write commands from Master over an input register bus, defined in bus_types.hpp. Upon a register read, Consumer sends the content of that register to Master over an output register data bus. Consumer receives packets from Producer over an input packet bus. Consumer sends a done signal to Master over an output Boolean bus. Threads Consumer has two parallel threads: - register_file_handler() waits for a register read or write command from the Master, and then processes it. If the en field in the control register has just been set, an event notification is sent to the controller() thread, to wake it up. - controller() waits for an event from register_file_handler(), to start receiving packets from Producer. Once all packets have been received, the en field in the control register is cleared, and a done signal is sent to Master. |
Print control Consumcer has print-control functionality to select which type of print-out debug messages are shown. Implemented in: consumer_print_ctrl.cpp/.hpp |
Register definitions
Consumer has 2 registers in its register-file.
Consumer has 2 registers in its register-file.
Consumer_Control_Register
-- Register --
Name Offset Description
control 0x0 Consumer control
-- Fields --
Field_name lsb Width Description Reset_value RW_access
en 0 1 Enable receiving packets from Producer 0x0 RW
ud_0 1 3 Undefined 0 0x0 R
num_pkt 4 4 Number of packets to be received per invocation 0x10 RW
ud_1 8 5 Undefined 1 0x0 R
ver 13 3 Unit version number 0x2 R
Consumer_Packet_Register
-- Register --
Name Offset Description
packet 0x4 Received packet and count of received packets
-- Fields --
Field_name lsb Width Description Reset_value RW_access
num_pkt 0 4 Number of packets received 0x0 R
ud_0 4 4 Undefined 0 0x0 R
pkt_data 8 8 Most recently received packet 0x0 R