Jump to content

SystemVerilog expression parsing


Recommended Posts

Hi,

The IEEE1685-2014 standard says it utilizes SystemVerilog expressions as a means to specify an equation as the value of an element.

In below example, there is a parameter my_param of 'byte' type, and its value is an expression (param_A - param_B):

<ipxact:moduleParameters>
 <ipxact:moduleParameter type="byte">
 <ipxact:name>my_param</ipxact:name>
 <ipxact:value>param_A - param_B</ipxact:value>
 </ipxact:moduleParameter>
 </ipxact:moduleParameters>

Is it valid to set 32-bit value to param_A and param_B, e.g., param_A==0xFFFFFFFF and param_B==0xFFFFFFFE, whose computed value is 1?

Should the expression parser convert param_A and param_B to byte type firstly and then do computation, or cast each operands to its int type and do int computation and convert the result to byte?

 

thanks,

Yohuang

Link to comment
Share on other sites

Hi Yohuang,

param_A and param_B should be casted to there own type and range first. Then the subtraction is applied and the result should be casted to the type and range of my_param.

Please note that there is a newer version 1685-2022. Please use this version if you can because it supersedes 1685-2014.

Best regards,
Erwin

 

 

Link to comment
Share on other sites

Thanks for quick response.

What if the my_param is of type int, and the ipxact:value looks like this:

<ipxact:moduleParameters>
 <ipxact:moduleParameter type="int">
 <ipxact:name>my_param</ipxact:name>
 <ipxact:value>0x100000000 - 0xFFFFFFFF</ipxact:value>
 </ipxact:moduleParameter>
 </ipxact:moduleParameters>

Should systemVerilog parser cast up-cast both 0x100000000 (33bit) and 0xFFFFFFFF (32bit) to longint (64bit) and then cast the substraction result to int?

>> Please note that there is a newer version 1685-2022. Please use this version if you can because it supersedes 1685-2014.

Thanks for the suggestion, yes, I do have plan to move this newer version. Currently I'm doing some experiments with 1685-2014.



thanks,

Yohuang

Link to comment
Share on other sites

Hi Yohuang,

I need to read the SV on this. My understanding is that unsized constant numbers need to be represented as int (32 bit) and therefore the substraction is also represented as int (32 bits) (Section 11.6.1 and 11.6.2 in IEEE Std 1800-2012). So no up conversion to longint here.

Best regards,
Erwin

Link to comment
Share on other sites

  • 2 weeks later...

Hi Kock,

As IP-XACT expression does not support assign operators, the expressions compuation should be all self-determined for signess and size, right? 

If the above my_param is of long type, we will still compute the (0x100000000 - 0xFFFFFFFF) as signed int and the result will be converted to long then, right?

 

thanks,

Yohuang

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...