Line 2... |
Line 2... |
//
|
//
|
// This file is part of the M32632 project
|
// This file is part of the M32632 project
|
// http://opencores.org/project,m32632
|
// http://opencores.org/project,m32632
|
//
|
//
|
// Filename: I_PFAD.v
|
// Filename: I_PFAD.v
|
// Version: 1.2 bug fix
|
// Version: 2.0
|
// Version: 1.1 bug fix release of 7 November 2015
|
// History: 1.1 bug fix of 7 November 2015
|
// History: 1.0 first release of 30 Mai 2015
|
// 1.0 first release of 30 Mai 2015
|
// Date: 4 February 2016
|
// Date: 14 August 2016
|
//
|
//
|
// Copyright (C) 2016 Udo Moeller
|
// Copyright (C) 2016 Udo Moeller
|
//
|
//
|
// This source file may be used and distributed without
|
// This source file may be used and distributed without
|
// restriction provided that this copyright statement is not
|
// restriction provided that this copyright statement is not
|
Line 120... |
Line 120... |
input [1:0] BWD;
|
input [1:0] BWD;
|
input FLOAT;
|
input FLOAT;
|
input [31:0] SRC1,SRC2;
|
input [31:0] SRC1,SRC2;
|
output [31:0] DEST1,DEST2;
|
output [31:0] DEST1,DEST2;
|
|
|
wire sign1,sign2;
|
|
reg [31:0] DEST1,DEST2;
|
reg [31:0] DEST1,DEST2;
|
|
|
assign sign1 = BWD[0] ? SRC1[15] : SRC1[7];
|
always @(FLOAT or BWD or SRC1)
|
|
casex ({FLOAT,BWD})
|
always @(FLOAT or BWD or SRC1 or sign1)
|
3'b0_00 : DEST1 = {{24{SRC1[7]}}, SRC1[7:0]};
|
casex ({FLOAT,BWD,sign1})
|
3'b0_01 : DEST1 = {{16{SRC1[15]}},SRC1[15:0]};
|
4'b0_00_0 : DEST1 = {24'h000000, SRC1[7:0]};
|
3'b1_xx : DEST1 = { 9'h001,SRC1[22:0]};
|
4'b0_00_1 : DEST1 = {24'hFFFFFF, SRC1[7:0]};
|
|
4'b0_01_0 : DEST1 = { 16'h0000,SRC1[15:0]};
|
|
4'b0_01_1 : DEST1 = { 16'hFFFF,SRC1[15:0]};
|
|
4'b1_xx_x : DEST1 = { 9'h001,SRC1[22:0]};
|
|
default : DEST1 = SRC1;
|
default : DEST1 = SRC1;
|
endcase
|
endcase
|
|
|
assign sign2 = BWD[0] ? SRC2[15] : SRC2[7];
|
always @(FLOAT or BWD or SRC2)
|
|
casex ({FLOAT,BWD})
|
always @(FLOAT or BWD or SRC2 or sign2)
|
3'b0_00 : DEST2 = {{24{SRC2[7]}}, SRC2[7:0]};
|
casex ({FLOAT,BWD,sign2})
|
3'b0_01 : DEST2 = {{16{SRC2[15]}},SRC2[15:0]};
|
4'b0_00_0 : DEST2 = {24'h000000, SRC2[7:0]};
|
3'b1_xx : DEST2 = { 9'h001,SRC2[22:0]};
|
4'b0_00_1 : DEST2 = {24'hFFFFFF, SRC2[7:0]};
|
|
4'b0_01_0 : DEST2 = { 16'h0000,SRC2[15:0]};
|
|
4'b0_01_1 : DEST2 = { 16'hFFFF,SRC2[15:0]};
|
|
4'b1_xx_x : DEST2 = { 9'h001,SRC2[22:0]};
|
|
default : DEST2 = SRC2;
|
default : DEST2 = SRC2;
|
endcase
|
endcase
|
|
|
endmodule
|
endmodule
|
|
|
Line 258... |
Line 249... |
|
|
wire [7:0] byte_0,byte_3;
|
wire [7:0] byte_0,byte_3;
|
wire [15:0] mdat_0;
|
wire [15:0] mdat_0;
|
wire [7:0] mdat_1;
|
wire [7:0] mdat_1;
|
wire [3:0] mdat_2;
|
wire [3:0] mdat_2;
|
wire [1:0] mdat_3;
|
|
wire [4:0] obits;
|
wire [4:0] obits;
|
|
|
always @(*)
|
always @(*)
|
case (SRC2[2:0])
|
case (SRC2[2:0])
|
3'd0 : maske = 7'h7F;
|
3'd0 : maske = 7'h7F;
|
Line 300... |
Line 290... |
assign mdat_1 = obits[3] ? mdat_0[15:8] : mdat_0[7:0];
|
assign mdat_1 = obits[3] ? mdat_0[15:8] : mdat_0[7:0];
|
|
|
assign obits[2] = (mdat_1[3:0] == 4'h0);
|
assign obits[2] = (mdat_1[3:0] == 4'h0);
|
assign mdat_2 = obits[2] ? mdat_1[7:4] : mdat_1[3:0];
|
assign mdat_2 = obits[2] ? mdat_1[7:4] : mdat_1[3:0];
|
|
|
assign obits[1] = (mdat_2[1:0] == 2'b0);
|
assign obits[1] = (mdat_2[1:0] == 2'b00);
|
assign mdat_3 = obits[1] ? mdat_2[3:2] : mdat_2[1:0];
|
assign obits[0] = ~((mdat_2[2:1] == 2'b10) | mdat_2[0]);
|
|
|
assign obits[0] = ~mdat_3[0];
|
|
|
|
always @(BWD or obits or mdat_3)
|
always @(BWD or obits or mdat_2)
|
casex ({BWD,obits[4:3]})
|
casex ({BWD,obits[4:3]})
|
4'b00_x1 : FLAG = 1; // Byte Overflow => nothing found
|
4'b00_x1 : FLAG = 1; // Byte Overflow => nothing found
|
4'b00_10 : FLAG = 1; // Byte Overflow => nothing found
|
4'b00_10 : FLAG = 1; // Byte Overflow => nothing found
|
4'b01_1x : FLAG = 1; // Word Overflow => nothing found
|
4'b01_1x : FLAG = 1; // Word Overflow => nothing found
|
default : FLAG = (mdat_3 == 2'b00);
|
default : FLAG = (mdat_2 == 4'b0000);
|
endcase
|
endcase
|
|
|
assign DOUT = FLAG ? 5'h0 : obits;
|
assign DOUT = FLAG ? 5'h0 : obits;
|
|
|
endmodule
|
endmodule
|
Line 704... |
Line 692... |
|
|
// Byte for external Bit source, Double for Register
|
// Byte for external Bit source, Double for Register
|
assign selbits = (bit_reg | eis_op | exin_op) ? (exin_op ? disp_reg : SRC1[4:0]) : {2'b00,BITSEL};
|
assign selbits = (bit_reg | eis_op | exin_op) ? (exin_op ? disp_reg : SRC1[4:0]) : {2'b00,BITSEL};
|
|
|
assign shval_ei = inss_op ? {2'b00,offs_reg} : (bit_reg ? SRC1[4:0] : {2'b00,SRC1[2:0]});
|
assign shval_ei = inss_op ? {2'b00,offs_reg} : (bit_reg ? SRC1[4:0] : {2'b00,SRC1[2:0]});
|
assign sh_exin[4:0] = extract ? (5'd0 - shval_ei) : shval_ei; // EXT : right shift, INS : left shift
|
assign sh_exin[4:0] = ({5{extract}} ^ shval_ei) + {4'd0,extract}; // EXT : right shift, INS : left shift
|
assign sh_exin[7:5] = (shval_ei == 5'd0) ? 3'b000 : {3{extract}}; // Special case : 0 has no negativ sign !
|
assign sh_exin[7:5] = (shval_ei == 5'd0) ? 3'b000 : {3{extract}}; // Special case : 0 has no negativ sign !
|
|
|
// LSH shift by 16 bit to right
|
// LSH shift by 16 bit to right
|
assign sh_count = (OPCODE[3:0] == 4'h4) ? 8'hF0 : (exin_op2 ? sh_exin : SRC1[7:0]);
|
assign sh_count = (OPCODE[3:0] == 4'h4) ? 8'hF0 : (exin_op2 ? sh_exin : SRC1[7:0]);
|
|
|
Line 732... |
Line 720... |
4'b1000 : pfad_6 = addsub_q; // NEG
|
4'b1000 : pfad_6 = addsub_q; // NEG
|
4'b1001 : pfad_6 = {SRC1[31:1],~SRC1[0]}; // NOT
|
4'b1001 : pfad_6 = {SRC1[31:1],~SRC1[0]}; // NOT
|
4'b1010 : pfad_6 = SRC1; // Special case 6A : not used normal -> op_lmr !
|
4'b1010 : pfad_6 = SRC1; // Special case 6A : not used normal -> op_lmr !
|
4'b1100 : pfad_6 = bwd_daten1[31] ? addsub_q : SRC1; // ABS
|
4'b1100 : pfad_6 = bwd_daten1[31] ? addsub_q : SRC1; // ABS
|
4'b1101 : pfad_6 = ~SRC1; // COM
|
4'b1101 : pfad_6 = ~SRC1; // COM
|
4'b1110 : pfad_6 = SRC2 ^ BMASKE; // IBIT
|
4'b111x : pfad_6 = SRC2 ^ BMASKE; // IBIT
|
4'b1x11_: pfad_6 = DP_OUT; // ADDP + SUBP
|
|
default : pfad_6 = shdat; // Result of Barrelshifter
|
default : pfad_6 = shdat; // Result of Barrelshifter
|
endcase
|
endcase
|
|
|
// ++++++++++++++ Format 7 : MUL +++++++++++++++++++++++
|
// ++++++++++++++ Format 7 : MUL +++++++++++++++++++++++
|
|
|