Skip to content

Commit bb24ff9

Browse files
committed
Add comments to wishbone.tx
1 parent 1249411 commit bb24ff9

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

protocols/tests/wishbone/wishbone.tx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,40 @@
22
trace {
33
// Note: this transaction is designed to closely model the behavior
44
// of the existing off-the-shelf C++ test-bench (reqwalker.cpp)
5+
6+
// Note: their Verilog DUT ignores write/read addresses,
7+
// so we only read/write from address 0 in this trace
58

6-
// Initial state register is 0; o_led=0 (default case for state=0)
9+
// Initial state is 0
710
read(0, 0);
811

9-
// 5 idle cycles (Test-bench always sets 5 cycles before each write)
12+
// 5 idle cycles (Their TB always sets 5 idle cycles before each write)
1013
idle(); idle(); idle(); idle(); idle();
1114

12-
// Trigger the LED animation: on the accept edge, state becomes 1.
13-
// o_led still shows the old case 0 (from the previous cycle) due to a 1-cycle delay.
15+
// Write 1 to the subordinate
1416
write(0, 1);
1517

1618
// Read back `o_data` and `o_led` as the LED walks through states.
1719
// The `read` protocol advances the state (`data`) by 1
1820
// and the write protocol's final step also advances state by 1 (1->2 before
1921
// the first read). This means the first value of `data` read is 3.
20-
read(0, 3); // state 2->3, o_led=case(2)=0b00_0010
21-
read(0, 5); // state 4->5, o_led=case(4)=0b00_1000
22-
read(0, 7); // state 6->7, o_led=case(6)=0b10_0000
23-
read(0, 9); // state 8->9, o_led=case(8)=0b00_1000
24-
read(0, 11); // state 10->11, o_led=case(10)=0b00_0010
25-
read(0, 0); // state 11->0, o_led=case(0)=0b00_0000
22+
read(0, 3); // state 2->3
23+
read(0, 5); // state 4->5
24+
read(0, 7); // state 6->7
25+
read(0, 9); // state 8->9
26+
read(0, 11); // state 10->11
27+
read(0, 0); // state 11->0
2628

2729
// Test-bench always sets 5 idle cycles before each write
2830
idle(); idle(); idle(); idle(); idle();
2931

30-
// Second iteration of outer `for` loop in `reqwalker.cpp`
31-
// (identical state machine behaviour)
32+
// Second iteration of the outer `for-loop in the `main` function
33+
// of `reqwalker.cpp` (identical state machine behaviour)
3234
write(0, 1);
33-
read(0, 3);
34-
read(0, 5);
35-
read(0, 7);
36-
read(0, 9);
35+
read(0, 3);
36+
read(0, 5);
37+
read(0, 7);
38+
read(0, 9);
3739
read(0, 11);
38-
read(0, 0);
40+
read(0, 0);
3941
}

0 commit comments

Comments
 (0)