Skip to content
Snippets Groups Projects
Commit 02b7e4e6 authored by Elias Johansson's avatar Elias Johansson
Browse files

updated ir

parent 92dc31ab
No related branches found
No related tags found
No related merge requests found
Pipeline #99374 failed
home = /usr/bin
include-system-site-packages = false
version = 3.10.6
...@@ -20,6 +20,10 @@ class Module: ...@@ -20,6 +20,10 @@ class Module:
pass pass
def output_register(self) -> None: def output_register(self) -> None:
"""
Simulates module behaviour for giving data to output signals
during a clock tick. Exact behaviour is specifid in each module type.
"""
pass pass
def update_logic(self) -> None: def update_logic(self) -> None:
......
...@@ -26,14 +26,22 @@ class IR(Module): ...@@ -26,14 +26,22 @@ class IR(Module):
# Register as destination of input signals # Register as destination of input signals
from_bus.add_destination(self) from_bus.add_destination(self)
def update(self) -> None: # Internal values
self.op = 0
self.grx = 0
self.m = 0
self.a = 0
def update_register(self) -> None:
self.instruction = self.from_bus_s.get_value() self.instruction = self.from_bus_s.get_value()
op = self.instruction >> 12 self.op = self.instruction >> 12
grx = (self.instruction >> 10) & 0b11 self.grx = (self.instruction >> 10) & 0b11
m = (self.instruction >> 8) & 0b11 self.m = (self.instruction >> 8) & 0b11
a = self.instruction & (2**8-1) self.a = self.instruction & (2**8-1)
self.op_s.update_value(op)
self.grx_s.update_value(grx) def output_register(self) -> None:
self.m_s.update_value(m) self.op_s.update_value(self.op)
self.to_bus_s.update_value(a) self.grx_s.update_value(self.grx)
self.m_s.update_value(self.m)
self.to_bus_s.update_value(self.a)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment