Jump to content

CLOG2 operator


Risto

Recommended Posts

Hello,

I've been using SystemRDL for the last few months, and although I think that the language has a lot of potential, I feel like it is lacking some features.

One of the most surprising missing features for me is $clog2 operator from Verilog.

It is really a common thing to have your parameter be a number and have a field that is adjusted to the width to fit that number.

One way I get around it is by defining a SV style macro and use it like this:

`define CLOG2(VAL) \
    (((VAL) <= 1) ? 0 : \
    ((VAL) <= 2) ? 1 : \
    ((VAL) <= 4) ? 2 : \
    ((VAL) <= 8) ? 3 : \
    ((VAL) <= 16) ? 4 : \
    ((VAL) <= 32) ? 5 : \
    ((VAL) <= 64) ? 6 : \
    ((VAL) <= 128) ? 7 : \
    ((VAL) <= 256) ? 8 : \
    .................. : \ 
    0

This works fine but still feels like this should be a part of the language.

Are you taking feature requests, is it foreseen to have another revision of the standard in the future?

If so I would have more feature requests that I would like to be implemented.

Link to comment
Share on other sites

Hello Risto,

The $clog2() function has been part of IP-XACT since the 2014 version.  It was my intention to add the same IP-XACT System Verilog expression capability to SystemRDL.  Due to time and resource constraints the committee voted to implement a smaller subset of the System Verilog expression features for SystemRDL 2.0.  I agree that $clog2() should be added to the next version of SystemRDL.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...