Giter Site home page Giter Site logo

Comments (6)

rdaly525 avatar rdaly525 commented on June 24, 2024

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.

leonardt avatar leonardt commented on June 24, 2024

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.

rsetaluri avatar rsetaluri commented on June 24, 2024

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.

rdaly525 avatar rdaly525 commented on June 24, 2024

We would not need to extend const generator. We could just use a genarg/modarg with a CoreIR::Value

from coreir.

leonardt avatar leonardt commented on June 24, 2024

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.

rdaly525 avatar rdaly525 commented on June 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.