From d73352b1409a3763704ee491d1672dffeb3aa54c Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 18 Jun 2020 11:26:10 +0100 Subject: [PATCH] get instructions immediately from assembly code --- src/soc/simulator/program.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/soc/simulator/program.py b/src/soc/simulator/program.py index cd515a8d..fdcea642 100644 --- a/src/soc/simulator/program.py +++ b/src/soc/simulator/program.py @@ -24,6 +24,7 @@ class Program: instructions = '\n'.join(instructions) self.assembly = instructions + '\n' # plus final newline self._assemble() + self._instructions = list(self._get_instructions()) def __enter__(self): return self @@ -64,13 +65,16 @@ class Program: sys.exit(1) self._link(outfile) - def generate_instructions(self): + def _get_instructions(self): while True: data = self.binfile.read(4) if not data: break yield struct.unpack('