calculate lui_auipc
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 25 Nov 2018 06:43:31 +0000 (06:43 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 25 Nov 2018 06:43:31 +0000 (06:43 +0000)
cpu.py

diff --git a/cpu.py b/cpu.py
index a7e3ab39e0c0ca60cb0f18216d73495a17e687af..ae24ce42c81e2afada7088adc7ac43e30864ab8d 100644 (file)
--- a/cpu.py
+++ b/cpu.py
@@ -274,6 +274,10 @@ class CPU(Module):
         )
         self.specials += ali
 
+        lui_auipc_result = Signal(32)
+        self.comb += lui_auipc_result.eq(Mux(dc.opcode[5],
+                                             dc.immediate,
+                                             dc.immediate + fetch_output_pc))
 
 if __name__ == "__main__":
     example = CPU()