Re: [myhdl-list] Characterstringhandling
Brought to you by:
jandecaluwe
|
From: Thomas T. <tho...@de...> - 2008-06-22 06:23:52
|
Jan Decaluwe wrote:
> Mm. I want the intbv to be almost an int, not a string, and
> I want MyHDL to preserve strong typing. This is not perl :-)
>
> Why can't you use enumerated types for your purpose?
>
> command = enum("YES", "NO", "MAYBE")
>
> a.next = command.YES
> if a == command.NO:
Besides it is a lot of typing ("strong typing" ;-) ) it does not help,
when parsing real text strings.
But I don't want to start a philosophical discussion about any kind of
typing.
I would use:
a.next = ord("y")
if a == ord("y"):
But that also does not work. The verilog code looks like this:
if ((char == ord(y))) begin
It does not seem to be Verilog syntax, is it?
Maybe the conversion result should be
if ((char == 121)) begin
Would you agree?
Maybe I can supply a patch for this - but it seems to be not that easy.
|