blob: 51370befed02d545c3fc0f628b632a08b298d908 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
`include "core/isa.sv"
`include "core/psr.sv"
`include "core/uarch.sv"
module core_decode_data
(
input word insn,
output alu_op op,
output reg_num rn,
rd,
output logic writeback,
update_flags,
restore_spsr
);
assign rn = insn `FIELD_DATA_RN;
assign rd = insn `FIELD_DATA_RD;
assign op = insn `FIELD_DATA_OPCODE;
always_comb begin
unique case(op)
`ALU_CMP, `ALU_CMN, `ALU_TST, `ALU_TEQ:
writeback = 0;
default:
writeback = 1;
endcase
update_flags = insn `FIELD_DATA_S;
restore_spsr = (rd == `R15) & update_flags;
if(restore_spsr)
update_flags = 0;
end
endmodule
|