import isa and implicit operands

This commit is contained in:
Michael McLoughlin
2018-11-23 17:14:18 -06:00
parent 86373c79ee
commit 4e059c258b
2 changed files with 24 additions and 6 deletions

View File

@@ -7,8 +7,9 @@ type Instruction struct {
}
type Form struct {
ISA []string
Operands []Operand
CPUID []string
ImplicitOperands []Operand
}
type Operand struct {
@@ -16,6 +17,11 @@ type Operand struct {
Action Action
}
type ImplicitOperand struct {
Register string
Action Action
}
type Action uint8
const (

View File

@@ -81,10 +81,6 @@ func (l *Loader) init() error {
return err
}
// for a, op := range l.alias {
// log.Printf("alias %#v -> %s", a, op)
// }
l.order = opcodescsv.BuildOrderMap(icsv)
return nil
@@ -279,8 +275,24 @@ func (l Loader) form(opcode string, f opcodesxml.Form) inst.Form {
ops[0].Type = "imm2u"
}
// Extract implicit operands.
var implicits []inst.ImplicitOperand
for _, implicit := range f.ImplicitOperands {
implicits = append(implicits, inst.ImplicitOperand{
Register: implicit.ID,
Action: inst.ActionFromReadWrite(implicit.Input, implicit.Output),
})
}
// Extract ISA flags.
var isas []string
for _, isa := range f.ISA {
isas = append(isas, isa.ID)
}
return inst.Form{
Operands: ops,
ISA: isas,
}
}