From ce551dc62cbedf0c3cc4fa13d163162b4736df4b Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Fri, 15 May 2020 14:51:00 -0400 Subject: [PATCH] Add ability to specify initial CR state --- src/soc/branch/main_stage.py | 16 ++++++++++++++++ src/soc/branch/test/test_pipe_caller.py | 17 +++++++++++++---- src/soc/decoder/isa/caller.py | 4 ++-- src/soc/decoder/pseudo/pywriter.py | 4 ++-- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/soc/branch/main_stage.py b/src/soc/branch/main_stage.py index 607cd6bd..9bb4b2b5 100644 --- a/src/soc/branch/main_stage.py +++ b/src/soc/branch/main_stage.py @@ -55,6 +55,20 @@ class BranchMainStage(PipeModBase): with m.Else(): comb += branch_addr.eq(branch_imm_addr + self.i.cia) + + # handle conditional branches (BO and BI are same for BC and + # BCREG) + b_fields = self.fields.instrs['B'] + bo = Signal(b_fields['BO'][0:-1].shape()) + comb += bo.eq(b_fields['BO'][0:-1]) + bi = Signal(b_fields['BI'][0:-1].shape()) + comb += bi.eq(b_fields['BI'][0:-1]) + + cr_bit = Signal(reset_less=True) + comb += cr_bit.eq((self.i.cr & (1<