Comments (5)
In SystemVerilog, the '1
literal (with a leading '
) is a shortcut to assign all bits of the assignee to ones.
For example:
logic [31:0] example;
// The following two lines are equivalent
assign example = '1;
assign example = 32'hFFFFFFFF;
// Not to be confused with:
assign example = 1;
// which is identical to:
assign example = 32'h00000001;
from peakrdl-regblock.
Sorry, yes, that's correct; however, my expectation was that the hwset
port would be 32 bits wide, and each bit would be set independently, not all at once.
That being said, the spec says "set the field (hwclr and hwset) by asserting a single pin" and so perhaps my expectation is wrong. Allowing each bit to be set independently seems more useful than setting all bits, but perhaps my use case is unusual.
Is there a better way to accomplish this? Do I need to manually add 32 1-bit fields with the hwset
property?
from peakrdl-regblock.
Ah I see. I misunderstood your question.
That is correct - for the hwset
property, it infers a single-bit input to set all bits.
Aside from splitting to individual 1-bit fields, if you want to set individual bits in a field you probably have to handle this outside of the regblock. I can't think of a good way to do it entirely in RDL. One way would be using the hardware write-enable mechanism:
field {
sw = rw;
hw = rw;
we;
} b[31:0] = 0;
Then in RTL use the write-enable to apply the updated per-bit set behavior:
assign hwif_in.a.b.we = |my_bit_set_vector;
assign hwif_in.a.b.next = my_bit_set_vector | hwif_out.a.b.value;
from peakrdl-regblock.
Thank you! And thanks for PeakRDL!
Would you be open to a PR which added an option for this? I'm not sure if I'm going to take that on right now, still evaluating, but thinking about it. It's useful enough to us.
from peakrdl-regblock.
Sure! I can see how this could be useful.
This would definitely have to be a separate property. Changing the behavior of hwset
and hwclr
would be inappropriate since the SystemRDL spec pretty clearly dictates this is a single-bit strobe to set/clear the entire field (I actually use hwclr like this on multi-bit fields intentionally in some applications)
I would recommend implementing this as separate user-defined properties like bitwise_hwset
and bitwise_hwclr
, much like some of the other extended properties I have implemented.
from peakrdl-regblock.
Related Issues (20)
- Interface data width vs register width vs access width HOT 1
- Unaligned external addressable components
- Clock gating support HOT 4
- More optimized readback stage RTL generation HOT 3
- Put pragmas around assertions HOT 2
- Parity on R/W registers HOT 2
- Fine-grained access rights HOT 2
- [FEATURE] External register fields HOT 1
- [BUG] memory size is not calulated correctly HOT 4
- External registers packed struct HOT 1
- [FEATURE] Parameters in regblock package
- [BUG] Genus unsynthesizable error on rising/falling edge interrupt field
- Request to change from typdef enum int to typedef enum logic to resolve Lint Issues. HOT 5
- Casting For-Loop Iterator to Match Address Width in Decoding Logic
- unconditional is None # Can only have one unconditional assignment per field HOT 2
- SW = rw, HW = rw behavior seems incorrect HOT 3
- Files generated by this project do not work with Verilator HOT 3
- Timing of swmod seems 1 cycle too early HOT 2
- External mem state machine gets confused by rd_ack that may result from READ_FIRST BRAMs HOT 3
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 peakrdl-regblock.