Line 42... |
Line 42... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// 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.
|
|
//
|
// 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.
|
//
|
//
|
// Revision 1.6 2002/03/29 16:40:10 lampret
|
// Revision 1.6 2002/03/29 16:40:10 lampret
|
// Added a directive to ignore signed division variables that are only used in simulation.
|
// Added a directive to ignore signed division variables that are only used in simulation.
|
Line 141... |
Line 144... |
wire a_lt_b;
|
wire a_lt_b;
|
`endif
|
`endif
|
wire [width-1:0] result_sum;
|
wire [width-1:0] result_sum;
|
`ifdef OR1200_IMPL_ADDC
|
`ifdef OR1200_IMPL_ADDC
|
wire [width-1:0] result_csum;
|
wire [width-1:0] result_csum;
|
|
wire cy_csum;
|
`endif
|
`endif
|
wire [width-1:0] result_and;
|
wire [width-1:0] result_and;
|
wire cyforw;
|
wire cy_sum;
|
|
reg cyforw;
|
|
|
//
|
//
|
// Combinatorial logic
|
// Combinatorial logic
|
//
|
//
|
assign comp_a = {a[width-1] ^ comp_op[3] , a[width-2:0]};
|
assign comp_a = {a[width-1] ^ comp_op[3] , a[width-2:0]};
|
assign comp_b = {b[width-1] ^ comp_op[3] , b[width-2:0]};
|
assign comp_b = {b[width-1] ^ comp_op[3] , b[width-2:0]};
|
`ifdef OR1200_IMPL_ALU_COMP1
|
`ifdef OR1200_IMPL_ALU_COMP1
|
assign a_eq_b = (comp_a == comp_b);
|
assign a_eq_b = (comp_a == comp_b);
|
assign a_lt_b = (comp_a < comp_b);
|
assign a_lt_b = (comp_a < comp_b);
|
`endif
|
`endif
|
assign {cyforw, result_sum} = a + b;
|
assign {cy_sum, result_sum} = a + b;
|
`ifdef OR1200_IMPL_ADDC
|
`ifdef OR1200_IMPL_ADDC
|
assign {cyforw, result_csum} = a + b + carry;
|
assign {cy_csum, result_csum} = a + b + carry;
|
`endif
|
`endif
|
assign result_and = a & b;
|
assign result_and = a & b;
|
|
|
//
|
//
|
// Simulation check for bad ALU behavior
|
// Simulation check for bad ALU behavior
|
Line 286... |
Line 291... |
end
|
end
|
|
|
//
|
//
|
// Generate SR[CY] write enable
|
// Generate SR[CY] write enable
|
//
|
//
|
always @(alu_op) begin
|
always @(alu_op or cy_sum or cy_csum) 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
|
|
cyforw = cy_sum;
|
|
cy_we = 1'b1;
|
|
end
|
`OR1200_ALUOP_ADDC : begin
|
`OR1200_ALUOP_ADDC : begin
|
|
cyforw = cy_csum;
|
cy_we = 1'b1;
|
cy_we = 1'b1;
|
end
|
end
|
`endif
|
`endif
|
default: begin
|
default: begin
|
|
cyforw = 1'b0;
|
cy_we = 1'b0;
|
cy_we = 1'b0;
|
end
|
end
|
endcase
|
endcase
|
end
|
end
|
|
|