SpinalHDL / SpinalHDL/SpinalDoc-RTD
Add section for idioms
Open
@numero-744 is already working on this.
Since Nov 15, 2022.
enhancement
- Dominant language
- Python
- Stars
- 32
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Description
Spinal enables representing the code in a way which is not possible in RTL.
This section would show idioms which are useful in Spinal. For each idiom, it would explain it, how to use it, when and why it is good to use it, and maybe how it works.
Example of idiom:
val doSomethingFlag = False
def doSomething(): Unit = doSomethingFlag := True
I find it useful in fsm.State.whenActive to express the output logic.
val fsm = new StateMachine {
val IDLE, Rnd0, RndI, RndN, DONE = new State
setEntry(IDLE)
// Transition logic
IDLE.whenIsActive { when(io.start) { goto(Rnd0) } }
Rnd0.whenIsActive { goto(RndI) }
RndI.whenIsActive { when(round.isLast) { goto(RndN) } }
RndN.whenIsActive { goto(DONE) }
DONE.whenIsActive { when(!io.start) { goto(IDLE) } }
// Output logic, using only this idiom
IDLE.whenIsActive { round.resetCount }
Rnd0.whenIsActive { run; useInputs }
RndI.whenIsActive { run }
RndN.whenIsActive { run; withoutMixColumns }
DONE.whenIsActive { enableOutput }
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.