Re: [myhdl-list] Conversion of Signal(intbv(False))
Brought to you by:
jandecaluwe
From: Jan D. <ja...@ja...> - 2009-01-18 07:44:53
|
Felton Christopher wrote: >>> >>> This can be worked around by adding bit width, Signal(intbv(False) >>> [1:]). But if this is done the code (or at least the example below) >>> doesn't work, because the intbv type insn't a bool anymore. Once the >>> bit width is added it becomes an integer and the conditions will fail >>> for a non-bool type. >> What exactly doesn't work about that? Conversion seems to work fine, >> and I don't immediately see what would be wrong with the Verilog or >> VHDL >> code. >> >> Also, before going into the depth of the matter, what's against >> simply using Signal(False) for the boolean signals? >> > > Sorry this is my error, I was thinking only type intbv was > convertible and didn't cross my mind to use Signal(bool). Quick look > through the manual and some past work didn't remind my brain. Right, perhaps it is useful to post the documentation link for others reading this: http://www.myhdl.org/doc/0.6/manual/conversion.html#supported-types Even though intbv is the "workhorse" and does many of the things for which you need a number of different types in other HDLs, it is not the only type you can and should use. bool and enum both have its uses and make things more explicit: bool for boolean (and therefore single-bit) variables, enum for state variables as in VHDL. Jan -- Jan Decaluwe - Resources bvba - http://www.jandecaluwe.com Python as a hardware description language: http://www.myhdl.org |