riscemu.helpers module¶
RiscEmu (c) 2021 Anton Lydike
SPDX-License-Identifier: MIT
-
riscemu.helpers.
align_addr
(addr: int, to_bytes: int = 8) → int¶ align an address to to_bytes (meaning addr & to_bytes = 0)
-
riscemu.helpers.
parse_numeric_argument
(arg: str) → int¶ parse hex or int strings
-
riscemu.helpers.
int_to_bytes
(val, bytes=4, unsigned=False) → bytearray¶ int -> byte (two’s complement)
-
riscemu.helpers.
int_from_bytes
(bytes, unsigned=False) → int¶ byte -> int (two’s complement)
-
riscemu.helpers.
to_unsigned
(num: int, bytes=4) → int¶
-
riscemu.helpers.
to_signed
(num: int, bytes=4) → int¶
-
riscemu.helpers.
create_chunks
(my_list, chunk_size)¶ Split a list like [a,b,c,d,e,f,g,h,i,j,k,l,m] into e.g. [[a,b,c,d],[e,f,g,h],[i,j,k,l],[m]]
-
riscemu.helpers.
apply_highlight
(item, ind, hi_ind)¶ applies some hightlight such as underline to item if ind == hi_ind
-
riscemu.helpers.
highlight_in_list
(items, hi_ind)¶
-
riscemu.helpers.
format_bytes
(byte_arr: bytearray, fmt: str, group: int = 1, highlight: int = - 1)¶ Format byte array as per fmt. Group into groups of size group, and highlight index highlight.