started work on ass2

This commit is contained in:
Jaka Furlan 2025-11-26 16:42:36 +01:00
parent b16c3e23d8
commit 1b990e190c
16 changed files with 360 additions and 0 deletions

10
ass2/SICocaml/decoder.ml Normal file
View file

@ -0,0 +1,10 @@
(*decoderjeva naloga je pridobiti mnemonic in tip ukaza iz prvega byta z pogledom v hash-table*)
let table = OpcodeTable.table
let decoder (byte1 : char) : OpcodeTable.info =
let opcode = (Char.code byte1) land 0xFC in
try
Hashtbl.find OpcodeTable.table opcode
with
| Not_found -> failwith "invalid opcode"