Documentation
¶
Overview ¶
The Censor 932 CPU package.
After the machine description at:
http://www.veteranklubbenalfa.se/veteran/13q1/130215.pdf
The cpu package includes instructions, instruction decoding, memory interfaces, etc.
Index ¶
- type AD
- type ADW
- type AH
- type AS
- type ATS
- type AW
- type CD
- type CH
- type CLD
- type CLH
- type CLW
- type CP
- type CPU
- func (c *CPU) FetchHalfWord(address uint32) uint16
- func (c *CPU) FetchWord(address uint32) uint32
- func (c *CPU) RegisterMemory(r MemoryRange, m MemoryBackend) error
- func (c *CPU) Step()
- func (c *CPU) StoreHalfWord(address uint32, word uint16) uint16
- func (c *CPU) StoreWord(address, word uint32) uint32
- type CW
- type DD
- type DH
- type DS
- type DW
- type DirectMemory
- type EX
- type IH
- type IW
- type Instruction
- func BuildADFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildADWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildAHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildASFunc(op, r1, r2 uint8, as uint16) Instruction
- func BuildATSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildAWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildCDFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildCHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildCLDFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildCLHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildCLWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildCWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildDDFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildDHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildDSFunc(op, r1, r2 uint8, as uint16) Instruction
- func BuildDWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildEXFunc(op, r, ix uint8, as uint16) Instruction
- func BuildIHFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
- func BuildIWFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
- func BuildJCFunc(op, r, ix uint8, as uint16) Instruction
- func BuildJOAFunc(op, r, ix uint8, as uint16) Instruction
- func BuildJOSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildJSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildJTSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildLCFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
- func BuildLDFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildLDWFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildLHFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildLNFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
- func BuildLPFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
- func BuildLRSFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildLTFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildLWFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildMDFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildMHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildMSFunc(op, r1, r2 uint8, as uint16) Instruction
- func BuildMWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildNDFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildNHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildNOPFunc(op, r, ix uint8, as uint16) Instruction
- func BuildNSFunc(op, r1, r2 uint8, as uint16) Instruction
- func BuildNTSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildNWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildODFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildOHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildOSFunc(op, r1, r2 uint8, as uint16) Instruction
- func BuildOTSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildOWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildRLDFunc(op, r, ix uint8, as uint16) Instruction
- func BuildRLSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildRRDFunc(op, r, ix uint8, as uint16) Instruction
- func BuildRRSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildRZHFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildRZWFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildSDFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildSDWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSFSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSLAFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSLDAFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSLDLFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSLLFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSRAFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSRDAFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSRDLFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSRLFunc(op, r, ix uint8, as uint16) Instruction
- func BuildSRSFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildSSFunc(op, r1, r2 uint8, as uint16) Instruction
- func BuildSTDWFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildSTHFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildSTWFunc(op, r1, r2 uint8, rest uint16) Instruction
- func BuildSWFunc(op, r, ix uint8, as uint16) Instruction
- func BuildXDFunc(op, r1, r2 uint8, d uint16) Instruction
- func BuildXHFunc(op, r, ix uint8, as uint16) Instruction
- func BuildXSFunc(op, r1, r2 uint8, as uint16) Instruction
- func BuildXTSFunc(op, r, ix uint8, as uint16) Instruction
- func BuildXWFunc(op, r, ix uint8, as uint16) Instruction
- type InstructionBuilder
- type JC
- type JOA
- type JOS
- type JS
- type JTS
- type LC
- type LD
- type LDW
- type LH
- type LN
- type LP
- type LRS
- type LT
- type LW
- type MD
- type MH
- type MS
- type MW
- type MemoryBackend
- type MemoryPlugin
- type MemoryRange
- type ND
- type NH
- type NOP
- type NS
- type NTS
- type NW
- type OD
- type OH
- type OS
- type OTS
- type OW
- type RLD
- type RLS
- type RRD
- type RRS
- type RZH
- type RZW
- type SD
- type SDW
- type SFS
- type SH
- type SLA
- type SLDA
- type SLDL
- type SLL
- type SRA
- type SRDA
- type SRDL
- type SRL
- type SRS
- type SS
- type STDW
- type STH
- type STW
- type SW
- type XD
- type XH
- type XS
- type XTS
- type XW
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CPU ¶
type CPU struct {
G [16]uint32
IC uint32 // This is technically an 18-bit entity
PS uint64
MIR uint32 // Actually a 24-bit entity
Memory []MemoryPlugin
CC uint8
}
Basic CPU data structure
func (*CPU) FetchHalfWord ¶
Fetch a 16-bit word from a specific address
func (*CPU) RegisterMemory ¶
func (c *CPU) RegisterMemory(r MemoryRange, m MemoryBackend) error
Register a memory backend with a specific memory range. Return an error if the memory plugin is colliding with an alread-registered plugin.
type DirectMemory ¶
type DirectMemory struct {
// contains filtered or unexported fields
}
Various stuff for implementing "local" memory
func NewDirectMemory ¶
func NewDirectMemory(size uint32) *DirectMemory
func (*DirectMemory) FetchHalfWord ¶
func (m *DirectMemory) FetchHalfWord(address uint32) uint16
func (*DirectMemory) FetchWord ¶
func (m *DirectMemory) FetchWord(address uint32) uint32
func (*DirectMemory) WriteHalfWord ¶
func (m *DirectMemory) WriteHalfWord(address uint32, data uint16) uint16
func (*DirectMemory) WriteWord ¶
func (m *DirectMemory) WriteWord(address, data uint32) uint32
type Instruction ¶
General Instruction abstraction
func BuildADFunc ¶
func BuildADFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildADWFunc ¶
func BuildADWFunc(op, r, ix uint8, as uint16) Instruction
func BuildAHFunc ¶
func BuildAHFunc(op, r, ix uint8, as uint16) Instruction
func BuildASFunc ¶
func BuildASFunc(op, r1, r2 uint8, as uint16) Instruction
func BuildATSFunc ¶
func BuildATSFunc(op, r, ix uint8, as uint16) Instruction
func BuildAWFunc ¶
func BuildAWFunc(op, r, ix uint8, as uint16) Instruction
func BuildCDFunc ¶
func BuildCDFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildCHFunc ¶
func BuildCHFunc(op, r, ix uint8, as uint16) Instruction
func BuildCLDFunc ¶
func BuildCLDFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildCLHFunc ¶
func BuildCLHFunc(op, r, ix uint8, as uint16) Instruction
func BuildCLWFunc ¶
func BuildCLWFunc(op, r, ix uint8, as uint16) Instruction
func BuildCWFunc ¶
func BuildCWFunc(op, r, ix uint8, as uint16) Instruction
func BuildDDFunc ¶
func BuildDDFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildDHFunc ¶
func BuildDHFunc(op, r, ix uint8, as uint16) Instruction
func BuildDSFunc ¶
func BuildDSFunc(op, r1, r2 uint8, as uint16) Instruction
func BuildDWFunc ¶
func BuildDWFunc(op, r, ix uint8, as uint16) Instruction
func BuildEXFunc ¶
func BuildEXFunc(op, r, ix uint8, as uint16) Instruction
func BuildIHFunc ¶
func BuildIHFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
func BuildIWFunc ¶
func BuildIWFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
func BuildJCFunc ¶
func BuildJCFunc(op, r, ix uint8, as uint16) Instruction
func BuildJOAFunc ¶
func BuildJOAFunc(op, r, ix uint8, as uint16) Instruction
func BuildJOSFunc ¶
func BuildJOSFunc(op, r, ix uint8, as uint16) Instruction
func BuildJSFunc ¶
func BuildJSFunc(op, r, ix uint8, as uint16) Instruction
func BuildJTSFunc ¶
func BuildJTSFunc(op, r, ix uint8, as uint16) Instruction
func BuildLCFunc ¶
func BuildLCFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
func BuildLDFunc ¶
func BuildLDFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildLDWFunc ¶
func BuildLDWFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildLHFunc ¶
func BuildLHFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildLNFunc ¶
func BuildLNFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
func BuildLPFunc ¶
func BuildLPFunc(op uint8, r1, r2 uint8, rest uint16) Instruction
func BuildLRSFunc ¶
func BuildLRSFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildLTFunc ¶
func BuildLTFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildLWFunc ¶
func BuildLWFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildMDFunc ¶
func BuildMDFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildMHFunc ¶
func BuildMHFunc(op, r, ix uint8, as uint16) Instruction
func BuildMSFunc ¶
func BuildMSFunc(op, r1, r2 uint8, as uint16) Instruction
func BuildMWFunc ¶
func BuildMWFunc(op, r, ix uint8, as uint16) Instruction
func BuildNDFunc ¶
func BuildNDFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildNHFunc ¶
func BuildNHFunc(op, r, ix uint8, as uint16) Instruction
func BuildNOPFunc ¶
func BuildNOPFunc(op, r, ix uint8, as uint16) Instruction
func BuildNSFunc ¶
func BuildNSFunc(op, r1, r2 uint8, as uint16) Instruction
func BuildNTSFunc ¶
func BuildNTSFunc(op, r, ix uint8, as uint16) Instruction
func BuildNWFunc ¶
func BuildNWFunc(op, r, ix uint8, as uint16) Instruction
func BuildODFunc ¶
func BuildODFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildOHFunc ¶
func BuildOHFunc(op, r, ix uint8, as uint16) Instruction
func BuildOSFunc ¶
func BuildOSFunc(op, r1, r2 uint8, as uint16) Instruction
func BuildOTSFunc ¶
func BuildOTSFunc(op, r, ix uint8, as uint16) Instruction
func BuildOWFunc ¶
func BuildOWFunc(op, r, ix uint8, as uint16) Instruction
func BuildRLDFunc ¶
func BuildRLDFunc(op, r, ix uint8, as uint16) Instruction
func BuildRLSFunc ¶
func BuildRLSFunc(op, r, ix uint8, as uint16) Instruction
func BuildRRDFunc ¶
func BuildRRDFunc(op, r, ix uint8, as uint16) Instruction
func BuildRRSFunc ¶
func BuildRRSFunc(op, r, ix uint8, as uint16) Instruction
func BuildRZHFunc ¶
func BuildRZHFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildRZWFunc ¶
func BuildRZWFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildSDFunc ¶
func BuildSDFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildSDWFunc ¶
func BuildSDWFunc(op, r, ix uint8, as uint16) Instruction
func BuildSFSFunc ¶
func BuildSFSFunc(op, r, ix uint8, as uint16) Instruction
func BuildSHFunc ¶
func BuildSHFunc(op, r, ix uint8, as uint16) Instruction
func BuildSLAFunc ¶
func BuildSLAFunc(op, r, ix uint8, as uint16) Instruction
func BuildSLDAFunc ¶
func BuildSLDAFunc(op, r, ix uint8, as uint16) Instruction
func BuildSLDLFunc ¶
func BuildSLDLFunc(op, r, ix uint8, as uint16) Instruction
func BuildSLLFunc ¶
func BuildSLLFunc(op, r, ix uint8, as uint16) Instruction
func BuildSRAFunc ¶
func BuildSRAFunc(op, r, ix uint8, as uint16) Instruction
func BuildSRDAFunc ¶
func BuildSRDAFunc(op, r, ix uint8, as uint16) Instruction
func BuildSRDLFunc ¶
func BuildSRDLFunc(op, r, ix uint8, as uint16) Instruction
func BuildSRLFunc ¶
func BuildSRLFunc(op, r, ix uint8, as uint16) Instruction
func BuildSRSFunc ¶
func BuildSRSFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildSSFunc ¶
func BuildSSFunc(op, r1, r2 uint8, as uint16) Instruction
func BuildSTDWFunc ¶
func BuildSTDWFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildSTHFunc ¶
func BuildSTHFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildSTWFunc ¶
func BuildSTWFunc(op, r1, r2 uint8, rest uint16) Instruction
func BuildSWFunc ¶
func BuildSWFunc(op, r, ix uint8, as uint16) Instruction
func BuildXDFunc ¶
func BuildXDFunc(op, r1, r2 uint8, d uint16) Instruction
func BuildXHFunc ¶
func BuildXHFunc(op, r, ix uint8, as uint16) Instruction
func BuildXSFunc ¶
func BuildXSFunc(op, r1, r2 uint8, as uint16) Instruction
func BuildXTSFunc ¶
func BuildXTSFunc(op, r, ix uint8, as uint16) Instruction
func BuildXWFunc ¶
func BuildXWFunc(op, r, ix uint8, as uint16) Instruction
type InstructionBuilder ¶
type InstructionBuilder func(op uint8, r1, r2 uint8, rest uint16) Instruction
type MemoryBackend ¶
type MemoryBackend interface {
// Retrieve a HalfWord from the specified memory address
FetchHalfWord(uint32) uint16
// Store a HalfWord to a specific memory address, return the
// previous value stored there.
WriteHalfWord(uint32, uint16) uint16
// Retrieve a Word from the specified address and adress + 1
FetchWord(uint32) uint32
// Store a Word to the specified address (and address + 1),
// return the Word that was previously stored there.
WriteWord(uint32, uint32) uint32
}
The general interface for MemoryBackend storage.
type MemoryPlugin ¶
type MemoryPlugin struct {
Range MemoryRange
Backend MemoryBackend
}
Rgeister a given MemoryBackend as the storage backend starting at Range.Low, ending at Range.High.
type MemoryRange ¶
type MemoryRange struct {
Low, High uint32
}
A struct providing upper and lower bounds for a MemoryBackend