Network Model: Node Module
A Node can generate and send a set number of transactions out, as well as receive such transactions.
I/O ports Node is connected to 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). Threads Node has three parallel threads: - in_controller() waits for a transaction to arrive on the input port, and then stores that transaction in the input Buffer. The input Buffer's depth is programmable via a configuration file (e.g. config.txt). - in_picker() selects a transaction from the input Buffer, based on a criteria, e.g. oldest, and removes it from the Buffer. - out_controller() produces a set number of transactions, and sends them out via the output port. Configuration file Node configuration determines: - Whether input and/or output processing is active. - Input Buffer's depth - Input and output processing delay. - Number of transactions generated, and their destination Node ID. |
Print control Node has print-control functionality to select which type of print-out debug messages are shown. Implemented in: node_print_ctrl.cpp/.hpp |
Running a test
To test Node's functionality, I connected two Nodes to each other - one producing transactions, and the other consuming them.
Test Node by compiling top.cpp in the test directory, and then running it with the following command line:
./build/debug/top.exe -node_print_file print_ctrl.txt -config_file config.txt -run
The output will look like this:
------------------------------
--- Node module simulation ---
------------------------------
Print control for node_2, via input file print_ctrl.txt
is_config = 1
is_bus_in = 1
is_bus_out = 0
is_events = 1
Print control for node_3, via input file print_ctrl.txt
is_config = 1
is_bus_in = 0
is_bus_out = 1
is_events = 0
Top: Start simulation
node_2 configuration: in_enable = 1
node_2 configuration: out_enable = 1
node_2 configuration: num_trans = 10
node_2 configuration: dst_id = 3
node_2 configuration: in_delay = 10
node_2 configuration: out_delay = 3
node_2 configuration: buf_in_size = 4
node_2: Done initialize()
node_3 configuration: in_enable = 1
node_3 configuration: out_enable = 1
node_3 configuration: num_trans = 11
node_3 configuration: dst_id = 2
node_3 configuration: in_delay = 10
node_3 configuration: out_delay = 5
node_3 configuration: buf_in_size = 8
node_3: Done initialize()
@0 node_2 +++++ starts receiving transactions
@0 node_2 z Input Buffer is empty
@0 node_3 +++++ starts generating and sending transactions
@5 node_3 < [0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x3, created @0, received @0
@5 node_2 > [0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x3, created @0, received @5
@5 node_2 ! Input Buffer is not empty
@10 node_3 < [1] IC_Bus: trans, src ID 3, dst ID 2, payload 0x103, created @5, received @5
@10 node_2 > [1] IC_Bus: trans, src ID 3, dst ID 2, payload 0x103, created @5, received @10
@15 node_3 < [2] IC_Bus: trans, src ID 3, dst ID 2, payload 0x203, created @10, received @10
@15 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x3, created @0, received @5
@15 node_2 > [2] IC_Bus: trans, src ID 3, dst ID 2, payload 0x203, created @10, received @15
@20 node_3 < [3] IC_Bus: trans, src ID 3, dst ID 2, payload 0x303, created @15, received @15
@20 node_2 > [3] IC_Bus: trans, src ID 3, dst ID 2, payload 0x303, created @15, received @20
@25 node_3 < [4] IC_Bus: trans, src ID 3, dst ID 2, payload 0x403, created @20, received @20
@25 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x103, created @5, received @10
@25 node_2 > [4] IC_Bus: trans, src ID 3, dst ID 2, payload 0x403, created @20, received @25
@30 node_3 < [5] IC_Bus: trans, src ID 3, dst ID 2, payload 0x503, created @25, received @25
@30 node_2 > [5] IC_Bus: trans, src ID 3, dst ID 2, payload 0x503, created @25, received @30
@30 node_2 z Input Buffer is full
@35 node_3 < [6] IC_Bus: trans, src ID 3, dst ID 2, payload 0x603, created @30, received @30
@35 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x203, created @10, received @15
@35 node_2 ! Input Buffer is not full
@35 node_2 > [6] IC_Bus: trans, src ID 3, dst ID 2, payload 0x603, created @30, received @35
@35 node_2 z Input Buffer is full
@40 node_3 < [7] IC_Bus: trans, src ID 3, dst ID 2, payload 0x703, created @35, received @35
@45 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x303, created @15, received @20
@45 node_2 ! Input Buffer is not full
@45 node_2 > [7] IC_Bus: trans, src ID 3, dst ID 2, payload 0x703, created @35, received @45
@45 node_2 z Input Buffer is full
@45 node_3 < [8] IC_Bus: trans, src ID 3, dst ID 2, payload 0x803, created @40, received @40
@55 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x403, created @20, received @25
@55 node_2 ! Input Buffer is not full
@55 node_2 > [8] IC_Bus: trans, src ID 3, dst ID 2, payload 0x803, created @40, received @55
@55 node_2 z Input Buffer is full
@55 node_3 < [9] IC_Bus: trans, src ID 3, dst ID 2, payload 0x903, created @45, received @45
@65 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x503, created @25, received @30
@65 node_2 ! Input Buffer is not full
@65 node_2 > [9] IC_Bus: trans, src ID 3, dst ID 2, payload 0x903, created @45, received @65
@65 node_2 z Input Buffer is full
@65 node_3 < [10] IC_Bus: trans, src ID 3, dst ID 2, payload 0xa03, created @55, received @55
@65 node_3 ===== done sending transactions
@75 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x603, created @30, received @35
@75 node_2 ! Input Buffer is not full
@75 node_2 > [10] IC_Bus: trans, src ID 3, dst ID 2, payload 0xa03, created @55, received @75
@75 node_2 z Input Buffer is full
@85 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x703, created @35, received @45
@85 node_2 ! Input Buffer is not full
@95 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x803, created @40, received @55
@105 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x903, created @45, received @65
@115 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0xa03, created @55, received @75
@115 node_2 z Input Buffer is empty
Top: End simulation
To test Node's functionality, I connected two Nodes to each other - one producing transactions, and the other consuming them.
Test Node by compiling top.cpp in the test directory, and then running it with the following command line:
./build/debug/top.exe -node_print_file print_ctrl.txt -config_file config.txt -run
The output will look like this:
------------------------------
--- Node module simulation ---
------------------------------
Print control for node_2, via input file print_ctrl.txt
is_config = 1
is_bus_in = 1
is_bus_out = 0
is_events = 1
Print control for node_3, via input file print_ctrl.txt
is_config = 1
is_bus_in = 0
is_bus_out = 1
is_events = 0
Top: Start simulation
node_2 configuration: in_enable = 1
node_2 configuration: out_enable = 1
node_2 configuration: num_trans = 10
node_2 configuration: dst_id = 3
node_2 configuration: in_delay = 10
node_2 configuration: out_delay = 3
node_2 configuration: buf_in_size = 4
node_2: Done initialize()
node_3 configuration: in_enable = 1
node_3 configuration: out_enable = 1
node_3 configuration: num_trans = 11
node_3 configuration: dst_id = 2
node_3 configuration: in_delay = 10
node_3 configuration: out_delay = 5
node_3 configuration: buf_in_size = 8
node_3: Done initialize()
@0 node_2 +++++ starts receiving transactions
@0 node_2 z Input Buffer is empty
@0 node_3 +++++ starts generating and sending transactions
@5 node_3 < [0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x3, created @0, received @0
@5 node_2 > [0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x3, created @0, received @5
@5 node_2 ! Input Buffer is not empty
@10 node_3 < [1] IC_Bus: trans, src ID 3, dst ID 2, payload 0x103, created @5, received @5
@10 node_2 > [1] IC_Bus: trans, src ID 3, dst ID 2, payload 0x103, created @5, received @10
@15 node_3 < [2] IC_Bus: trans, src ID 3, dst ID 2, payload 0x203, created @10, received @10
@15 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x3, created @0, received @5
@15 node_2 > [2] IC_Bus: trans, src ID 3, dst ID 2, payload 0x203, created @10, received @15
@20 node_3 < [3] IC_Bus: trans, src ID 3, dst ID 2, payload 0x303, created @15, received @15
@20 node_2 > [3] IC_Bus: trans, src ID 3, dst ID 2, payload 0x303, created @15, received @20
@25 node_3 < [4] IC_Bus: trans, src ID 3, dst ID 2, payload 0x403, created @20, received @20
@25 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x103, created @5, received @10
@25 node_2 > [4] IC_Bus: trans, src ID 3, dst ID 2, payload 0x403, created @20, received @25
@30 node_3 < [5] IC_Bus: trans, src ID 3, dst ID 2, payload 0x503, created @25, received @25
@30 node_2 > [5] IC_Bus: trans, src ID 3, dst ID 2, payload 0x503, created @25, received @30
@30 node_2 z Input Buffer is full
@35 node_3 < [6] IC_Bus: trans, src ID 3, dst ID 2, payload 0x603, created @30, received @30
@35 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x203, created @10, received @15
@35 node_2 ! Input Buffer is not full
@35 node_2 > [6] IC_Bus: trans, src ID 3, dst ID 2, payload 0x603, created @30, received @35
@35 node_2 z Input Buffer is full
@40 node_3 < [7] IC_Bus: trans, src ID 3, dst ID 2, payload 0x703, created @35, received @35
@45 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x303, created @15, received @20
@45 node_2 ! Input Buffer is not full
@45 node_2 > [7] IC_Bus: trans, src ID 3, dst ID 2, payload 0x703, created @35, received @45
@45 node_2 z Input Buffer is full
@45 node_3 < [8] IC_Bus: trans, src ID 3, dst ID 2, payload 0x803, created @40, received @40
@55 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x403, created @20, received @25
@55 node_2 ! Input Buffer is not full
@55 node_2 > [8] IC_Bus: trans, src ID 3, dst ID 2, payload 0x803, created @40, received @55
@55 node_2 z Input Buffer is full
@55 node_3 < [9] IC_Bus: trans, src ID 3, dst ID 2, payload 0x903, created @45, received @45
@65 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x503, created @25, received @30
@65 node_2 ! Input Buffer is not full
@65 node_2 > [9] IC_Bus: trans, src ID 3, dst ID 2, payload 0x903, created @45, received @65
@65 node_2 z Input Buffer is full
@65 node_3 < [10] IC_Bus: trans, src ID 3, dst ID 2, payload 0xa03, created @55, received @55
@65 node_3 ===== done sending transactions
@75 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x603, created @30, received @35
@75 node_2 ! Input Buffer is not full
@75 node_2 > [10] IC_Bus: trans, src ID 3, dst ID 2, payload 0xa03, created @55, received @75
@75 node_2 z Input Buffer is full
@85 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x703, created @35, received @45
@85 node_2 ! Input Buffer is not full
@95 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x803, created @40, received @55
@105 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0x903, created @45, received @65
@115 node_2 - Picked[0] IC_Bus: trans, src ID 3, dst ID 2, payload 0xa03, created @55, received @75
@115 node_2 z Input Buffer is empty
Top: End simulation