Skip to content

TRI-27 emulator: tri_asm.zig and loader.load disagree by two bytes on where the code starts #1167

Description

@dmitrii-f-t27

Where: tri_asm.zig (the writer) and loader.zig (the reader) at 976df51.

What happens. tri_asm.zig pads its header to twelve bytes, while loader.load reads the code from byte ten.

  • A written container loads shifted by two bytes, and its first word decodes from the two padding bytes.
  • The owner's tests never load a written container: they copy it to byte 0 and run from word 3.

Source: specs/isa/tri27_bytecode.t27, FINDINGS. The invariant the_writer_header_exceeds_the_loader_header_by_two in the same spec pins the difference.

Expected.

  • The writer and the loader agree on the header length.
  • A test loads a container written by tri_asm.zig through loader.load.

Vectors. Both are in conformance/trinity/tri27_programs.json:

  • load-good: the writer's container is accepted, but the code is taken from byte 10;
  • load-native: the ten-byte container the loader expects.

Found while writing the S05 specs of #988 (gHashTag/t27#3581); until now it lived only in the spec's FINDINGS. The vectors are replayed by tools/trinity_tri27.py in gHashTag/t27. Tracked in #1164.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions