Line 30... |
Line 30... |
module aeMB2_dwbif (/*AUTOARG*/
|
module aeMB2_dwbif (/*AUTOARG*/
|
// Outputs
|
// Outputs
|
dwb_adr_o, dwb_sel_o, dwb_stb_o, dwb_cyc_o, dwb_tag_o, dwb_wre_o,
|
dwb_adr_o, dwb_sel_o, dwb_stb_o, dwb_cyc_o, dwb_tag_o, dwb_wre_o,
|
dwb_dat_o, dwb_fb, sel_mx, dwb_mx, exc_dwb,
|
dwb_dat_o, dwb_fb, sel_mx, dwb_mx, exc_dwb,
|
// Inputs
|
// Inputs
|
dwb_dat_i, dwb_ack_i, dwb_err_i, imm_of, opd_of, opc_of, opa_of,
|
dwb_dat_i, dwb_ack_i, imm_of, opd_of, opc_of, opa_of,
|
opb_of, msr_ex, mem_ex, sfr_mx, gclk, grst, dena, gpha
|
opb_of, msr_ex, mem_ex, sfr_mx, gclk, grst, dena, gpha
|
);
|
);
|
parameter AEMB_DWB = 32; ///< data bus address width
|
parameter AEMB_DWB = 32; ///< data bus address width
|
|
|
// DWB control signals
|
// DWB control signals
|
Line 45... |
Line 45... |
dwb_tag_o, // cache enable
|
dwb_tag_o, // cache enable
|
dwb_wre_o;
|
dwb_wre_o;
|
output [31:0] dwb_dat_o;
|
output [31:0] dwb_dat_o;
|
input [31:0] dwb_dat_i;
|
input [31:0] dwb_dat_i;
|
input dwb_ack_i;
|
input dwb_ack_i;
|
input dwb_err_i; // for bus error exception
|
//input dwb_err_i; // for bus error exception
|
|
|
// INTERNAL
|
// INTERNAL
|
output dwb_fb;
|
output dwb_fb;
|
output [3:0] sel_mx;
|
output [3:0] sel_mx;
|
output [31:0] dwb_mx;
|
output [31:0] dwb_mx;
|
Line 82... |
Line 82... |
wire [1:0] wOFF = (opa_of[1:0] + opb_of[1:0]); // small adder
|
wire [1:0] wOFF = (opa_of[1:0] + opb_of[1:0]); // small adder
|
wire [3:0] wSEL = {opc_of[1:0], wOFF}; // byte selector info
|
wire [3:0] wSEL = {opc_of[1:0], wOFF}; // byte selector info
|
|
|
assign dwb_fb = (dwb_stb_o ~^ dwb_ack_i); // feedback
|
assign dwb_fb = (dwb_stb_o ~^ dwb_ack_i); // feedback
|
assign dwb_adr_o = mem_ex; // data-bus passthru
|
assign dwb_adr_o = mem_ex; // data-bus passthru
|
assign exc_dwb = {dwb_exc, dwb_err_i}; // exception signal
|
|
|
// TODO: enable dwb_err_i exception pass-thru
|
|
assign exc_dwb = {dwb_exc, 1'b0};
|
|
|
// STORE SIZER
|
// STORE SIZER
|
// TODO: Move the right words to the right place
|
// TODO: Move the right words to the right place
|
// TODO: Make this work with dwb_mx to for partial word loads.
|
// TODO: Make this work with dwb_mx to for partial word loads.
|
|
|
Line 151... |
Line 153... |
// TODO: ILLEGAL
|
// TODO: ILLEGAL
|
default: dwb_sel_o <= #1 4'hX;
|
default: dwb_sel_o <= #1 4'hX;
|
endcase // case (wSEL)
|
endcase // case (wSEL)
|
|
|
// exception checking
|
// exception checking
|
case (opc_of[1:0])
|
dwb_exc <= #1 &opc_of[5:4] & // only for LD/ST commands
|
2'o2: dwb_exc <= #1 |wOFF[1:0];
|
((opc_of[0] & wOFF[0]) | // misaligned 16-bit
|
2'o1: dwb_exc <= #1 wOFF[0];
|
(opc_of[1] & |wOFF[1:0]) // misaligned 32-bit
|
default: dwb_exc <= #1 1'b0;
|
);
|
endcase // case (opc_of[1:0])
|
/*
|
|
case (opc_of[1:0])
|
|
2'o2: dwb_exc <= #1 |wOFF[1:0] & &opc_of[5:4];
|
|
2'o1: dwb_exc <= #1 wOFF[0] & &opc_of[5:4];
|
|
default: dwb_exc <= #1 1'b0;
|
|
endcase // case (opc_of[1:0])
|
|
*/
|
|
|
|
|
end // if (dena)
|
end // if (dena)
|
|
|
// Independent of pipeline
|
// Independent of pipeline
|
|
|