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)

This will increase the address

riscemu.helpers.parse_numeric_argument(arg: str) int

parse hex or int strings

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, joiner=' ')
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.

class riscemu.helpers.Peekable(iterable: Iterable[T])

Bases: Generic[T], Iterator[T]

__init__(iterable: Iterable[T])
peek() Optional[T]
push_back(item: T)
is_empty() bool
riscemu.helpers.get_section_base_name(section_name: str) str