- always @(*)
- begin
- if ((read_0 == write_reg) && write)
- rdata_0 = write_data;
- else
- rdata_0 = regfile[read_0];
-
- if ((read_1 == write_reg) && write)
- rdata_1 = write_data;
- else
- rdata_1 = regfile[read_1];
-
- if ((read_2 == write_reg) && write)
- rdata_2 = write_data;
- else
- rdata_2 = regfile[read_2];
-
- if ((read_3 == write_reg) && write)
- rdata_3 = write_data;
- else
- rdata_3 = regfile[read_3];
-
- spsr = regfile[4'hF];
- end
+ assign rdata_0 = ((read_0 == write_reg) && write) ? write_data : regfile[read_0];
+ assign rdata_1 = ((read_1 == write_reg) && write) ? write_data : regfile[read_1];
+ assign rdata_2 = ((read_2 == write_reg) && write) ? write_data : regfile[read_2];
+ assign rdata_3 = ((read_3 == write_reg) && write) ? write_data : regfile[read_3];
+ assign spsr = regfile[4'hF];