examples/sim: add shift(-right) register examples #217
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Edit: 2020-10-14: changed types from "parallel-in" and "serial-in" to with and without input/output enable strobes.
Overview
This PR introduces possible shift register implementations, in the hope of boosting the learning experience for Migen users.
Details
2 examples are introduced to implement 2 possible types of a shift-right register.
sr1.py
: Implementation of shift-right register that begins shifting at reset (i.e. input and output are always enabled).sr2.py
: Implementation of shift-right register whose shifting action is controlled by an input and an output strobe.For each type, 2 examples showing different modes of shift registers are provided. All these examples are 8-bit shift registers. The two modes are:
Parallel-In, Serial-Out: Input is 8-bit wide while output is 1-bit wide, shifting out 1 bit of a complete input value from LSB (bit 0) to MSB (bit 7) at a time.
Serial-In, Parallel-Out: Input is 1-bit wide, shifting in 1 bit of a value from LSB (bit 0) to MSB (bit 7) at a time, while output is 8-bit wide.