@@ -265,11 +265,6 @@ def __str__(self):
265
265
return "{} x{}, x{}, x{}" .format (self .mnemonic , self .rd , self .rs1 ,
266
266
self .rs2 )
267
267
268
- def __eq__ (self , other ):
269
- if not super ().__eq__ (other ):
270
- return False
271
- return self .rs1 == other .rs1 and self .rs2 == other .rs2 and self .rd == other .rd
272
-
273
268
274
269
class InstructionIType (InstructionFunct3Type , metaclass = ABCMeta ):
275
270
"""
@@ -392,12 +387,6 @@ def __str__(self):
392
387
return "{} x{}, x{}, 0x{:02x}" .format (self .mnemonic , self .rd , self .rs1 ,
393
388
self .shamt )
394
389
395
- def __eq__ (self , other ):
396
- if not super ().__eq__ (other ):
397
- return False
398
- return (self .rd == other .rd and self .rs1 == other .rs1
399
- and self .shamt == other .shamt )
400
-
401
390
402
391
class InstructionSType (InstructionFunct3Type , metaclass = ABCMeta ):
403
392
"""
@@ -539,13 +528,21 @@ class InstructionJType(Instruction, metaclass=ABCMeta):
539
528
:param imm: Immediate for the jump (21-bit, signed, 16-bit aligned)
540
529
:type imm: int
541
530
"""
531
+
532
+ field_rd = Field (name = "rd" , base = 7 , size = 5 , description = "" )
533
+ field_imm = Field (name = "imm" , base = [21 ,20 ,12 ,31 ], size = [10 ,1 ,8 ,1 ], description = "" )
534
+
542
535
def __init__ (self , rd : int = None , imm : int = None ):
543
536
super (InstructionJType , self ).__init__ ()
544
537
self .rd = rd # pylint: disable=invalid-name
545
538
self .imm = Immediate (bits = 21 , signed = True , lsb0 = True )
546
539
if imm is not None :
547
540
self .imm .set (imm )
548
541
542
+ def ops_from_list (self , ops ):
543
+ self .rd = int (ops [0 ][1 :])
544
+ self .imm .set (int (ops [1 ]))
545
+
549
546
def randomize (self , variant : Variant ):
550
547
self .rd = randrange (0 , variant .xlen )
551
548
self .imm .randomize ()
0 commit comments