summaryrefslogtreecommitdiff
path: root/rtl/core/psr.sv
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-09-25 20:05:30 -0600
committerAlejandro Soto <alejandro@34project.org>2022-09-25 20:05:30 -0600
commit146586c0fb52dccb9ab483b8b20369ed19ae5116 (patch)
tree144e3ac13ecb95f164ab47cc4e7f936cf52da087 /rtl/core/psr.sv
parentfa370016708149976c748c14eadad1f89cf5a8ea (diff)
Implement flag updates
Diffstat (limited to 'rtl/core/psr.sv')
-rw-r--r--rtl/core/psr.sv12
1 files changed, 11 insertions, 1 deletions
diff --git a/rtl/core/psr.sv b/rtl/core/psr.sv
index 0ade723..2c0d48f 100644
--- a/rtl/core/psr.sv
+++ b/rtl/core/psr.sv
@@ -3,13 +3,23 @@
module core_psr
(
input logic clk,
+ update_flags,
+ alu_v_valid,
input psr_flags alu_flags,
output psr_flags flags,
next_flags
);
- assign next_flags = alu_flags; //TODO
+ always_comb begin
+ next_flags = flags;
+
+ if(update_flags) begin
+ next_flags = alu_flags;
+ if(~alu_v_valid)
+ next_flags.v = flags.v;
+ end
+ end
always_ff @(posedge clk)
flags <= next_flags;