You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/README.md
+76-8
Original file line number
Diff line number
Diff line change
@@ -123,6 +123,8 @@ Group 1 traces show the communication as an integrated whole:
123
123
124
124
- Second transmission frame is shortened, but it's not enough to affect the result since it's during the output. Note when `rxEn` drops to `0`: It makes the `rxDone` pulse shorter than `rxDone` in the first frame, it makes the state `101` shorter, and makes the availability of the "`7F`" data shorter
125
125
126
+
<br />
127
+
126
128
### #5 Correct data is read out for first frame, incorrect for second due to mismatch
127
129
128
130
[5.v](5.v"Test bench 5.v")
@@ -131,6 +133,8 @@ Group 1 traces show the communication as an integrated whole:
### #8 Interrupted transmit followed by failed transmit ("txStart" too short)
151
159
152
160
[![Test case 8][img-8-cr]][img-8]
@@ -204,13 +212,13 @@ Group 1 traces show the communication as an integrated whole:
204
212
205
213
**Observations**
206
214
207
-
- Unlike in #9 and #10, the second `in` data signal lags the transmitter's high-going done signal; thus at the moment of the high-going `txDone`, you can see the previous `in` value is re-captured in `in_data`
215
+
- Unlike in #9 and #10, the second `in` data byte "`B1`" lags; at the moment of the high-going `txDone`, the previous `in` value is re-captured in `in_data`
208
216
209
217
- Shows a third transmit starting, because `txStart` goes low too late at the end of second transmit
210
218
211
219
- This test bench uses a feedback method of control to shut off `txStart`; so it's suggestive of ideas for external control of the UART; but these tests do not go into how you can use outputs for external control, and how to decide the timing of inputs
212
220
213
-
-The test benches in general though rely on tuned timings to present the inputs according to the intent of the test - in other words, empirical or ad hoc timings. Examples to illustrate:
221
+
-However the test benches in general rely on tuned timings to present the inputs according to the intent of the test - in other words, empirical or ad hoc timings. Examples to illustrate:
214
222
215
223
- Interval `#11500` used in test [#13](#13-turbo_frames--0): Because each cycle is about 11.5ms, this gives prep or set-up times mid-way through each transmit for pushing each next byte (this is the `in` transitions relative to the `txDone` pulses)
216
224
- Compare `#10750` used in test [#14](#13-turbo_frames--0), because its cycles are shorter
@@ -366,11 +374,11 @@ So, these tests are fine-grained in order to nail down the behaviour of the RX d
366
374
<summary>Some Verilog hints to understand the code</summary>
367
375
<br />
368
376
369
-
-The "`&`" operator of `&in_prior_hold_reg` collects the bits, and the expression is true if all the bits are `1`; secondly, `in_prior_hold_reg` is a vector of size `4`, and is a shift register; this provides a connection to time passing: `4` ticks of the clock for it to fill up (say with `1`s)
377
+
The "`&`" operator of `&in_prior_hold_reg` collects the bits, and the expression is true if all the bits are `1`. Secondly, `in_prior_hold_reg` is a vector of size `4`, and is a shift register. This provides a connection to time passing: `4` ticks of the clock for it to fill up (say with `1`s).
370
378
371
-
-Ticks of the clock are implicitly being examined, and waited for, by this section of code: `4` ticks, `8` ticks, `12` ticks; `16` ticks is the nominal duration of an incoming bit being sampled; if you understand line [`152`](https://github.com/TimRudy/uart-verilog/blob/a805332/Uart8Receiver.v#L152): `sample_count <= 4'b0100;` and how `sample_count` is being used cycling from `0` to `F`, then you've understood a lot of the code and the protocol, and how a Finite State Machine is useful
379
+
Ticks of the clock are implicitly being examined, and waited for, by this section of code: `4` ticks, `8` ticks, `12` ticks; `16` ticks is the nominal duration of an incoming bit being sampled. If you understand line [`152`](https://github.com/TimRudy/uart-verilog/blob/a805332/Uart8Receiver.v#L152): `sample_count <= 4'b0100;` and how `sample_count` is being used cycling from `0` to `F`, then you've understood a lot of the code and the protocol, and how a Finite State Machine is useful.
372
380
373
-
-When `in_sample` drops to `0`, that's the trigger for recovering from the error: `in_prior_hold_reg` is losing its `1` bits and goes away from the `F` or `&in_prior_hold_reg` condition; `sample_count`, if it continues to increase, will allow moving from the `IDLE` state to `START_BIT` state
381
+
When `in_sample` drops to `0`, that's the trigger for recovering from the error: `in_prior_hold_reg` is losing its `1` bits and goes away from the `F` or `&in_prior_hold_reg` condition; `sample_count`, if it continues to increase, will allow moving from the `IDLE` state to `START_BIT` state.
374
382
375
383
</details>
376
384
<br />
@@ -399,7 +407,7 @@ So, these tests are fine-grained in order to nail down the behaviour of the RX d
399
407
400
408
**Variant #18a**
401
409
402
-
- Focuses on the high in `IDLE` state after a false start bit (start signal has gone high too early)
410
+
- Focuses on the high in `IDLE` state after a false "start" bit (the signal has gone high too early)
403
411
404
412
-`18a.v` line [`63`](https://github.com/TimRudy/uart-verilog/blob/a805332/tests/18a.v#L63"Test bench changes at line 63"): Try `#230` for short, `#250` meets the minimum, `#300` long
405
413
@@ -433,7 +441,7 @@ So, these tests are fine-grained in order to nail down the behaviour of the RX d
433
441
434
442
**Observations**
435
443
436
-
- The reader can explore the implication of splitting `in_current_hold_reg` from `in_prior_hold_reg`; these are views into the register that stores the most recent `in` signal values/changes; the look-back allows for **signal hold time checks**
444
+
- The reader can explore the implication of splitting `in_current_hold_reg` from `in_prior_hold_reg`; these are views into the register that stores the most recent `in` signal values/changes (and this look-back allows for **signal hold time checks**)
437
445
438
446
**Variant #20a**
439
447
@@ -520,31 +528,91 @@ So, these tests are fine-grained in order to nail down the behaviour of the RX d
- Shows going to the `READY` state, but only remaining in that state for a few clock ticks; whereupon the next frame starts
554
+
555
+
- Despite the transition from `READY` to `IDLE` state, `done` is sustained for a `16`-tick cycle; this is implemented by moving the value in `sample_count` over to `out_hold_count` (line `287`)
556
+
557
+
- At line [`287`](https://github.com/TimRudy/uart-verilog/blob/a805332/Uart8Receiver.v#L287), the value assigned to `out_hold_count` tracks whatever `sample_count` has gone up to by that time - It does not use `sample_count <= 4'b1;` from the previous line, for the reason explained above about a value not changing till the end of a time slice in procedural block code
558
+
529
559
**Variant #27a**
530
560
561
+
<br />
562
+
531
563
### #28 Next transmit frame start overlaps with previous frame done signal 2
- Shows a complete `READY` state of exactly `16` ticks; whereupon the next frame starts
574
+
575
+
- At the red marker when `sample_count` is `E`, nothing happens
576
+
577
+
- In this particular case `in_sample` drops to `0` between `E` and `F`
578
+
579
+
- When `sample_count` is `F`, the assignments after line [`274`](https://github.com/TimRudy/uart-verilog/blob/a805332/Uart8Receiver.v#L274-L281) are what start the next frame, the `IDLE` state, the "start" bit hold count of `12` ticks
580
+
581
+
- If you follow further, in the `IDLE` state, the condition at line `132` holds, the condition at line `133` does not hold, and so the counting continues in the branch at line `146`
582
+
583
+
<br />
584
+
535
585
### #29 Successful transmit done signal overlaps with next transmit start error 2
0 commit comments