mname = get_pname("dec_sub%d" % key, self.pname)
setattr(m.submodules, mname, subdecoder)
comb += subdecoder.opcode_in.eq(self.opcode_in)
+ # XXX hmmm...
+ #if self.row_subsetfn:
+ # if not self.row_subsetfn(key, row):
+ # continue
# add in the dynamic Case statement here
with m.Case(key):
comb += self.op.eq(subdecoder.op)
opcode = int(opcode, 0)
if not row['unit']:
continue
+ if self.row_subsetfn:
+ if not self.row_subsetfn(opcode, row):
+ continue
# add in the dynamic Case statement here
with m.Case(opcode):
comb += self.op._eq(row)
if __name__ == '__main__':
- pdecode = create_pdecode()
+
+ # row subset
+
+ def rowsubsetfn(opcode, row):
+ print ("row_subset", opcode, row)
+ return row['unit'] == 'ALU'
+
+ pdecode = create_pdecode(name="rowsub",
+ col_subset={'function_unit', 'in1_sel'},
+ row_subset=rowsubsetfn)
vl = rtlil.convert(pdecode, ports=pdecode.ports())
- with open("decoder.il", "w") as f:
+ with open("row_subset_decoder.il", "w") as f:
f.write(vl)
+ # col subset
+
pdecode = create_pdecode(name="fusubset", col_subset={'function_unit'})
vl = rtlil.convert(pdecode, ports=pdecode.ports())
with open("col_subset_decoder.il", "w") as f:
f.write(vl)
+
+ # full decoder
+
+ pdecode = create_pdecode()
+ vl = rtlil.convert(pdecode, ports=pdecode.ports())
+ with open("decoder.il", "w") as f:
+ f.write(vl)
+