1 `include "ARM_Constants.v"
12 output reg [31:0] busaddr,
16 output reg [31:0] wr_data,
19 /* regfile interface */
20 output reg [3:0] st_read,
23 /* writeback to base */
25 output reg [3:0] regsel,
26 output reg [31:0] regdata,
29 output reg [31:0] outpc,
30 output reg [31:0] newpc,
38 reg [31:0] addr, raddr;
41 wire [31:0] align_s1, align_s2, align_rddata;
42 assign outstall = rw_wait | notdone;
50 wr_data = 32'hxxxxxxxx;
51 busaddr = 32'hxxxxxxxx;
54 `DECODE_LDRSTR_UNDEFINED: begin end
56 addr = insn[23] ? base + offset : base - offset; /* up/down select */
57 raddr = insn[24] ? base : addr;
58 busaddr = {raddr[31:2], 2'b0}; /* pre/post increment */
61 if(!insn[20]) begin /* store */
62 st_read = insn[15:12];
63 wr_data = insn[22] ? {4{st_data[7:0]}} : st_data;
65 else if(insn[15:12] == 4'hF)
74 assign align_s1 = raddr[1] ? {rd_data[15:0], rd_data[31:16]} : rd_data;
75 assign align_s2 = raddr[0] ? {align_s1[7:0], align_s1[31:8]} : align_s1;
76 assign align_rddata = insn[22] ? {24'b0, align_s2[7:0]} : align_s2;
83 `DECODE_LDRSTR_UNDEFINED: begin
86 regdata <= 32'hxxxxxxxx;
90 if(insn[20] && !inc_next) begin /* load - delegate regfile write to writeback stage */
91 if(insn[15:12] == 4'hF) begin
92 newpc <= align_rddata;
96 regsel <= insn[15:12];
97 regdata <= align_rddata;
101 else if(insn[21]) begin /* write back */
103 regsel <= insn[19:16];
110 regdata <= 32'hxxxxxxxx;
112 notdone <= rw_wait & insn[20] & insn[21];
114 `DECODE_LDMSTM: begin
119 regdata <= 32'hxxxxxxxx;