sim._pyrtl: mask bitwise binary operands.
Boolean negation produces negative integers, which when unmasked drastically affects the result of these operations.
This commit is contained in:
		
							parent
							
								
									59a83cf7eb
								
							
						
					
					
						commit
						99417d6499
					
				|  | @ -166,11 +166,11 @@ class _RHSValueCompiler(_ValueCompiler): | |||
|             if value.operator == "%": | ||||
|                 return f"zmod({sign(lhs)}, {sign(rhs)})" | ||||
|             if value.operator == "&": | ||||
|                 return f"({self(lhs)} & {self(rhs)})" | ||||
|                 return f"({mask(lhs)} & {mask(rhs)})" | ||||
|             if value.operator == "|": | ||||
|                 return f"({self(lhs)} | {self(rhs)})" | ||||
|                 return f"({mask(lhs)} | {mask(rhs)})" | ||||
|             if value.operator == "^": | ||||
|                 return f"({self(lhs)} ^ {self(rhs)})" | ||||
|                 return f"({mask(lhs)} ^ {mask(rhs)})" | ||||
|             if value.operator == "<<": | ||||
|                 return f"({sign(lhs)} << {sign(rhs)})" | ||||
|             if value.operator == ">>": | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Charlotte
						Charlotte