This repository was archived by the owner on Jan 5, 2026. It is now read-only.
examples/sim: add shift(-right) register examples#217
Draft
HarryMakes wants to merge 1 commit into
Draft
Conversation
2 types of shift register implementations are introduced. * `sr1.py`: Implementation of shift-right register that begins shifting at reset. It is demonstrated with a parallel-to-serial and a serial-to-parallel register, each of which processes 8 bits of data at a time. * `sr2.py`: Implementation of shift-right register whose shifting action is controlled by an input and an output strobe. It is demonstrated with a parallel-to-serial and a serial-to-parallel register, each of which can output 8 bits of data while fetching in new 8-bit data simultaneously.
Contributor
Author
|
Reimplemented the examples with 1fb3a5a. Styling should be improved if this PR is approved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.