Skip to content

Commit

Permalink
Add support for floats (#22)
Browse files Browse the repository at this point in the history
Adding a `Float32` datatype is necessary, since python makes no guarantees to the bitwidth of `float` (it's often a double)

Also adding the `RV32F` extension with most operations implemented, and support for floating point registers.
  • Loading branch information
AntonLydike authored Jun 6, 2023
1 parent 5a23804 commit be90879
Show file tree
Hide file tree
Showing 12 changed files with 895 additions and 84 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/riscemu.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions riscemu/MMU.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Program,
InstructionContext,
Int32,
Float32,
)
from .types.exceptions import InvalidAllocationException, MemoryAccessException

Expand Down Expand Up @@ -187,6 +188,9 @@ def label(self, symb: str):
def read_int(self, addr: int) -> Int32:
return Int32(self.read(addr, 4))

def read_float(self, addr: int) -> Float32:
return Float32(self.read(addr, 4))

def translate_address(self, address: T_AbsoluteAddress) -> str:
sec = self.get_sec_containing(address)
if not sec:
Expand Down
Loading

0 comments on commit be90879

Please sign in to comment.