Line 57... |
Line 57... |
wire [15:0] bcdmo;
|
wire [15:0] bcdmo;
|
wire [DBW-1:0] bf_out;
|
wire [DBW-1:0] bf_out;
|
wire [DBW-1:0] shfto;
|
wire [DBW-1:0] shfto;
|
wire alu_mult_done,alu_div_done;
|
wire alu_mult_done,alu_div_done;
|
wire [DBW-1:0] p_out;
|
wire [DBW-1:0] p_out;
|
|
reg [3:0] o1;
|
|
|
integer n;
|
integer n;
|
|
|
Thor_multiplier #(DBW) umult1
|
Thor_multiplier #(DBW) umult1
|
(
|
(
|
Line 182... |
Line 183... |
wire snanA = alu_argA[30:23]==8'hFF && (alu_argA[22:0]!=23'd0);
|
wire snanA = alu_argA[30:23]==8'hFF && (alu_argA[22:0]!=23'd0);
|
wire snanB = alu_argB[30:23]==8'hFF && (alu_argB[22:0]!=23'd0);
|
wire snanB = alu_argB[30:23]==8'hFF && (alu_argB[22:0]!=23'd0);
|
|
|
always @*
|
always @*
|
begin
|
begin
|
casex(alu_op)
|
case(alu_op)
|
`LDI,`LDIS: o <= alu_argI;
|
`LDI,`LDIS: o <= alu_argI;
|
`RR:
|
`RR:
|
case(alu_fn)
|
case(alu_fn)
|
`ADD,`ADDU: o <= alu_argA + alu_argB;
|
`ADD,`ADDU: o <= alu_argA + alu_argB;
|
`SUB,`SUBU: o <= alu_argA - alu_argB;
|
`SUB,`SUBU: o <= alu_argA - alu_argB;
|
Line 296... |
Line 297... |
`ENOR: o <= ~(alu_argA ^ alu_argB);
|
`ENOR: o <= ~(alu_argA ^ alu_argB);
|
default: o <= 64'd0;
|
default: o <= 64'd0;
|
endcase
|
endcase
|
`BITI:
|
`BITI:
|
begin
|
begin
|
o[0] <= andi_res==64'd0;
|
o1[0] = andi_res==64'd0;
|
o[1] <= andi_res[DBW-1];
|
o1[1] = andi_res[DBW-1];
|
o[2] <= andi_res[0];
|
o1[2] = andi_res[0];
|
o[3] <= 1'b0;
|
o1[3] = 1'b0;
|
o[DBW-1:4] <= 60'd0;
|
o <= {16{o1}};
|
end
|
end
|
`TST:
|
// TST
|
|
8'h00,8'h01,8'h02,8'h03,8'h04,8'h05,8'h06,8'h07,8'h08,8'h09,8'h0A,8'h0B,8'h0C,8'h0D,8'h0E,8'h0f:
|
case(alu_fn)
|
case(alu_fn)
|
6'd0: // TST - integer
|
6'd0: // TST - integer
|
begin
|
begin
|
o[0] <= alu_argA == 64'd0;
|
o1[0] = alu_argA == 64'd0;
|
o[1] <= alu_argA[DBW-1];
|
o1[1] = alu_argA[DBW-1];
|
o[2] <= 1'b0;
|
o1[2] = 1'b0;
|
o[3] <= 1'b0;
|
o1[3] = 1'b0;
|
o[DBW-1:4] <= 60'd0;
|
o <= {16{o1}};
|
end
|
end
|
`ifdef FLOATING_POINT
|
`ifdef FLOATING_POINT
|
6'd1: // FSTST - float single
|
6'd1: // FSTST - float single
|
begin
|
begin
|
o[0] <= alu_argA[30:0]==31'd0; // + or - zero
|
o1[0] = alu_argA[30:0]==31'd0; // + or - zero
|
o[1] <= alu_argA[31]; // signed less than
|
o1[1] = alu_argA[31]; // signed less than
|
o[2] <= alu_argA[31];
|
o1[2] = alu_argA[31];
|
// unordered
|
// unordered
|
o[3] <= alu_argA[30:23]==8'hFF && alu_argA[22:0]!=23'd0; // NaN
|
o1[3] = alu_argA[30:23]==8'hFF && alu_argA[22:0]!=23'd0; // NaN
|
o[DBW-1:4] <= 60'd0;
|
o <= {16{o1}};
|
end
|
end
|
6'd2: // FTST - float double
|
6'd2: // FTST - float double
|
begin
|
begin
|
o[0] <= alu_argA[DBW-2:0]==63'd0; // + or - zero
|
o1[0] = alu_argA[DBW-2:0]==63'd0; // + or - zero
|
o[1] <= alu_argA[DBW-1]; // signed less than
|
o1[1] = alu_argA[DBW-1]; // signed less than
|
o[2] <= alu_argA[DBW-1];
|
o1[2] = alu_argA[DBW-1];
|
// unordered
|
// unordered
|
if (DBW==64)
|
if (DBW==64)
|
o[3] <= alu_argA[62:52]==11'h7FF && alu_argA[51:0]!=52'd0; // NaN
|
o1[3] = alu_argA[62:52]==11'h7FF && alu_argA[51:0]!=52'd0; // NaN
|
else
|
else
|
o[3] <= 1'b0;
|
o1[3] = 1'b0;
|
o[DBW-1:4] <= 60'd0;
|
o <= {16{o1}};
|
end
|
end
|
`endif
|
`endif
|
default: o <= 64'd0;
|
default: o <= 64'd0;
|
endcase
|
endcase
|
`CMP: begin
|
// CMP
|
|
8'h10,8'h11,8'h12,8'h13,8'h14,8'h15,8'h16,8'h17,8'h18,8'h19,8'h1A,8'h1B,8'h1C,8'h1D,8'h1E,8'h1f:
|
|
begin
|
case(alu_fn)
|
case(alu_fn)
|
2'd0: begin // ICMP
|
2'd0: begin // ICMP
|
o[0] <= alu_argA == alu_argB;
|
o1[0] = alu_argA == alu_argB;
|
o[1] <= alu_argAs < alu_argBs;
|
o1[1] = alu_argAs < alu_argBs;
|
o[2] <= alu_argA < alu_argB;
|
o1[2] = alu_argA < alu_argB;
|
o[3] <= 1'b0;
|
o1[3] = 1'b0;
|
o[DBW-1:4] <= 60'd0;
|
o <= {16{o1}};
|
end
|
end
|
`ifdef FLOATING_POINT
|
`ifdef FLOATING_POINT
|
2'd1: begin // FSCMP
|
2'd1: begin // FSCMP
|
o[0] <= fseq;
|
o1[0] = fseq;
|
o[1] <= fslt;
|
o1[1] = fslt;
|
o[2] <= fslt1;
|
o1[2] = fslt1;
|
o[3] <= snanA | snanB;
|
o1[3] = snanA | snanB;
|
o[DBW-1:4] <= 60'd0;
|
o <= {16{o1}};
|
end
|
end
|
2'd2: begin // FCMP
|
2'd2: begin // FCMP
|
o[0] <= feq;
|
o1[0] = feq;
|
o[1] <= flt;
|
o1[1] = flt;
|
o[2] <= flt1;
|
o1[2] = flt1;
|
o[3] <= nanA | nanB;
|
o1[3] = nanA | nanB;
|
o[DBW-1:4] <= 60'd0;
|
o <= {16{o1}};
|
end
|
end
|
`endif
|
`endif
|
default: o <= 64'hDEADDEADDEADDEAD;
|
default: o <= 64'hDEADDEADDEADDEAD;
|
endcase
|
endcase
|
end
|
end
|
`CMPI: begin
|
// CMPI
|
o[0] <= alu_argA == alu_argI;
|
8'h20,8'h21,8'h22,8'h23,8'h24,8'h25,8'h26,8'h27,8'h28,8'h29,8'h2A,8'h2B,8'h2C,8'h2D,8'h2E,8'h2f:
|
o[1] <= alu_argAs < alu_argIs;
|
begin
|
o[2] <= alu_argA < alu_argI;
|
o1[0] = alu_argA == alu_argI;
|
o[3] <= 1'b0;
|
o1[1] = alu_argAs < alu_argIs;
|
o[DBW-1:4] <= 64'd0;
|
o1[2] = alu_argA < alu_argI;
|
|
o1[3] = 1'b0;
|
|
o <= {16{o1}};
|
end
|
end
|
`LB,`LBU,`LC,`LCU,`LH,`LHU,`LW,`SB,`SC,`SH,`SW,`CAS,`LVB,`LVC,`LVH,`LVH,`STI,
|
`LB,`LBU,`LC,`LCU,`LH,`LHU,`LW,`SB,`SC,`SH,`SW,`CAS,`LVB,`LVC,`LVH,`LVH,`STI,
|
`LWS,`SWS,`LEA,`RTS2,`STS,`STFND,`STCMP:
|
`LWS,`SWS,`LEA,`RTS2,`STS,`STFND,`STCMP:
|
begin
|
begin
|
o <= alu_argA + alu_argC + alu_argI;
|
o <= alu_argA + alu_argC + alu_argI;
|