SourceForge: myhdl/myhdl: changeset 1084:2ff17ece6131
Added a string replace to the intbv constructor for binary strings. It allows the bit separators the same as Verilog. Example x = intbv("0_0000_01010")
authorcfelton@localhost
Tue Oct 06 07:02:37 2009 -0500 (2 months ago)
changeset 10842ff17ece6131
parent 1083 daaac30b13e5
child 1085 3dc72f5202ab
Added a string replace to the intbv constructor for binary strings. It allows the bit separators the same as Verilog. Example x = intbv("0_0000_01010")
myhdl/_intbv.py
     1.1 --- a/myhdl/_intbv.py	Thu Sep 17 08:37:40 2009 -0500
     1.2 +++ b/myhdl/_intbv.py	Tue Oct 06 07:02:37 2009 -0500
     1.3 @@ -51,7 +51,8 @@
     1.4          if isinstance(val, (int, long)):
     1.5              self._val = val
     1.6          elif isinstance(val, StringType):
     1.7 -            self._val = long(val, 2)
     1.8 +            mval = val.replace('_', '')
     1.9 +            self._val = long(mval, 2)
    1.10              _nrbits = len(val)
    1.11          elif isinstance(val, intbv):
    1.12              self._val = val._val