mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Merge pull request #3 from kipmacsaigoren/illegal_specific
More specific decoding for base instructions
This commit is contained in:
		
						commit
						04f9af782d
					
				| @ -80,7 +80,6 @@ module alu #(parameter WIDTH=32) ( | |||||||
|     assign CondMaskB = (Mask) ? MaskB : B; |     assign CondMaskB = (Mask) ? MaskB : B; | ||||||
|   end else assign CondMaskB = B; |   end else assign CondMaskB = B; | ||||||
| 
 | 
 | ||||||
|   |  | ||||||
|   if (WIDTH == 64) begin |   if (WIDTH == 64) begin | ||||||
|     mux3 #(1) signmux(A[63], A[31], 1'b0, {~SubArith, W64}, shSignA); |     mux3 #(1) signmux(A[63], A[31], 1'b0, {~SubArith, W64}, shSignA); | ||||||
|     mux3 #(64) extendmux({{32{1'b0}}, A[31:0]},{{32{A[31]}}, A[31:0]}, A,{~W64, SubArith}, CondExtA); |     mux3 #(64) extendmux({{32{1'b0}}, A[31:0]},{{32{A[31]}}, A[31:0]}, A,{~W64, SubArith}, CondExtA); | ||||||
|  | |||||||
| @ -38,6 +38,7 @@ module bmuctrl( | |||||||
|   output logic [1:0]  BSelectD,                // Indicates if ZBA_ZBB_ZBC_ZBS instruction in one-hot encoding in Decode stage
 |   output logic [1:0]  BSelectD,                // Indicates if ZBA_ZBB_ZBC_ZBS instruction in one-hot encoding in Decode stage
 | ||||||
|   output logic [2:0]  ZBBSelectD,              // ZBB mux select signal in Decode stage NOTE: do we need this in decode?
 |   output logic [2:0]  ZBBSelectD,              // ZBB mux select signal in Decode stage NOTE: do we need this in decode?
 | ||||||
|   output logic        BRegWriteD,              // Indicates if it is a R type B instruction in Decode Stage
 |   output logic        BRegWriteD,              // Indicates if it is a R type B instruction in Decode Stage
 | ||||||
|  |   output logic        BALUSrcBD,               // Indicates if it is an I/IW (non auipc) type B instruction in Decode Stage
 | ||||||
|   output logic        BW64D,                   // Indiciates if it is a W type B instruction in Decode Stage
 |   output logic        BW64D,                   // Indiciates if it is a W type B instruction in Decode Stage
 | ||||||
|   output logic        BALUOpD,                 // Indicates if it is an ALU B instruction in Decode Stage
 |   output logic        BALUOpD,                 // Indicates if it is an ALU B instruction in Decode Stage
 | ||||||
|   output logic        BSubArithD,              // TRUE if ext, clr, andn, orn, xnor instruction in Decode Stage
 |   output logic        BSubArithD,              // TRUE if ext, clr, andn, orn, xnor instruction in Decode Stage
 | ||||||
| @ -62,7 +63,7 @@ module bmuctrl( | |||||||
|   logic       PreShiftD;                       // Indicates if sh1add, sh2add, sh3add instruction in Decode Stage
 |   logic       PreShiftD;                       // Indicates if sh1add, sh2add, sh3add instruction in Decode Stage
 | ||||||
|   logic [2:0] BALUControlD;                    // ALU Control signals for B instructions
 |   logic [2:0] BALUControlD;                    // ALU Control signals for B instructions
 | ||||||
| 
 | 
 | ||||||
|   `define BMUCTRLW 16 |   `define BMUCTRLW 17 | ||||||
| 
 | 
 | ||||||
|   logic [`BMUCTRLW-1:0] BMUControlsD;                 // Main B Instructions Decoder control signals
 |   logic [`BMUCTRLW-1:0] BMUControlsD;                 // Main B Instructions Decoder control signals
 | ||||||
| 
 | 
 | ||||||
| @ -75,92 +76,96 @@ module bmuctrl( | |||||||
|   // Main Instruction Decoder
 |   // Main Instruction Decoder
 | ||||||
|   always_comb |   always_comb | ||||||
|     casez({OpD, Funct7D, Funct3D}) |     casez({OpD, Funct7D, Funct3D}) | ||||||
|     // ALUSelect_BSelect_ZBBSelect_BRegWrite_BW64_BALUOp_BSubArithD_RotateD_MaskD_PreShiftD_IllegalBitmanipInstrD
 |     // ALUSelect_BSelect_ZBBSelect_BRegWrite_BALUSrcB_BW64_BALUOp_BSubArithD_RotateD_MaskD_PreShiftD_IllegalBitmanipInstrD
 | ||||||
|       // ZBS
 |       // ZBS
 | ||||||
|       17'b0010011_0100100_001:   BMUControlsD = `BMUCTRLW'b111_01_000_1_0_1_1_0_1_0_0;  // bclri
 |       17'b0010011_0100100_001:   BMUControlsD = `BMUCTRLW'b111_01_000_1_1_0_1_1_0_1_0_0;  // bclri
 | ||||||
|       17'b0010011_0100101_001: if (`XLEN == 64) |       17'b0010011_0100101_001: if (`XLEN == 64) | ||||||
|                                  BMUControlsD = `BMUCTRLW'b111_01_000_1_0_1_1_0_1_0_0;  // bclri (rv64)
 |                                  BMUControlsD = `BMUCTRLW'b111_01_000_1_1_0_1_1_0_1_0_0;  // bclri (rv64)
 | ||||||
|                                else |                                else | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0010011_0100100_101:   BMUControlsD = `BMUCTRLW'b101_01_000_1_0_1_1_0_1_0_0;  // bexti
 |       17'b0010011_0100100_101:   BMUControlsD = `BMUCTRLW'b101_01_000_1_1_0_1_1_0_1_0_0;  // bexti
 | ||||||
|       17'b0010011_0100101_101: if (`XLEN == 64) |       17'b0010011_0100101_101: if (`XLEN == 64) | ||||||
|                                  BMUControlsD = `BMUCTRLW'b101_01_000_1_0_1_1_0_1_0_0;  // bexti (rv64)
 |                                  BMUControlsD = `BMUCTRLW'b101_01_000_1_1_0_1_1_0_1_0_0;  // bexti (rv64)
 | ||||||
|                                else |                                else | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0010011_0110100_001:   BMUControlsD = `BMUCTRLW'b100_01_000_1_0_1_0_0_1_0_0;  // binvi
 |       17'b0010011_0110100_001:   BMUControlsD = `BMUCTRLW'b100_01_000_1_1_0_1_0_0_1_0_0;  // binvi
 | ||||||
|       17'b0010011_0110101_001: if (`XLEN == 64) |       17'b0010011_0110101_001: if (`XLEN == 64) | ||||||
|                                  BMUControlsD = `BMUCTRLW'b100_01_000_1_0_1_0_0_1_0_0;  // binvi (rv64)
 |                                  BMUControlsD = `BMUCTRLW'b100_01_000_1_1_0_1_0_0_1_0_0;  // binvi (rv64)
 | ||||||
|                                else  |                                else  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0010011_0010100_001:   BMUControlsD = `BMUCTRLW'b110_01_000_1_0_1_0_0_1_0_0;  // bseti
 |       17'b0010011_0010100_001:   BMUControlsD = `BMUCTRLW'b110_01_000_1_1_0_1_0_0_1_0_0;  // bseti
 | ||||||
|       17'b0010011_0010101_001: if (`XLEN == 64)  |       17'b0010011_0010101_001: if (`XLEN == 64)  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b110_01_000_1_0_1_0_0_1_0_0;  // bseti (rv64)
 |                                  BMUControlsD = `BMUCTRLW'b110_01_000_1_1_0_1_0_0_1_0_0;  // bseti (rv64)
 | ||||||
|                                else  |                                else  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0110011_0100100_001:   BMUControlsD = `BMUCTRLW'b111_01_000_1_0_1_1_0_1_0_0;  // bclr
 |       17'b0110011_0100100_001:   BMUControlsD = `BMUCTRLW'b111_01_000_1_0_0_1_1_0_1_0_0;  // bclr
 | ||||||
|       17'b0110011_0100100_101:   BMUControlsD = `BMUCTRLW'b101_01_000_1_0_1_1_0_1_0_0;  // bext
 |       17'b0110011_0100100_101:   BMUControlsD = `BMUCTRLW'b101_01_000_1_0_0_1_1_0_1_0_0;  // bext
 | ||||||
|       17'b0110011_0110100_001:   BMUControlsD = `BMUCTRLW'b100_01_000_1_0_1_0_0_1_0_0;  // binv
 |       17'b0110011_0110100_001:   BMUControlsD = `BMUCTRLW'b100_01_000_1_0_0_1_0_0_1_0_0;  // binv
 | ||||||
|       17'b0110011_0010100_001:   BMUControlsD = `BMUCTRLW'b110_01_000_1_0_1_0_0_1_0_0;  // bset
 |       17'b0110011_0010100_001:   BMUControlsD = `BMUCTRLW'b110_01_000_1_0_0_1_0_0_1_0_0;  // bset
 | ||||||
|       17'b0?1?011_0?0000?_?01:   BMUControlsD = `BMUCTRLW'b001_00_000_1_0_1_0_0_0_0_0;  // sra, srai, srl, srli, sll, slli
 |       //17'b0?1?011_0?0000?_?01:   BMUControlsD = `BMUCTRLW'b001_00_000_1_0_0_1_0_0_0_0_0;  // sra, srai, srl, srli, sll, slli
 | ||||||
|  |       17'b0110011_0?0000?_?01:   BMUControlsD = `BMUCTRLW'b001_00_000_1_0_0_1_0_0_0_0_0;  // sra, srl, sll
 | ||||||
|  |       17'b0010011_0?0000?_?01:   BMUControlsD = `BMUCTRLW'b001_00_000_1_1_0_1_0_0_0_0_0;  // srai, srli, slli
 | ||||||
|  |       17'b0111011_0?0000?_?01:   BMUControlsD = `BMUCTRLW'b001_00_000_1_0_1_1_0_0_0_0_0;  // sraw, srlw, sllw
 | ||||||
|  |       17'b0011011_0?0000?_?01:   BMUControlsD = `BMUCTRLW'b001_00_000_1_1_1_1_0_0_0_0_0;  // sraiw, srliw, slliw
 | ||||||
|       // ZBC
 |       // ZBC
 | ||||||
|       17'b0110011_0000101_0??:   BMUControlsD = `BMUCTRLW'b000_11_000_1_0_1_0_0_0_0_0;  // ZBC instruction
 |       17'b0110011_0000101_0??:   BMUControlsD = `BMUCTRLW'b000_11_000_1_0_0_1_0_0_0_0_0;  // ZBC instruction
 | ||||||
|       // ZBA
 |       // ZBA
 | ||||||
|       17'b0110011_0010000_010:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_1_0_0_0_1_0;  // sh1add
 |       17'b0110011_0010000_010:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_0_1_0_0_0_1_0;  // sh1add
 | ||||||
|       17'b0110011_0010000_100:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_1_0_0_0_1_0;  // sh2add
 |       17'b0110011_0010000_100:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_0_1_0_0_0_1_0;  // sh2add
 | ||||||
|       17'b0110011_0010000_110:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_1_0_0_0_1_0;  // sh3add
 |       17'b0110011_0010000_110:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_0_1_0_0_0_1_0;  // sh3add
 | ||||||
|       17'b0111011_0010000_010:   BMUControlsD = `BMUCTRLW'b000_01_000_1_1_1_0_0_0_1_0;  // sh1add.uw
 |       17'b0111011_0010000_010:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_1_1_0_0_0_1_0;  // sh1add.uw
 | ||||||
|       17'b0111011_0010000_100:   BMUControlsD = `BMUCTRLW'b000_01_000_1_1_1_0_0_0_1_0;  // sh2add.uw
 |       17'b0111011_0010000_100:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_1_1_0_0_0_1_0;  // sh2add.uw
 | ||||||
|       17'b0111011_0010000_110:   BMUControlsD = `BMUCTRLW'b000_01_000_1_1_1_0_0_0_1_0;  // sh3add.uw
 |       17'b0111011_0010000_110:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_1_1_0_0_0_1_0;  // sh3add.uw
 | ||||||
|       17'b0111011_0000100_000:   BMUControlsD = `BMUCTRLW'b000_01_000_1_1_1_0_0_0_0_0;  // add.uw
 |       17'b0111011_0000100_000:   BMUControlsD = `BMUCTRLW'b000_01_000_1_0_1_1_0_0_0_0_0;  // add.uw
 | ||||||
|       17'b0011011_000010?_001:   BMUControlsD = `BMUCTRLW'b001_01_000_1_1_1_0_0_0_0_0;  // slli.uw
 |       17'b0011011_000010?_001:   BMUControlsD = `BMUCTRLW'b001_01_000_1_1_1_1_0_0_0_0_0;  // slli.uw
 | ||||||
|       // ZBB
 |       // ZBB
 | ||||||
|       17'b0110011_0110000_001:   BMUControlsD = `BMUCTRLW'b001_01_111_1_0_1_0_1_0_0_0;  // rol
 |       17'b0110011_0110000_001:   BMUControlsD = `BMUCTRLW'b001_01_111_1_0_0_1_0_1_0_0_0;  // rol
 | ||||||
|       17'b0111011_0110000_001:   BMUControlsD = `BMUCTRLW'b001_00_111_1_1_1_0_1_0_0_0;  // rolw
 |       17'b0111011_0110000_001:   BMUControlsD = `BMUCTRLW'b001_00_111_1_0_1_1_0_1_0_0_0;  // rolw
 | ||||||
|       17'b0110011_0110000_101:   BMUControlsD = `BMUCTRLW'b001_01_111_1_0_1_0_1_0_0_0;  // ror
 |       17'b0110011_0110000_101:   BMUControlsD = `BMUCTRLW'b001_01_111_1_0_0_1_0_1_0_0_0;  // ror
 | ||||||
|       17'b0111011_0110000_101:   BMUControlsD = `BMUCTRLW'b001_00_111_1_1_1_0_1_0_0_0;  // rorw
 |       17'b0111011_0110000_101:   BMUControlsD = `BMUCTRLW'b001_00_111_1_0_1_1_0_1_0_0_0;  // rorw
 | ||||||
|       17'b0010011_0110000_101:   BMUControlsD = `BMUCTRLW'b001_00_111_1_0_1_0_1_0_0_0;  // rori (rv32)
 |       17'b0010011_0110000_101:   BMUControlsD = `BMUCTRLW'b001_00_111_1_1_0_1_0_1_0_0_0;  // rori (rv32)
 | ||||||
|       17'b0010011_0110001_101: if (`XLEN == 64)  |       17'b0010011_0110001_101: if (`XLEN == 64)  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b001_00_111_1_0_1_0_1_0_0_0;  // rori (rv64)
 |                                  BMUControlsD = `BMUCTRLW'b001_00_111_1_1_0_1_0_1_0_0_0;  // rori (rv64)
 | ||||||
|                                else |                                else | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0011011_0110000_101: if (`XLEN == 64)  |       17'b0011011_0110000_101: if (`XLEN == 64)  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b001_00_111_1_1_1_0_1_0_0_0;  // roriw 
 |                                  BMUControlsD = `BMUCTRLW'b001_00_111_1_1_1_1_0_1_0_0_0;  // roriw 
 | ||||||
|                                else |                                else | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0010011_0110000_001: if (Rs2D[2]) |       17'b0010011_0110000_001: if (Rs2D[2]) | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_10_001_1_0_1_0_0_0_0_0;  // sign extend instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_10_001_1_1_0_1_0_0_0_0_0;  // sign extend instruction
 | ||||||
|                                else  |                                else  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_10_000_1_0_1_0_0_0_0_0;  // count instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_10_000_1_1_0_1_0_0_0_0_0;  // count instruction
 | ||||||
|       17'b0011011_0110000_001:   BMUControlsD = `BMUCTRLW'b000_10_000_1_1_1_0_0_0_0_0;  // count word instruction
 |       17'b0011011_0110000_001:   BMUControlsD = `BMUCTRLW'b000_10_000_1_1_1_1_0_0_0_0_0;  // count word instruction
 | ||||||
|       17'b0111011_0000100_100: if (`XLEN == 64) |       17'b0111011_0000100_100: if (`XLEN == 64) | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_10_001_1_0_1_0_0_0_0_0;  // zexth (rv64)
 |                                  BMUControlsD = `BMUCTRLW'b000_10_001_1_0_0_1_0_0_0_0_0;  // zexth (rv64)
 | ||||||
|                                else  |                                else  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0110011_0000100_100: if (`XLEN == 32) |       17'b0110011_0000100_100: if (`XLEN == 32) | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_10_001_1_0_1_0_0_0_0_0;  // zexth (rv32)
 |                                  BMUControlsD = `BMUCTRLW'b000_10_001_1_1_0_1_0_0_0_0_0;  // zexth (rv32)
 | ||||||
|                                else  |                                else  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0110011_0100000_111:   BMUControlsD = `BMUCTRLW'b111_01_111_1_0_1_1_0_0_0_0;  // andn
 |       17'b0110011_0100000_111:   BMUControlsD = `BMUCTRLW'b111_01_111_1_0_0_1_1_0_0_0_0;  // andn
 | ||||||
|       17'b0110011_0100000_110:   BMUControlsD = `BMUCTRLW'b110_01_111_1_0_1_1_0_0_0_0;  // orn
 |       17'b0110011_0100000_110:   BMUControlsD = `BMUCTRLW'b110_01_111_1_0_0_1_1_0_0_0_0;  // orn
 | ||||||
|       17'b0110011_0100000_100:   BMUControlsD = `BMUCTRLW'b100_01_111_1_0_1_1_0_0_0_0;  // xnor
 |       17'b0110011_0100000_100:   BMUControlsD = `BMUCTRLW'b100_01_111_1_0_0_1_1_0_0_0_0;  // xnor
 | ||||||
|       17'b0010011_0110101_101: if (`XLEN == 64)  |       17'b0010011_0110101_101: if (`XLEN == 64)  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_10_010_1_0_1_0_0_0_0_0;  // rev8 (rv64)
 |                                  BMUControlsD = `BMUCTRLW'b000_10_010_1_1_0_1_0_0_0_0_0;  // rev8 (rv64)
 | ||||||
|                                else  |                                else  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0010011_0110100_101: if (`XLEN == 32)  |       17'b0010011_0110100_101: if (`XLEN == 32)  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_10_010_1_0_1_0_0_0_0_0;  // rev8 (rv32)
 |                                  BMUControlsD = `BMUCTRLW'b000_10_010_1_1_0_1_0_0_0_0_0;  // rev8 (rv32)
 | ||||||
|                                else  |                                else  | ||||||
|                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_1;  // illegal instruction
 |                                  BMUControlsD = `BMUCTRLW'b000_00_000_0_0_0_0_0_0_0_0_1;  // illegal instruction
 | ||||||
|       17'b0010011_0010100_101:   BMUControlsD = `BMUCTRLW'b000_10_010_1_0_1_0_0_0_0_0;  // orc.b
 |       17'b0010011_0010100_101:   BMUControlsD = `BMUCTRLW'b000_10_010_1_1_0_1_0_0_0_0_0;  // orc.b
 | ||||||
|       17'b0110011_0000101_110:   BMUControlsD = `BMUCTRLW'b000_10_100_1_0_1_0_0_0_0_0;  // max
 |       17'b0110011_0000101_110:   BMUControlsD = `BMUCTRLW'b000_10_100_1_0_0_1_0_0_0_0_0;  // max
 | ||||||
|       17'b0110011_0000101_111:   BMUControlsD = `BMUCTRLW'b000_10_100_1_0_1_0_0_0_0_0;  // maxu
 |       17'b0110011_0000101_111:   BMUControlsD = `BMUCTRLW'b000_10_100_1_0_0_1_0_0_0_0_0;  // maxu
 | ||||||
|       17'b0110011_0000101_100:   BMUControlsD = `BMUCTRLW'b000_10_011_1_0_1_0_0_0_0_0;  // min
 |       17'b0110011_0000101_100:   BMUControlsD = `BMUCTRLW'b000_10_011_1_0_0_1_0_0_0_0_0;  // min
 | ||||||
|       17'b0110011_0000101_101:   BMUControlsD = `BMUCTRLW'b000_10_011_1_0_1_0_0_0_0_0;  // minu
 |       17'b0110011_0000101_101:   BMUControlsD = `BMUCTRLW'b000_10_011_1_0_0_1_0_0_0_0_0;  // minu
 | ||||||
|       default:                   BMUControlsD = {Funct3D, {12'b0}, {1'b1}};             // not B instruction or shift
 |       default:                   BMUControlsD = {Funct3D, {13'b0}, {1'b1}};             // not B instruction or shift
 | ||||||
|     endcase |     endcase | ||||||
| 
 | 
 | ||||||
|   // Unpack Control Signals
 |   // Unpack Control Signals
 | ||||||
|   assign {ALUSelectD,BSelectD,ZBBSelectD, BRegWriteD, BW64D, BALUOpD, BSubArithD, RotateD, MaskD, PreShiftD, IllegalBitmanipInstrD} = BMUControlsD; |   assign {ALUSelectD,BSelectD,ZBBSelectD, BRegWriteD,BALUSrcBD, BW64D, BALUOpD, BSubArithD, RotateD, MaskD, PreShiftD, IllegalBitmanipInstrD} = BMUControlsD; | ||||||
|    |    | ||||||
|   // Pack BALUControl Signals
 |   // Pack BALUControl Signals
 | ||||||
|   assign BALUControlD = {RotateD, MaskD, PreShiftD}; |   assign BALUControlD = {RotateD, MaskD, PreShiftD}; | ||||||
|  | |||||||
| @ -97,6 +97,7 @@ module controller( | |||||||
|   logic	       BaseALUOpD, BaseW64D;           // ALU operation and W64 for Base instructions specifically
 |   logic	       BaseALUOpD, BaseW64D;           // ALU operation and W64 for Base instructions specifically
 | ||||||
|   logic	       BaseRegWriteD;                  // Indicates if Base instruction register write instruction
 |   logic	       BaseRegWriteD;                  // Indicates if Base instruction register write instruction
 | ||||||
|   logic	       BaseSubArithD;                  // Indicates if Base instruction subtracts, sra, slt, sltu
 |   logic	       BaseSubArithD;                  // Indicates if Base instruction subtracts, sra, slt, sltu
 | ||||||
|  |   logic        BaseALUSrcBD;                   // Base instruction ALU B source select signal
 | ||||||
|   logic [2:0]  ALUControlD;                    // Determines ALU operation
 |   logic [2:0]  ALUControlD;                    // Determines ALU operation
 | ||||||
|   logic [2:0]  ALUSelectD;                     // ALU mux select signal
 |   logic [2:0]  ALUSelectD;                     // ALU mux select signal
 | ||||||
|   logic 	     ALUSrcAD, ALUSrcBD;             // ALU inputs
 |   logic 	     ALUSrcAD, ALUSrcBD;             // ALU inputs
 | ||||||
| @ -130,6 +131,7 @@ module controller( | |||||||
|   logic        BW64D;                          // Indicates if it is a W type B instruction in decode stage
 |   logic        BW64D;                          // Indicates if it is a W type B instruction in decode stage
 | ||||||
|   logic        BALUOpD;                        // Indicates if it is an ALU B instruction in decode stage
 |   logic        BALUOpD;                        // Indicates if it is an ALU B instruction in decode stage
 | ||||||
|   logic        BSubArithD;                     // TRUE for B-type ext, clr, andn, orn, xnor
 |   logic        BSubArithD;                     // TRUE for B-type ext, clr, andn, orn, xnor
 | ||||||
|  |   logic        BALUSrcBD;                      // B-type alu src select signal
 | ||||||
|   logic        BComparatorSignedE;             // Indicates if max, min (signed comarison) instruction in Execute Stage
 |   logic        BComparatorSignedE;             // Indicates if max, min (signed comarison) instruction in Execute Stage
 | ||||||
|   logic        IFunctD, RFunctD, MFunctD;      // Detect I, R, and M-type RV32IM/Rv64IM instructions
 |   logic        IFunctD, RFunctD, MFunctD;      // Detect I, R, and M-type RV32IM/Rv64IM instructions
 | ||||||
|   logic        LFunctD, SFunctD, BFunctD;      // Detect load, store, branch instructions
 |   logic        LFunctD, SFunctD, BFunctD;      // Detect load, store, branch instructions
 | ||||||
| @ -233,7 +235,7 @@ module controller( | |||||||
|   assign IllegalERegAdrD = `E_SUPPORTED & `ZICSR_SUPPORTED & ControlsD[`CTRLW-1] & InstrD[11];  |   assign IllegalERegAdrD = `E_SUPPORTED & `ZICSR_SUPPORTED & ControlsD[`CTRLW-1] & InstrD[11];  | ||||||
|   assign IllegalBaseInstrD = (ControlsD[0] & IllegalBitmanipInstrD) | IllegalERegAdrD ; //NOTE: Do we want to segregate the IllegalBitmanipInstrD into its own output signal
 |   assign IllegalBaseInstrD = (ControlsD[0] & IllegalBitmanipInstrD) | IllegalERegAdrD ; //NOTE: Do we want to segregate the IllegalBitmanipInstrD into its own output signal
 | ||||||
|   //assign IllegalBaseInstrD = 1'b0;
 |   //assign IllegalBaseInstrD = 1'b0;
 | ||||||
|   assign {BaseRegWriteD, ImmSrcD, ALUSrcAD, ALUSrcBD, MemRWD, |   assign {BaseRegWriteD, ImmSrcD, ALUSrcAD, BaseALUSrcBD, MemRWD, | ||||||
|           ResultSrcD, BranchD, BaseALUOpD, JumpD, ALUResultSrcD, BaseW64D, CSRReadD,  |           ResultSrcD, BranchD, BaseALUOpD, JumpD, ALUResultSrcD, BaseW64D, CSRReadD,  | ||||||
|           PrivilegedD, FenceXD, MDUD, AtomicD, unused} = IllegalIEUFPUInstrD ? `CTRLW'b0 : ControlsD; |           PrivilegedD, FenceXD, MDUD, AtomicD, unused} = IllegalIEUFPUInstrD ? `CTRLW'b0 : ControlsD; | ||||||
| 
 | 
 | ||||||
| @ -241,6 +243,7 @@ module controller( | |||||||
|   assign ALUOpD = BaseALUOpD | BALUOpD;  |   assign ALUOpD = BaseALUOpD | BALUOpD;  | ||||||
|   assign RegWriteD = BaseRegWriteD | BRegWriteD;  |   assign RegWriteD = BaseRegWriteD | BRegWriteD;  | ||||||
|   assign W64D = BaseW64D | BW64D; |   assign W64D = BaseW64D | BW64D; | ||||||
|  |   assign ALUSrcBD = BaseALUSrcBD | BALUSrcBD; | ||||||
|   assign SubArithD = BaseSubArithD | BSubArithD; // TRUE If B-type or R-type instruction involves inverted operand
 |   assign SubArithD = BaseSubArithD | BSubArithD; // TRUE If B-type or R-type instruction involves inverted operand
 | ||||||
|    |    | ||||||
| 
 | 
 | ||||||
| @ -259,7 +262,7 @@ module controller( | |||||||
| 
 | 
 | ||||||
|   // bit manipulation Configuration Block
 |   // bit manipulation Configuration Block
 | ||||||
|   if (`ZBS_SUPPORTED | `ZBA_SUPPORTED | `ZBB_SUPPORTED | `ZBC_SUPPORTED) begin: bitmanipi //change the conditional expression to OR any Z supported flags
 |   if (`ZBS_SUPPORTED | `ZBA_SUPPORTED | `ZBB_SUPPORTED | `ZBC_SUPPORTED) begin: bitmanipi //change the conditional expression to OR any Z supported flags
 | ||||||
|     bmuctrl bmuctrl(.clk, .reset, .StallD, .FlushD, .InstrD, .ALUSelectD, .BSelectD, .ZBBSelectD, .BRegWriteD, .BW64D, .BALUOpD, .BSubArithD, .IllegalBitmanipInstrD, .StallE, .FlushE, .ALUSelectE, .BSelectE, .ZBBSelectE, .BRegWriteE, .BComparatorSignedE, .BALUControlE); |     bmuctrl bmuctrl(.clk, .reset, .StallD, .FlushD, .InstrD, .ALUSelectD, .BSelectD, .ZBBSelectD, .BRegWriteD, .BALUSrcBD, .BW64D, .BALUOpD, .BSubArithD, .IllegalBitmanipInstrD, .StallE, .FlushE, .ALUSelectE, .BSelectE, .ZBBSelectE, .BRegWriteE, .BComparatorSignedE, .BALUControlE); | ||||||
|     if (`ZBA_SUPPORTED) begin |     if (`ZBA_SUPPORTED) begin | ||||||
|       // ALU Decoding is more comprehensive when ZBA is supported. slt and slti conflicts with sh1add, sh1add.uw
 |       // ALU Decoding is more comprehensive when ZBA is supported. slt and slti conflicts with sh1add, sh1add.uw
 | ||||||
|       assign sltD = (Funct3D == 3'b010 & (~(Funct7D[4]) | ~OpD[5])) ; |       assign sltD = (Funct3D == 3'b010 & (~(Funct7D[4]) | ~OpD[5])) ; | ||||||
| @ -279,6 +282,7 @@ module controller( | |||||||
|     assign BSubArithD = 1'b0; |     assign BSubArithD = 1'b0; | ||||||
|     assign BComparatorSignedE = 1'b0; |     assign BComparatorSignedE = 1'b0; | ||||||
|     assign BALUControlE = 3'b0; |     assign BALUControlE = 3'b0; | ||||||
|  |     assign BALUSrcBD = 1'b0; | ||||||
| 
 | 
 | ||||||
|     assign sltD = (Funct3D == 3'b010); |     assign sltD = (Funct3D == 3'b010); | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user