@@ -46,7 +46,8 @@ def is_fp_instruction(insn):
46
46
47
47
from riscv_ctg .dsp_function import *
48
48
49
- twos_xlen = lambda x : twos (x ,xlen )
49
+ def twos_xlen (x ):
50
+ return twos (x , xlen )
50
51
51
52
def toint (x : str ):
52
53
if '0x' in x :
@@ -89,7 +90,6 @@ def get_rm(opcode):
89
90
'cjformat' : [],
90
91
'ckformat' : ['rs1' ],
91
92
'kformat' : ['rs1' ,'rd' ],
92
- 'ckformat' : ['rs1' ],
93
93
# 'frformat': ['rs1', 'rs2', 'rd'],
94
94
'fsrformat' : ['rs1' , 'rd' ],
95
95
# 'fr4format': ['rs1', 'rs2', 'rs3', 'rd'],
@@ -144,7 +144,6 @@ def get_rm(opcode):
144
144
'cjformat' : "['imm_val']" ,
145
145
'ckformat' : "['rs1_val']" ,
146
146
'kformat' : "['rs1_val']" ,
147
- 'ckformat' : "['rs1_val']" ,
148
147
# 'frformat': "['rs1_val', 'rs2_val', 'rm_val', 'fcsr']",
149
148
'fsrformat' : "['rs1_val','fcsr'] + get_rm(opcode) + \
150
149
([] if not is_nan_box else ['rs1_nan_prefix']) + \
@@ -187,7 +186,8 @@ def isInt(s):
187
186
188
187
def get_default_registers (ops , datasets ):
189
188
problem = Problem ()
190
- not_x0 = lambda x : x not in ['x0' ]
189
+ def not_x0 (x ):
190
+ return x not in ["x0" ]
191
191
192
192
for op in ops :
193
193
dataset = datasets [op ]
@@ -348,7 +348,8 @@ def opcomb(self, cgf):
348
348
op_conds [op ] = set ([])
349
349
individual = False
350
350
nodiff = False
351
- construct_constraint = lambda val : (lambda x : bool (x in val ))
351
+ def construct_constraint (val ):
352
+ return lambda x : bool (x in val )
352
353
while any ([len (op_conds [x ])!= 0 for x in op_conds ]+ [len (op_comb )!= 0 ]):
353
354
cond_str = ''
354
355
cond_vars = []
@@ -536,7 +537,8 @@ def __jfmt_instr__(self,op=None,val=None):
536
537
if val :
537
538
cond_str += val [- 1 ]
538
539
instr = {'inst' :self .opcode ,'index' :'0' , 'comment' :cond_str }
539
- labelize = lambda x : (str ((- x )% 2 ** 21 ),'1b' ) if x < 0 else (str ((x % 2 ** 21 )),'3f' )
540
+ def labelize (x ):
541
+ return (str (- x % 2 ** 21 ), "1b" ) if x < 0 else (str (x % 2 ** 21 ), "3f" )
540
542
if op :
541
543
for var ,reg in zip (self .op_vars ,op ):
542
544
instr [var ] = str (reg )
@@ -572,7 +574,8 @@ def __bfmt_instr__(self,op=None,val=None):
572
574
instr = {'inst' :self .opcode ,'index' :'0' , 'comment' :cond_str }
573
575
574
576
575
- labelize = lambda x : (str ((- x )% 2048 ),'1b' ) if x < 0 else (str ((x % 2048 )),'3f' )
577
+ def labelize (x ):
578
+ return (str (- x % 2048 ), "1b" ) if x < 0 else (str (x % 2048 ), "3f" )
576
579
577
580
if op :
578
581
for var ,reg in zip (self .op_vars ,op ):
@@ -603,7 +606,8 @@ def __cb_instr__(self,op=None,val=None):
603
606
instr = {'inst' :self .opcode ,'index' :'0' , 'comment' :cond_str }
604
607
605
608
606
- labelize = lambda x : (str ((- x )% 257 ),'1b' ) if x < 0 else (str ((x % 257 )),'3f' )
609
+ def labelize (x ):
610
+ return (str (- x % 257 ), "1b" ) if x < 0 else (str (x % 257 ), "3f" )
607
611
608
612
if op :
609
613
for var ,reg in zip (self .op_vars ,op ):
@@ -634,7 +638,8 @@ def __cj_instr__(self,op=None,val=None):
634
638
instr = {'inst' :self .opcode ,'index' :'0' , 'comment' :cond_str }
635
639
636
640
637
- labelize = lambda x : (str ((- x )% 2048 ),'1b' ) if x < 0 else (str ((x % 2048 )),'3f' )
641
+ def labelize (x ):
642
+ return (str (- x % 2048 ), "1b" ) if x < 0 else (str (x % 2048 ), "3f" )
638
643
639
644
if op :
640
645
for var ,reg in zip (self .op_vars ,op ):
@@ -1264,7 +1269,8 @@ def correct_val(self,instr_dict):
1264
1269
for i in range (len (instr_dict )):
1265
1270
instr_dict [i ]['correctval_hi' ] = '0'
1266
1271
if self .fmt in ['caformat' ,'crformat' ]:
1267
- normalise = lambda x ,y : 0 if y ['rs1' ]== 'x0' else x
1272
+ def normalise (x , y ):
1273
+ return 0 if y ["rs1" ] == "x0" else x
1268
1274
else :
1269
1275
normalise = (lambda x ,y : x ) if 'rd' not in self .op_vars else (lambda x ,y : 0 if y ['rd' ]== 'x0' else x )
1270
1276
if self .operation :
0 commit comments