package main import ( "fmt" "git.elyanpoujol.fr/elyan/central-arch/pkg/cpu" "git.elyanpoujol.fr/elyan/central-arch/pkg/instr" "git.elyanpoujol.fr/elyan/central-arch/pkg/simcontext" ) const ( MOV_r1_r2 instr.Instr = 0xffff_ff2a SVC_ffffff instr.Instr = 0xffff_ffff ) func main() { cpu := cpu.New(simcontext.SimContext{}, nil) cpu.RegisterInstr(instr.InstrDesc{ Mnemonic: "LDR", VariantName: "LDRIR", OpCode: 0x01, Format: instr.A, Formatter: func(i *instr.DecodedInstr) string { return "Hello" }}) fmt.Printf("MOV[6:0] = %#0x\n", cpu.GetOpCode(MOV_r1_r2)) fmt.Printf("SVC[6:0] = %#0x\n", cpu.GetOpCode(SVC_ffffff)) }