module ecccpu.mem
class mem
Memory class for the EccCPU ISA
method __init__
__init__(dmem=[], dmemNum=16)
Init the memory
Args:
dmem
(list, optional): Initial ram. Defaults to [].dmemNum
(int, optional): Length of zeroed ram whendmem
is default. Defaults to 16.
method mem2str
mem2str()
For GUI, returns a string of the values stored in memory
Returns:
str
: Formatted memory values
method pcfl2str
pcfl2str()
For GUI, returns a string of the values stored in PC and flags
Returns:
str
: Formatted PC and flag values
method print
print()
Prints the data in the registers and memory to stdout
method ram_read
ram_read(addr: int) → int
Read from ram
Args:
addr
(int): Byte-address to read from
Returns:
int
: Stored value
method ram_write
ram_write(value: int, addr: int)
Write to ram
Args:
value
(int): Value to be storedaddr
(int): Byte-address to store at
method reg2str
reg2str()
For GUI, returns a string of the values stored in registers
Returns:
str
: Formatted register values
method regs_read
regs_read(reg: str) → int
Read the value stored in a register
Args:
reg
(str): Register string (e.g.r9
,1
)
Returns:
int
: Value stored in register
method regs_write
regs_write(reg: str, value: int)
Write a value to a register
Args:
reg
(str): Register string (e.g.r9
,1
)value
(int): Value to store
method reset
reset()
Resets the memory to initialized values
This file was automatically generated via lazydocs.