Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serial: A proposal to add verification using formal tools #4

Open
wants to merge 12 commits into
base: serial
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented Jan 3, 2020

On this pull request, I propose modifications on @whitequark's UART / asynchronous serial transmitter/receiver that would introduce a way to formally verify the I/O. The major changes include:

  1. Deprecated nMigen syntax (e.g. FFSynchronizer, nmigen.tools) have been eradicated.
  2. AsyncSerialRX now has the following signals: ack for enabling transfer of received data to another module, busy for indicating ongoing data reception, and r_rdy for indicating whether or not the received data is ready to transfer.
  3. AsyncSerialTX now has the following signals: ack for enabling transmission of data from another module, busy for indicating ongoing data transmission, and w_done for indicating whether or not the data has been transmitted.
  4. The data bits are now ordered in ascending significance of bit, i.e. LSB is transmitted first, MSB is transmitted last.
  5. Two test cases (AsyncSerialLoopbackTestCase and AsyncSerialBitstreamTestCase) that use a formal verification approach has been added to nmigen_stdio.test.test_serial. In short, they use Bounded Model Checking to check if the desired states (e.g. "DONE" for correct data transmission, or "ERROR" for data with errors) can be reached within certain numbers of cycles, usually equal to the duration that starts before the RX/TX is enabled and ends after the RX/TX asserts r_rdy/w_done.

I will provide further useful descriptions and explanations later on. I look forward to seeing further comments, thanks.

Edit: the version check in setup.py will be modified according to the final decision.

* `TX.continuous` is an externally driven Signal, resets to 0 (deasserted)
  * When asserted, TX assumes that `TX.data` is valid AT THE SAME TIME when the start bit starts to be sent out
  * When deasserted, TX assumes that `TX.data` is valid BEFORE the start bit is sent, and AT THE SAME TIME when `TX.ack` is asserted
@ghost ghost force-pushed the serial branch 2 times, most recently from fe7c4df to f64d8d7 Compare January 31, 2020 04:58
HarryMakes and others added 3 commits March 1, 2020 11:51
@ghost
Copy link
Author

ghost commented Apr 23, 2020

From 46dac6a: the AsyncSerialBitstreamTestCase FV model now checks the scenario of sending an extra start bit (0) at a delay after sending the last bit of the bitstream. Such a delay takes any number of clock cycles from 0 to divisor+1 in order to test the continuous and non-continuous cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant