1

System verilog allows numeric constants like this:

32'hdead_beef this is equivalent to the c value of 0xdeadbeef

System verilog allows the bit width to be defined as well as the base.

In general it is

<bit-width-in-decimal>'<base><digits-and-underscore>
<base> can be:
  • 'd' for decimal
  • 'h' for hexadecimal
  • 'o' for octal
  • 'b' binary

The underscore is ignored by the parser and is used for human readability. The hex digits are case insensitive.

The question is how to describe to calc this style of numbers.

I presume I will have to define a new language to calc. (it supports c/c++, Pascal, Fortran, and others.)

Is there a tutorial for how to add new calc languages?

Is there a special "syntax" table or regular expression that describes the input format?

Thanks for any help

Ian

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.