Line 42... |
Line 42... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.9 2002/09/07 19:16:10 lampret
|
|
// If SR[CY] implemented with OR1200_IMPL_ADDC enabled, l.add/l.addi also set SR[CY].
|
|
//
|
// Revision 1.8 2002/09/07 05:42:02 lampret
|
// Revision 1.8 2002/09/07 05:42:02 lampret
|
// Added optional SR[CY]. Added define to enable additional (compare) flag modifiers. Defines are OR1200_IMPL_ADDC and OR1200_ADDITIONAL_FLAG_MODIFIERS.
|
// Added optional SR[CY]. Added define to enable additional (compare) flag modifiers. Defines are OR1200_IMPL_ADDC and OR1200_ADDITIONAL_FLAG_MODIFIERS.
|
//
|
//
|
// Revision 1.7 2002/09/03 22:28:21 lampret
|
// Revision 1.7 2002/09/03 22:28:21 lampret
|
// As per Taylor Su suggestion all case blocks are full case by default and optionally (OR1200_CASE_DEFAULT) can be disabled to increase clock frequncy.
|
// As per Taylor Su suggestion all case blocks are full case by default and optionally (OR1200_CASE_DEFAULT) can be disabled to increase clock frequncy.
|
Line 129... |
Line 132... |
reg [width-1:0] shifted_rotated;
|
reg [width-1:0] shifted_rotated;
|
reg flagforw;
|
reg flagforw;
|
reg flagcomp;
|
reg flagcomp;
|
reg flag_we;
|
reg flag_we;
|
reg cy_we;
|
reg cy_we;
|
// synopsys translate_off
|
|
`ifdef OR1200_SIM_ALU_DIV
|
|
integer d1;
|
|
integer d2;
|
|
`endif
|
|
// synopsys translate_on
|
|
wire [width-1:0] comp_a;
|
wire [width-1:0] comp_a;
|
wire [width-1:0] comp_b;
|
wire [width-1:0] comp_b;
|
`ifdef OR1200_IMPL_ALU_COMP1
|
`ifdef OR1200_IMPL_ALU_COMP1
|
wire a_eq_b;
|
wire a_eq_b;
|
wire a_lt_b;
|
wire a_lt_b;
|
Line 217... |
Line 214... |
end
|
end
|
else begin
|
else begin
|
result = b << 16;
|
result = b << 16;
|
end
|
end
|
end
|
end
|
|
`ifdef OR1200_IMPL_DIV
|
|
`OR1200_ALUOP_DIV,
|
|
`OR1200_ALUOP_DIVU,
|
|
`endif
|
`OR1200_ALUOP_MUL : begin
|
`OR1200_ALUOP_MUL : begin
|
result = mult_mac_result;
|
result = mult_mac_result;
|
`ifdef OR1200_VERBOSE
|
|
// synopsys translate_off
|
|
$display("%t: MUL operation: %h * %h = %h", $time, a, b, mult_mac_result);
|
|
// synopsys translate_on
|
|
`endif
|
|
end
|
|
// synopsys translate_off
|
|
`ifdef OR1200_SIM_ALU_DIV
|
|
`OR1200_ALUOP_DIV : begin
|
|
d1 = a;
|
|
d2 = b;
|
|
$display("DIV operation: %d / %d = %d", d1, d2, d1/d2);
|
|
if (d2)
|
|
result = d1 / d2;
|
|
else
|
|
result = 32'h00000000;
|
|
end
|
|
`endif
|
|
`ifdef OR1200_SIM_ALU_DIVU
|
|
`OR1200_ALUOP_DIVU : begin
|
|
if (b)
|
|
result = a / b;
|
|
else
|
|
result = 32'h00000000;
|
|
end
|
end
|
`endif
|
|
// synopsys translate_on
|
|
`ifdef OR1200_CASE_DEFAULT
|
`ifdef OR1200_CASE_DEFAULT
|
default: begin
|
default: begin
|
`else
|
`else
|
`OR1200_ALUOP_COMP, `OR1200_ALUOP_AND
|
`OR1200_ALUOP_COMP, `OR1200_ALUOP_AND
|
`endif
|
`endif
|
Line 291... |
Line 266... |
end
|
end
|
|
|
//
|
//
|
// Generate SR[CY] write enable
|
// Generate SR[CY] write enable
|
//
|
//
|
always @(alu_op or cy_sum or cy_csum) begin
|
always @(alu_op or cy_sum
|
|
`ifdef OR1200_IMPL_ADDC
|
|
or cy_csum
|
|
`endif
|
|
) begin
|
casex (alu_op) // synopsys parallel_case
|
casex (alu_op) // synopsys parallel_case
|
`ifdef OR1200_IMPL_ADDC
|
`ifdef OR1200_IMPL_ADDC
|
`OR1200_ALUOP_ADD : begin
|
`OR1200_ALUOP_ADD : begin
|
cyforw = cy_sum;
|
cyforw = cy_sum;
|
cy_we = 1'b1;
|
cy_we = 1'b1;
|