Re: [myhdl-list] Characterstringhandling
Brought to you by:
jandecaluwe
|
From: Jan D. <ja...@ja...> - 2008-06-20 12:59:40
|
Thomas Traber wrote:
> Here comes an explanation of my bug report about improper character
> string handling.
>
> The following does not work:
>
> a = Signal(intbv()[8:])
> a.next = "y"
> if a == "n":
> ...
>
> IMO should myhdl at least character strings with length of one like an
> integer ( ord(character) ).
>
> I use this charcter handling for a simple command parser.
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:
...
Jan
--
Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com
Kaboutermansstraat 97, B-3000 Leuven, Belgium
|