@@ -20,6 +20,17 @@ def FixedOutput(m, name, width=32, point=0,
2020 return obj
2121
2222
23+ def FixedOutputReg (m , name , width = 32 , point = 0 ,
24+ length = None , signed = True , initval = None ):
25+ obj = _FixedOutput (width = width , length = length , signed = signed ,
26+ name = name , module = m , point = point )
27+ m .add_object (obj )
28+ obj = _FixedReg (width = width , length = length , signed = signed , initval = initval ,
29+ name = name , module = m , point = point )
30+ m .add_object (obj )
31+ return obj
32+
33+
2334def FixedInout (m , name , width = 32 , point = 0 ,
2435 length = None , signed = True ):
2536 obj = _FixedInout (width = width , length = length , signed = signed ,
@@ -210,6 +221,9 @@ def dec_part(self):
210221 vtypes .Int (1 , width = 1 ), self .point ))
211222 return self & mask
212223
224+ def to_int (self ):
225+ return self .int_part
226+
213227 def _adjust (self , value ):
214228 lpoint = self .point
215229 rvalue = value
@@ -273,6 +287,8 @@ def __pos__(self):
273287
274288class _FixedVariable (_FixedBase , vtypes ._Variable ):
275289 ast_name = None
290+ __hash__ = vtypes ._Variable .__hash__
291+ no_write_check = True
276292
277293 def __init__ (self , width = 1 , length = None , signed = True , value = None , initval = None , name = None ,
278294 module = None , point = 0 ):
@@ -330,6 +346,7 @@ def _add_subst(self, s):
330346class _FixedBinaryOperator (_FixedBase , vtypes ._BinaryOperator ):
331347 ast_name = None
332348 overwrite_signed = False
349+ __hash__ = vtypes ._BinaryOperator .__hash__
333350
334351 def init (self , left , right ):
335352 lpoint = left .point if isinstance (left , _FixedBase ) else 0
@@ -345,6 +362,7 @@ def init(self, left, right):
345362
346363class _FixedUnaryOperator (_FixedBase , vtypes ._UnaryOperator ):
347364 ast_name = None
365+ __hash__ = vtypes ._UnaryOperator .__hash__
348366
349367 def __init__ (self , right ):
350368 vtypes ._UnaryOperator .__init__ (self , right )
@@ -510,6 +528,7 @@ class _FixedConstant(_FixedBase):
510528
511529class _FixedInt (_FixedConstant , vtypes .Int ):
512530 ast_name = 'Int'
531+ __hash__ = vtypes .Int .__hash__
513532
514533 def __init__ (self , value , width = None , base = None , point = 0 , signed = True , raw = False ):
515534 value = value if raw else to_fixed (value , point )
0 commit comments