3 input Nrst, /* XXX not used yet */
17 output reg outstall = 0,
18 output reg outbubble = 1,
19 output reg [31:0] outcpsr = 0,
20 output reg write_reg = 1'bx,
21 output reg [3:0] write_num = 4'bxxxx,
22 output reg [31:0] write_data = 32'hxxxxxxxx
26 reg [31:0] mult_acc0, mult_in0, mult_in1;
28 wire [31:0] mult_result;
30 wire [31:0] alu_in0, alu_in1;
32 wire alu_setflags, alu_set;
33 wire [31:0] alu_result, alu_outcpsr;
35 Multiplier multiplier(
36 .clk(clk), .Nrst(Nrst),
37 .start(mult_start), .acc0(mult_acc0), .in0(mult_in0),
38 .in1(mult_in1), .done(mult_done), .result(mult_result));
41 .clk(clk), .Nrst(Nrst),
42 .in0(alu_in0), .in1(alu_in1), .cpsr(cpsr), .op(alu_op),
43 .setflags(alu_setflags), .shifter_carry(carry),
44 .result(alu_result), .cpsr_out(alu_outcpsr), .set(alu_set));
49 input Nrst, /* XXX not used yet */
57 output reg [31:0] result);
60 reg [31:0] multiplicand;
71 bitfield <= {2'b00, bitfield[31:2]};
72 multiplicand <= {multiplicand[29:0], 2'b00};
74 (bitfield[0] ? multiplicand : 0) +
75 (bitfield[1] ? {multiplicand[30:0], 1'b0} : 0);
76 if (bitfield == 0) begin
84 /* XXX is the interface correct? */
87 input Nrst, /* XXX not used yet */
96 output reg [31:0] result,
97 output reg [31:0] cpsr_out,
101 wire flag_n, flag_z, flag_c, flag_v, setres;
102 wire [32:0] sum, diff, rdiff;
104 assign sum = {1'b0, in0} + {1'b0, in1};
105 assign diff = {1'b0, in0} - {1'b0, in1};
106 assign rdiff = {1'b0, in1} + {1'b0, in0};
108 /* TODO XXX flag_v not set correctly */
112 flag_c = cpsr[`CPSR_C];
113 flag_v = cpsr[`CPSR_V];
117 flag_c = shifter_carry;
122 flag_c = shifter_carry;
126 {flag_c, res} = diff;
130 {flag_c, res} = rdiff;
138 {flag_c, res} = sum + {32'b0, cpsr[`CPSR_C]};
142 {flag_c, res} = diff - {32'b0, (~cpsr[`CPSR_C])};
146 {flag_c, res} = rdiff - {32'b0, (~cpsr[`CPSR_C])};
151 flag_c = shifter_carry;
156 flag_c = shifter_carry;
160 {flag_c, res} = diff;
169 flag_c = shifter_carry;
174 flag_c = shifter_carry;
179 flag_c = shifter_carry;
184 flag_c = shifter_carry;
195 always @(posedge clk) begin
197 cpsr_out <= setflags ? {flag_n, flag_z, flag_c, flag_v, cpsr[27:0]} : cpsr;