79695873

Date: 2025-07-09 15:19:04
Score: 2
Natty:
Report link

turns out it can be as simple as
constant STACKSV : integer := ((character'pos(STACK(1))) * 256 * 256) + ((character'pos(STACK(2))) * 256) + ((character'pos(STACK(3))))
which for "int" produces 0x00746F70, which I can use, it's the integer equivalent of the V/SV "int".
That is, in my VHDL, pass generic STACK => STACKSV, and in the V/SV I can do if(STACK == "int") ...

Obviously, I could have shifted left 8 more bits and added 0x20, that would have answered the original question; but this actually is what I needed.

Now if someone could show me how in VHDL to do a left shift by 16 instead of a multiply by 256*256, and an OR instead of the addition, I'd be truly grateful. Given the strong typing of VHDL, I can't quite seem to get it right....

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: jmhiu