Comments (4)
class DelayBy1(resetValue: Option[UInt] = None) extends Module {
val io = IO(new Bundle {
val in = Input( UInt(16.W))
val out = Output(UInt(16.W))
})
val reg = if (resetValue.isDefined) { // resetValue = Some(number)
RegInit(resetValue.get)
} else { //resetValue = None
Reg(UInt())
}
reg := io.in
io.out := reg
}
println(getVerilog(new DelayBy1))
println(getVerilog(new DelayBy1(Some(3.U))))
from chisel-bootcamp.
This is the original code.
from chisel-bootcamp.
What you are describing is the desired behavior.
Registers without resets are synthesizable. As you say, it may introduce bugs if the garbage initial value is used in some undesirable way, but in some situations registers without reset values may be OK.
In the case of this module, imagine that there is a block that reads the value of io.out
, but only does so several cycles after io.in
is valid data (perhaps io.in
is valid 2 cycles after reset and io.out
is read 3 cycles after reset).
Resets can add extra overhead, especially because chisel resets are synchronous.
from chisel-bootcamp.
@grebe Thank you for your explanation!
from chisel-bootcamp.
Related Issues (20)
- 2.6: `DecoupledGcd` example is not decoupled on the output side and tests fail to catch it
- ammonite.util.CompilationError: Failed to resolve ivy dependencies:Error downloading edu.berkeley.cs:chisel3_2.13:3.2.0 HOT 4
- how to save the dependent libraries in the local Machine HOT 2
- Failed to resolve ivy dependencies:/coursier_cache/.structure.lock (Permission denied) HOT 4
- 2.3_control_flow Reference io is not fully initialized. HOT 1
- java.nio.charset.MalformedInputException: Input length = 1 HOT 5
- cmd10.sc:12: reference to Data is ambiguous; HOT 2
- the tester in "2.5_exercise.ipynb" for example "DSPBlock" is old test framework
- 3.2 interlude: arbiter never asserts "ready" for inputs
- Chapter 3.3 - excercise on decoupled arbiter is confusing
- Chapter 3.6 - companion object for Mac: solution for apply(..) is not a Factory method HOT 2
- Write a "How to contribute" section to the README
- Module 2.5 - DspBlock - not found: type PeekPokeTester HOT 1
- the direction of <> operator in Chisel? in 2.6 chiseltest HOT 1
- doubt about 2.6 Chiseltest HOT 2
- can not run 2.1 locally HOT 6
- value step is not a member of chisel3.Clock in 3.2 HOT 4
- I have a question about scala grammar in 3.6
- I have some question about module 3 Interlude: Chisel Standard Library
- Latest docker image has bad permissions, results in cell run errors, manual temporary fix available
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chisel-bootcamp.