From 3e1c7376e613aff448f23e5bfb6e113ce651d378 Mon Sep 17 00:00:00 2001 From: Johannes Kung <johku144@student.liu.se> Date: Fri, 5 Jul 2024 08:13:23 +0000 Subject: [PATCH] Apply 5 suggestion(s) to 1 file(s) --- src/simudator/core/modules/register.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/src/simudator/core/modules/register.py b/src/simudator/core/modules/register.py index 00f0dfe..f33b89e 100644 --- a/src/simudator/core/modules/register.py +++ b/src/simudator/core/modules/register.py @@ -54,12 +54,7 @@ class Register(Module): self._value = input_value def output_register(self) -> None: - """ - Propagate the value of the register to the output signal. - - It is the response of the destination to know when it should - read the output. - """ + """Output the value of the register onto the output signal.""" self.signals["out_content"].update_value(self._value) def update_logic(self): @@ -71,11 +66,6 @@ class Register(Module): pass def get_state(self) -> dict[str, Any]: - """ - Returns a dict of the register state. - - These states are changeable via set_states. - """ state = super().get_state() state["value"] = self._value return state @@ -99,16 +89,11 @@ class Register(Module): def reset(self) -> None: """ - Resets the register to 0. + Reset the register to 0. """ self._value = 0 def save_state_to_file(self, file_path: str) -> bool: - """ - Tries to save the modules state to a given file. - - Returns true on success and false if something went wrong. - """ content = self.name + ":\n" + "value: " + str(self._value) + "\n\n" return super()._helper_save_state_to_file(file_path, content) @@ -182,9 +167,6 @@ class IntegerRegister(Register): super().set_state(state) def save_state_to_file(self, file_path: str) -> None: - """ - Tries to save the modules state to a given file. - """ file = open(file_path, "a") file.write(self.name + ":\n") file.write("value: " + hex(self._value)[2:] + "\n\n") -- GitLab