@@ -3,20 +3,20 @@ package treecorel3
33import chisel ._
44import chiesl .uitl ._
55
6- class ImmGenIO ( implicit p : Parameters ) extends Bundle {
7- val inst = Input (UInt (xlen .W ))
6+ class ImmGenIO extends Bundle with IOConfig {
7+ val inst = Input (UInt (XLen .W ))
88 val sel = Input (UInt (3 .W ))
9- val out = Output (UInt (xlen .W ))
9+ val out = Output (UInt (XLen .W ))
1010}
1111
12- class ImmGen ( implicit p : Parameters ) extends Module {
13- val io = IO (new ImmGenIO )
14- val Iimm = io.inst(31 , 20 ).asSInt
15- val Simm = Cat (io.inst(31 , 25 ), io.inst(11 , 7 )).asSInt
16- val Bimm = Cat (io.inst(31 ), io.inst(7 ), io.inst(30 , 25 ), io.inst(11 , 8 ), 0 .U (1 .W )).asSInt
17- val Uimm = Cat (io.inst(31 , 12 ), 0 .U (12 .W )).asSInt
18- val Jimm = Cat (io.inst(31 ), io.inst(19 , 12 ), io.inst(20 ), io.inst(30 , 25 ), io.inst(24 , 21 ), 0 .U (1 .W )).asSInt
19- val Zimm = io.inst(19 , 15 ).zext
12+ class ImmGen extends Module {
13+ val io = IO (new ImmGenIO )
14+ protected val Iimm = io.inst(31 , 20 ).asSInt
15+ protected val Simm = Cat (io.inst(31 , 25 ), io.inst(11 , 7 )).asSInt
16+ protected val Bimm = Cat (io.inst(31 ), io.inst(7 ), io.inst(30 , 25 ), io.inst(11 , 8 ), 0 .U (1 .W )).asSInt
17+ protected val Uimm = Cat (io.inst(31 , 12 ), 0 .U (12 .W )).asSInt
18+ protected val Jimm = Cat (io.inst(31 ), io.inst(19 , 12 ), io.inst(20 ), io.inst(30 , 25 ), io.inst(24 , 21 ), 0 .U (1 .W )).asSInt
19+ protected val Zimm = io.inst(19 , 15 ).zext
2020
2121 io.out := MuxLookup (
2222 io.sel,
0 commit comments