Open purdeaandrei opened 3 months ago
This one's ready for review
To be honest I find the new tests pretty difficult to understand. If I needed to modify them I'm not sure if I'd been able to do that without just rewriting them (which might have to happen when IOStreamer
graduates to amaranth-stdio).
I've made some changes to make this more reviewable:
save_expected_sample_values_tb
coroutine to use .sample()
to better reflect the intent of the timing of when a signal is sampled.I would like to note that the changes to these testcases are a generalization of the previous testcases I implemented, to make it parametrizable, so you can more easily test with various types of stimulus. For example note that most of what used to be test_sdr_input_sampled_correctly()
has been factored out and moved into _subtest_sdr_input_sampled_correctly
and it's behavior is now much more customizable. And it's complexity only increased slightly.
I would also like to note that these testcases don't depend at all on the implementation of IOStream. If o-stream-to-io latency changes in the future, or o-stream-to-istream latency changes, or the skid buffer's internal behavior changes, then I don't expect the tests to need to be rewritten. (in contrast to the previously existing test_basic()
and test_skid()
which are both gonna need to be rewritten)
Also I want to note that the bugfix in the PR has been exposed by test_random()
which is now the only testcase I'm adding in this PR. If you try the testcase with pre-PR IOStreamer you will be able to see the sample lost situation.
I hope the changes I made make this more understandable.
Thanks! I have a really busy week upcoming (2nd to 8th) where I have travel a lot for work, so I'll only be able to get to these changes afterwards. Also, I will probably review your Amaranth changes first.
This PR now has a dependency on #684, and includes its changes. To look only at this PR's changes see: https://github.com/purdeaandrei/glasgow/compare/f_fix_iostreamer_incorrect_sampling_and_qspi...purdeaandrei:glasgow:f_iostreamer_sample_lost_bugfix
Temporarily setting this to draft, to see what happens to the smaller PRs first.
Please see individual commits to understand the changes more easily.