Comments (6)
Seems like we have a couple options:
a) represent a number like 4'b1?1?' as a coreir BitVector constant
a1) extend BitVector Values to allow '?'
a2) extend BitVector Values to be '4 valued' (X,Z,0, 1) and use "X" to mean "?" in the context of the case-muxes.
b) use the string "1?1?" and do parsing/determine semantics in the generator
We should not define a new primitive.
This also somewhat relates to a goal of mine to replace all modargs/configargs with 'Const' types in the module's interface.
from coreir.
For b), would that mean that the const generator understands how to parse a string argument? I think that would be fine and much simpler to implement for synthesis (i.e. verilog codegen). I think a) would be the way to go for supporting it in the simulator (i.e. the BitVector constant would need to support "don't care" or have to special case the primitive in some way) and is probably a better long term solution, but I would imagine is quite a bit more work.
One thing I noticed in the Chisel reference is that they use a notion of a literal value (with don't care as 0) and a mask (can be used to mask off the significant bits of interest when comparing and ignoring the don't cares). So it seems like for now, in the front-end we could implement the literal+mask logic as a temporary solution (especially if we want to go with option a since that seems like it will take some time).
from coreir.
I think overloading the existing const generator to parse "1?1?" might be stuffing too much functionality into the same place. The real use of these bit patterns is for case's right? Perhaps we could have generators specifically for that application? In magma, we could have nicer syntax of course.
Another thought, looking at the chisel example: it looks like the real use-case is to do like "instruction decode". If we're designing for this use case from the ground up, it seems like the peak-style is what we want to evangelize? I.e. tagged unions + "assemblers". It might be better to present this kind of abstraction, and then generate bit-patterns in the verilog. It's possible that you may want bit-patterns independent of this use-case. Just a thought.
from coreir.
We would not need to extend const generator. We could just use a genarg/modarg with a CoreIR::Value
from coreir.
I think there's more use cases than just instruction decode, such as a priority encoder, but I'm not sure how many they're are, @rdaly525 is probably more familiar whether this is a more general pattern beyond decode.
from coreir.
I think having a case-mux generator is a good idea even if we also separately pursue peak-style assembling. Also, in case this was not clear I was advocating the case-mux generator itself take in an genarg or modarg of "1?1?" instead of using a coreir.const.
from coreir.
Related Issues (20)
- Add a Custom Name for CoreIR Generator When Generate Verilog HOT 14
- Cannot get two bit types to wire together regardless of direction? HOT 3
- Regression in inline commonlib mux verilog generation
- Verilog backend can clobber names when generating instance output port wires
- Having trouble at branch rm-ubuf-master HOT 3
- inline_single_instance pass should maintain instance name HOT 1
- Update JSON for Modern C++
- Why is IEEE compliance for CW floating point add/mul set to 0? HOT 2
- verilog ND-array generation should be packed arrays instead of unpacked arrays. HOT 3
- Add Multiply optimization
- segfault when using prototype components. HOT 44
- [feature request] adding prefix to coreir/commonlib/... verilog modules HOT 4
- add_dummy_inputs pass doesn't work with sliced signals
- Add module longname C API
- Compilation error on Apple M1 chip HOT 11
- Request for CoreIR compatible with Windows. HOT 1
- InstanceVisitorPass does not allow passing in functors that have access to the class object itself.
- Need to change googletest tag from master to main HOT 2
- google test throws sign conversion warnings
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 coreir.