central-arch/cmd/asmtest/asmtest.go

25 lines
652 B
Go
Raw Permalink Normal View History

2024-11-01 10:54:59 +00:00
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/instrset"
2024-11-01 10:54:59 +00:00
"git.elyanpoujol.fr/elyan/central-arch/pkg/simcontext"
"git.elyanpoujol.fr/elyan/central-arch/pkg/siminstr"
2024-11-01 10:54:59 +00:00
)
const (
MOV_r1_r2 instr.Instr = 0xffff_ff2a
SVC_ffffff instr.Instr = 0xffff_ffff
)
func main() {
cpu := cpu.New(simcontext.SimContext{}, nil)
cpu.RegisterInstr(siminstr.SimInstrDesc{InstrDesc: &instrset.LDRIR, Behavior: nil})
2024-11-01 10:54:59 +00:00
fmt.Printf("MOV[6:0] = %#0x\n", cpu.GetOpCode(MOV_r1_r2))
fmt.Printf("SVC[6:0] = %#0x\n", cpu.GetOpCode(SVC_ffffff))
}