Giter VIP home page Giter VIP logo

Comments (5)

amykyta3 avatar amykyta3 commented on September 2, 2024

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.

darrylring avatar darrylring commented on September 2, 2024

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.

amykyta3 avatar amykyta3 commented on September 2, 2024

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.

darrylring avatar darrylring commented on September 2, 2024

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.

amykyta3 avatar amykyta3 commented on September 2, 2024

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)

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.