Line 87... |
Line 87... |
input [3:0]FLAGOP,
|
input [3:0]FLAGOP,
|
input WORD,
|
input WORD,
|
input INC2,
|
input INC2,
|
output reg [15:0]FOUT,
|
output reg [15:0]FOUT,
|
output reg [15:0]ALUOUT,
|
output reg [15:0]ALUOUT,
|
|
output [15:0]ALUOUTA,
|
output reg ALUCONT,
|
output reg ALUCONT,
|
output NULLSHIFT,
|
output NULLSHIFT,
|
output COUT,
|
output COUT,
|
input [2:0]STAGE,
|
input [2:0]STAGE,
|
input CLK
|
input CLK
|
Line 117... |
Line 118... |
// ADDER
|
// ADDER
|
assign {AF, SUMOUT[3:0]} = SUMOP1[3:0] + SUMOP2[3:0] + SCIN;
|
assign {AF, SUMOUT[3:0]} = SUMOP1[3:0] + SUMOP2[3:0] + SCIN;
|
assign {SC8OUT, SUMOUT[7:4]} = SUMOP1[7:4] + SUMOP2[7:4] + AF;
|
assign {SC8OUT, SUMOUT[7:4]} = SUMOP1[7:4] + SUMOP2[7:4] + AF;
|
assign {SC16OUT, SUMOUT[15:8]} = SUMOP1[15:8] + SUMOP2[15:8] + SC8OUT;
|
assign {SC16OUT, SUMOUT[15:8]} = SUMOP1[15:8] + SUMOP2[15:8] + SC8OUT;
|
assign COUT = (WORD ? SC16OUT : SC8OUT) ^ CPLOP2;
|
assign COUT = (WORD ? SC16OUT : SC8OUT) ^ CPLOP2;
|
|
assign ALUOUTA = ALUOP == 5'b11111 ? RB : SUMOUT;
|
|
|
// SHIFTER
|
// SHIFTER
|
reg [4:0]SHNOPT; // optimized shift
|
reg [4:0]SHNOPT; // optimized shift
|
wire [4:0]SHN = {STAGE[2:1] ^ SHNOPT[4:3], SHNOPT[2:0]};
|
wire [4:0]SHN = {STAGE[2:1] ^ SHNOPT[4:3], SHNOPT[2:0]};
|
assign NULLSHIFT = ~|SHNOPT;
|
assign NULLSHIFT = ~|SHNOPT;
|
Line 289... |
Line 291... |
// 1010 - BX+AL
|
// 1010 - BX+AL
|
// 1011 - TMP16+2
|
// 1011 - TMP16+2
|
// 1100 -
|
// 1100 -
|
// 1101 - SP+2+DISP
|
// 1101 - SP+2+DISP
|
// 1110 - DISP[7:0]<<2
|
// 1110 - DISP[7:0]<<2
|
// 1111 - PIO
|
// 1111 -
|
module Next186_EA(
|
module Next186_EA(
|
input [15:0] SP,
|
input [15:0] SP,
|
input [15:0] BX,
|
input [15:0] BX,
|
input [15:0] BP,
|
input [15:0] BP,
|
input [15:0] SI,
|
input [15:0] SI,
|
input [15:0] DI,
|
input [15:0] DI,
|
input [15:0] PIO,
|
|
input [15:0] TMP16,
|
input [15:0] TMP16,
|
input [7:0] AL,
|
input [7:0] AL,
|
input [15:0] AIMM,
|
input [15:0] AIMM,
|
input [3:0]EAC,
|
input [3:0]EAC,
|
output [15:0] ADDR16
|
output [15:0] ADDR16
|
Line 327... |
Line 328... |
case(EAC)
|
case(EAC)
|
4'b1000: OP3 = 16'hfffe; // SP - 2
|
4'b1000: OP3 = 16'hfffe; // SP - 2
|
4'b1010: OP3 = {8'b00000000, AL}; // XLAT
|
4'b1010: OP3 = {8'b00000000, AL}; // XLAT
|
4'b1001, 4'b1011: OP3 = 16'h0000; // SP/TMP16 + 2
|
4'b1001, 4'b1011: OP3 = 16'h0000; // SP/TMP16 + 2
|
4'b1110: OP3 = {6'b000000, AIMM[7:0], 2'b00}; // int
|
4'b1110: OP3 = {6'b000000, AIMM[7:0], 2'b00}; // int
|
4'b1111: OP3 = PIO; // in,out
|
|
default: OP3 = AIMM;
|
default: OP3 = AIMM;
|
endcase
|
endcase
|
end
|
end
|
|
|
assign ADDR16 = OP1 + OP2 + OP3;
|
assign ADDR16 = OP1 + OP2 + OP3;
|