1 `include "ARM_Constants.v"
8 output reg [31:0] busaddr,
12 output reg [31:0] wr_data,
15 /* regfile interface */
16 output reg [3:0] st_read,
27 input [3:0] write_num,
28 input [31:0] write_data,
33 output reg [31:0] outpc,
34 output reg [31:0] outinsn,
35 output reg out_write_reg = 1'b0,
36 output reg [3:0] out_write_num = 4'bxxxx,
37 output reg [31:0] out_write_data = 32'hxxxxxxxx
40 reg [31:0] addr, raddr, next_regdata;
41 reg [3:0] next_regsel;
42 reg next_writeback, next_notdone, next_inc_next;
43 reg [31:0] align_s1, align_s2, align_rddata;
46 wire [3:0] next_write_num;
47 wire [31:0] next_write_data;
49 reg [15:0] regs, next_regs;
59 out_write_reg <= next_writeback;
60 out_write_num <= next_regsel;
61 out_write_data <= next_regdata;
62 notdone <= next_notdone;
63 inc_next <= next_inc_next;
73 wr_data = 32'hxxxxxxxx;
74 busaddr = 32'hxxxxxxxx;
77 next_write_reg = write_reg;
78 next_write_num = write_num;
79 next_write_data = write_data;
84 `DECODE_LDRSTR_UNDEFINED: begin end
87 outstall = rw_wait | notdone;
89 addr = insn[23] ? op0 + op1 : op0 - op1; /* up/down select */
90 raddr = insn[24] ? op0 : addr; /* pre/post increment */
91 busaddr = {raddr[31:2], 2'b0};
95 /* rotate to correct position */
96 align_s1 = raddr[1] ? {rd_data[15:0], rd_data[31:16]} : rd_data;
97 align_s2 = raddr[0] ? {align_s1[7:0], align_s1[31:8]} : align_s1;
98 /* select byte or word */
99 align_rddata = insn[22] ? {24'b0, align_s2[7:0]} : align_s2;
102 wr_data = insn[22] ? {4{op2[7:0]}} : op2; /* XXX need to actually store just a byte */
104 else if(!inc_next) begin
105 next_write_reg = 1'b1;
106 next_write_num = insn[15:12];
107 next_write_data = align_rddata;
108 next_inc_next = 1'b1;
110 else if(insn[21]) begin
111 next_write_reg = 1'b1;
112 next_write_num = insn[19:16];
113 next_write_data = addr;
115 next_notdone = rw_wait & insn[20] & insn[21];
118 `DECODE_LDMSTM: begin
119 busaddr = {op0[31:2], 2'b0};
123 16'b???????????????1: begin
126 16'b??????????????10: begin
128 16'b?????????????100: begin
130 16'b????????????1000: begin
132 16'b???????????10000: begin
134 16'b??????????100000: begin
136 16'b?????????1000000: begin
138 16'b????????10000000: begin
140 16'b???????100000000: begin
142 16'b??????1000000000: begin
144 16'b?????10000000000: begin
146 16'b????100000000000: begin
148 16'b???1000000000000: begin
150 16'b??10000000000000: begin
152 16'b?100000000000000: begin
154 16'b1000000000000000: begin
157 next_inc_next = 1'b1;