RiescueD Directives ============================= This reference documents all RiescueD directives with their complete syntax and parameters. RiescueD directives are special comments that start with ``;#`` and control test generation behavior. Test Generation Directives --------------------------- Random Data Generation ~~~~~~~~~~~~~~~~~~~~~~ **;#random_data** - Generate Random Values ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Creates random data values with optional constraints. **Syntax:** .. code-block:: asm ;#random_data(name=, type= [, and_mask=] [, or_mask=]) **Parameters:** - ``name`` (required) - Symbol name to reference in assembly code - ``type`` (required) - Data width: ``bits8``, ``bits16``, ``bits32``, ``bits64``, or ``bitsN`` for arbitrary width - ``and_mask`` (optional) - Mask to constrain random values (bitwise AND) - ``or_mask`` (optional) - Mask to set specific bits (bitwise OR) **Examples:** .. code-block:: asm ;#random_data(name=data1, type=bits32, and_mask=0xfffffff0) ;#random_data(name=data2, type=bits64) ;#random_data(name=small_val, type=bits8, and_mask=0xff) Memory Address Generation ~~~~~~~~~~~~~~~~~~~~~~~~~ **;#random_addr** - Generate Random Addresses ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Creates random memory addresses with alignment and size constraints. **Syntax:** .. code-block:: asm ;#random_addr(name=, type=, size= [, and_mask=] [, io=<0|1>] [, pma_options...]) **Parameters:** - ``name`` (required) - Symbol name for the address - ``type`` (required) - Address type: ``physical`` or ``linear`` - ``size`` (required) - Size of memory region in bytes (hexadecimal) - ``and_mask`` (optional) - Alignment mask (e.g., ``0xfffff000`` for 4KB alignment) - ``io`` (optional) - Set to ``1`` for I/O memory regions, ``0`` for normal memory (default: ``0``) **Physical Memory Attributes (PMA) Parameters:** - ``in_pma`` - Include in PMA configuration (``1`` or ``0``) - ``pma_size`` - PMA region size in bytes - ``pma_read``, ``pma_write``, ``pma_execute`` - Access permissions (``1`` or ``0``) - ``pma_mem_type`` - Memory type: ``'memory'``, ``'io'``, ``'ch0'``, ``'ch1'`` - ``pma_amo_type`` - Atomic operation support: ``'none'``, ``'logical'``, ``'swap'``, ``'arithmetic'`` - ``pma_cacheability`` - Cache behavior: ``'cacheable'``, ``'noncacheable'`` **Examples:** .. code-block:: asm ;#random_addr(name=addr1, type=physical, size=0x1000, and_mask=0xfffff000) ;#random_addr(name=vaddr, type=linear, size=0x2000) ;#random_addr(name=io_addr, type=physical, io=1, size=0x100) Virtual Memory Management ~~~~~~~~~~~~~~~~~~~~~~~~~ **;#page_mapping** - Create Virtual-to-Physical Mappings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Establishes page table entries mapping virtual addresses to physical addresses. **Syntax:** .. code-block:: asm ;#page_mapping(lin_name=, phys_name=, v=<0|1>, r=<0|1>, w=<0|1> [, x=<0|1>] [, a=<0|1>] [, d=<0|1>] [, pagesize=] [, page_maps=] [, modify_pt=<0|1>]) **Alternative Syntax:** .. code-block:: asm ;#page_mapping(lin_addr=
, phys_addr=
, ...) **Parameters:** - ``lin_name`` / ``lin_addr`` - Virtual address symbol or literal address - ``phys_name`` / ``phys_addr`` - Physical address symbol, literal address, or ``&random`` - ``v`` (required) - Valid bit (``1`` = valid, ``0`` = invalid) - ``r`` (required) - Read permission (``1`` = readable, ``0`` = not readable) - ``w`` (required) - Write permission (``1`` = writable, ``0`` = read-only) - ``x`` (optional) - Execute permission (``1`` = executable, ``0`` = non-executable, default: ``0``) - ``a`` (optional) - Accessed bit (``1`` = set accessed, ``0`` = clear, default: ``0``) - ``d`` (optional) - Dirty bit (``1`` = set dirty, ``0`` = clear, default: ``0``) - ``pagesize`` (optional) - Page size list: ``['4kb']``, ``['2mb']``, ``['1gb']``, ``['512gb']``, ``['256tb']``, ``['any']`` - ``page_maps`` (optional) - Page map list: ``['map_os']``, ``['map_hyp']``, ``['custom_map']`` - ``modify_pt`` (optional) - Allow page table modification (``1`` or ``0``, default: ``0``) **Page Size Options:** - ``'4kb'`` - 4 KiB pages - ``'2mb'`` - 2 MiB pages - ``'1gb'`` - 1 GiB pages - ``'512gb'`` - 512 GiB pages - ``'256tb'`` - 256 TiB pages - ``'any'`` - Random page size selection **Special Values:** - ``&random`` - Use a random physical address for ``phys_name`` **Examples:** .. code-block:: asm ;#page_mapping(lin_name=vaddr, phys_name=paddr, v=1, r=1, w=1, x=0, pagesize=['4kb']) ;#page_mapping(lin_addr=0x10000000, phys_name=&random, v=1, r=1, w=1, pagesize=['4kb']) **;#page_map** - Page Table Configuration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Configures page table structures for different paging modes. **Syntax:** .. code-block:: asm ;#page_map(name=, mode=) **Parameters:** - ``name`` (required) - Page map identifier - ``mode`` (required) - Paging mode: ``sv39``, ``sv48``, ``sv57`` **Examples:** .. code-block:: asm ;#page_map(name=map1, mode=sv39) ;#page_map(name=map2, mode=sv48) Memory Initialization ~~~~~~~~~~~~~~~~~~~~~ **;#init_memory** - Initialize Memory Regions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Places data or code at specific memory addresses. **Syntax:** .. code-block:: asm ;#init_memory @ **Parameters:** - ``address_symbol`` (required) - Symbol name from ``random_addr`` directive **Usage:** Must be followed by assembly data or instructions that will be placed at the specified address. **Examples:** .. code-block:: asm ;#random_addr(name=data_region, type=physical, size=0x1000) ;#init_memory @data_region .word 0x12345678 .ascii "test string" **;#reserve_memory** - Reserve Memory Regions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Reserves specific memory regions for test use. **Syntax:** .. code-block:: asm ;#reserve_memory(start_addr=
, addr_type=, size=) **Parameters:** - ``start_addr`` (required) - Starting address (hexadecimal) - ``addr_type`` (required) - Address space: ``linear`` or ``physical`` - ``size`` (required) - Size of reserved region in bytes **Examples:** .. code-block:: asm ;#reserve_memory(start_addr=0x600000, addr_type=linear, size=0x1000) ;#reserve_memory(start_addr=0x500000, addr_type=physical, size=0x1000) Test Structure Directives ~~~~~~~~~~~~~~~~~~~~~~~~~~ **;#discrete_test** - Define Test Cases ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Registers individual test cases within a test file. **Syntax:** .. code-block:: asm ;#discrete_test(test=