G.2 – Instruction Inventory (GrainMaster.tsv))))

<< Click to Display Table of Contents >>

Navigation:  ASA-EMulatR Reference Guide > Introduction > Appendix > Appendix G - Instruction Grain Mechanics >

G.2 – Instruction Inventory (GrainMaster.tsv))))

The GrainMaster.tsv file (grainfactoryLib/grains/GrainMaster.tsv) is the master opcode table containing 616 entries that define every instruction the emulator supports. Each row specifies opcode, function code, mnemonic, description, instruction type, and target box. The Python tooling (generate_all_grains.py) reads this TSV and generates C++ registration code that populates the InstructionGrainRegistry at startup.

 

Instruction distribution by box:

 

Box

Category

Scope

EBox

Integer ALU, shift, compare, conditional move, multimedia

Largest instruction count — integer operate instructions

FBox

IEEE and VAX floating-point arithmetic, conversions, FPCR

All FP operations with trap mode variants

MBox

Load, store, prefetch, LDx_L/STx_C, unaligned access

All memory data path instructions

CBox

MB, WMB, EXCB, TRAPB, ECB, WH64, FETCH/FETCH_M

Barrier, cache hint, and serialization instructions

IBox

Branch, jump, BSR, RET, COROUTINE

Control flow instructions decoded at fetch

PalBox

~80 PAL functions: CALL_PAL, MFPR_*/MTPR_*, HALT, SWPCTX, CHMx, queue ops, etc.

All privileged and unprivileged PAL calls

 

Generation pipeline: GrainMaster.tsvgenerate_all_grains.py → C++ grain registration code → InstructionGrainRegistry::instance().grainCount() reports total registered grains at startup. The grain resolver (GrainResolver) uses the registry for instruction decode: opcode + function code → grain pointer → execute().

 

See Also: grainfactoryLib/grains/GrainMaster.tsv; grainfactoryLib/generate_all_grains.py; Chapter 14 – Execution Domains (“Boxes”) .