mvcpu

package
v0.0.0-...-b5de531 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MemSizeWords defines the size of MV/Em's emulated RAM in 16-bit words
	MemSizeWords = 8388608 // = 040 000 000 (8) = 0x80 0000
	// MemSizeLCPID is the code returned by the LCPID to indicate the size of RAM in half megabytes
	MemSizeLCPID = ((MemSizeWords * 2) / (256 * 1024)) - 1 // 0x3F
	// MemSizeNCLID is the code returned by NCLID to indicate size of RAM in 32Kb increments
	MemSizeNCLID = ((MemSizeWords * 2) / (32 * 1024)) - 1
)
View Source
const (
	SyscallNot  = false
	SyscallTrap = true
)

System call trap

View Source
const (
	NOVA_MEMREF = iota
	NOVA_OP
	NOVA_IO
	NOVA_MATH
	NOVA_PC
	ECLIPSE_FPU
	ECLIPSE_MEMREF
	ECLIPSE_OP
	ECLIPSE_PC
	ECLIPSE_STACK
	EAGLE_DECIMAL
	EAGLE_IO
	EAGLE_PC
	EAGLE_OP
	EAGLE_MEMREF
	EAGLE_STACK
	EAGLE_FPU
)

Instruction Types

View Source
const (
	DERR_FMT = iota
	IMM_MODE_2_WORD_FMT
	IMM_ONEACC_FMT
	IO_FLAGS_DEV_FMT
	IO_TEST_DEV_FMT
	LNDO_4_WORD_FMT
	NOACC_MODE_2_WORD_FMT
	NOACC_MODE_3_WORD_FMT
	NOACC_MODE_IMM_IND_3_WORD_FMT
	NOACC_MODE_IND_2_WORD_E_FMT
	NOACC_MODE_IND_2_WORD_X_FMT
	NOACC_MODE_IND_3_WORD_FMT
	NOACC_MODE_IND_3_WORD_XCALL_FMT
	NOACC_MODE_IND_4_WORD_FMT
	NOVA_DATA_IO_FMT
	NOVA_NOACC_EFF_ADDR_FMT
	NOVA_ONEACC_EFF_ADDR_FMT
	NOVA_TWOACC_MULT_OP_FMT
	ONEACC_IMM_2_WORD_FMT
	ONEACC_IMMWD_2_WORD_FMT
	ONEACC_IMM_3_WORD_FMT
	ONEACC_IMMDWD_3_WORD_FMT
	ONEACC_MODE_2_WORD_E_FMT
	ONEACC_MODE_2_WORD_X_B_FMT
	ONEACC_MODE_3_WORD_FMT
	ONEACC_MODE_IND_2_WORD_E_FMT
	ONEACC_MODE_IND_2_WORD_X_FMT
	ONEACC_MODE_IND_3_WORD_FMT
	ONEACC_1_WORD_FMT
	UNIQUE_1_WORD_FMT
	UNIQUE_2_WORD_FMT
	SPLIT_8BIT_DISP_FMT
	THREE_WORD_DO_FMT
	TWOACC_1_WORD_FMT
	TWOACC_IMM_2_WORD_FMT
	WIDE_DEC_SPECIAL_FMT
	WSKB_FMT
)

Instruction Formats

Variables

This section is empty.

Functions

func GetMnemonic

func GetMnemonic(i int) (mnem string)

GetMnemonic returns the mnemonic for a given opcode

func InstructionDecode

func InstructionDecode(opcode dg.WordT, pc dg.PhysAddrT, lefMode bool, ioOn bool, atuOn bool, disassemble bool, devMap devices.DeviceMapT) (*decodedInstrT, bool)

InstructionDecode decodes an opcode

func InstructionsInit

func InstructionsInit()

InstructionsInit initialises the instruction characterstics for each instruction(

func WsPop

func WsPop(cpu *CPUT) (dword dg.DwordT)

WsPop - POP a doubleword off the Wide Stack

Types

type CPUStatT

type CPUStatT struct {
	Pc              dg.PhysAddrT
	Ac              [4]dg.DwordT
	Carry, Atu, Ion bool
	InstrCount      uint64
	GoVersion       string
	GoroutineCount  int
	HostCPUCount    int
	HeapSizeMB      int
}

CPUStatT defines the data we will send to the statusCollector monitor

type CPUT

type CPUT struct {
	// contains filtered or unexported fields
}

CPUT holds the current state of a CPUT

func (*CPUT) Boot

func (cpu *CPUT) Boot(devNum int, pc dg.PhysAddrT)

Boot sets up the CPU for booting

func (*CPUT) CPUInit

func (cpu *CPUT) CPUInit(devNum int, bus *devices.BusT, statsChan chan CPUStatT)

CPUInit sets up an MV-Class CPU

func (*CPUT) CompactPrintableStatus

func (cpu *CPUT) CompactPrintableStatus() string

CompactPrintableStatus returns a concise CPU status

func (*CPUT) DisassembleRange

func (cpu *CPUT) DisassembleRange(lowAddr, highAddr dg.PhysAddrT) (disassembly string)

DisassembleRange returns a DASHER-formatted string of the disassembled specified region

func (*CPUT) Execute

func (cpu *CPUT) Execute(iPtr *decodedInstrT) (rc bool)

Execute runs a single instruction A false return means failure, the VM should stop

func (*CPUT) GetAc

func (cpu *CPUT) GetAc(ac int) (contents dg.DwordT)

GetAc is a getter for the ACs

func (*CPUT) GetAtu

func (cpu *CPUT) GetAtu() (atu bool)

GetAtu returns the current ATU setting

func (*CPUT) GetDebugLogging

func (cpu *CPUT) GetDebugLogging() (logging bool)

GetDebugLogging is a getter for the debug logging flag

func (*CPUT) GetIO

func (cpu *CPUT) GetIO(segment int) (io bool)

GetIO returns the current IO bit for a segment

func (*CPUT) GetInstrCount

func (cpu *CPUT) GetInstrCount() (ic uint64)

GetInstrCount returns the instruction-counting array

func (*CPUT) GetLef

func (cpu *CPUT) GetLef(segment int) (lef bool)

GetLef returns the current LEF mode bit

func (*CPUT) GetOVK

func (cpu *CPUT) GetOVK() bool

GetOVK is a getter for the OVK mask embedded in the PSR

func (*CPUT) GetOVR

func (cpu *CPUT) GetOVR() bool

GetOVR is a getter for the OVR flag embedded in the PSR

func (*CPUT) GetPC

func (cpu *CPUT) GetPC() (pc dg.PhysAddrT)

GetPC is a getter for the PC

func (*CPUT) GetSCPIO

func (cpu *CPUT) GetSCPIO() (scp bool)

GetSCPIO is a getter for the SCP I/O flag

func (*CPUT) GetWFP

func (cpu *CPUT) GetWFP() (wfp dg.PhysAddrT)

GetWFP is a getter for the Wide Frame Pointer

func (*CPUT) GetWSP

func (cpu *CPUT) GetWSP() (wsp dg.PhysAddrT)

GetWSP is a getter for the Wide Stack Pointer

func (*CPUT) PrepToRun

func (cpu *CPUT) PrepToRun()

PrepToRun is called prior to a normal run

func (*CPUT) PrintableStatus

func (cpu *CPUT) PrintableStatus() string

PrintableStatus returns a verbose status of the CPU

func (*CPUT) Reset

func (cpu *CPUT) Reset()

Reset sets sane initial values for a CPU

func (*CPUT) Run

func (cpu *CPUT) Run(disassembly bool,
	deviceMap devices.DeviceMapT,
	breakpoints []dg.PhysAddrT,
	inputRadix int,
	tto *devices.TtoT) (errDetail string, instrCounts [maxInstrs]int)

Run is the main activity loop for the virtual CPU

func (*CPUT) SetATU

func (cpu *CPUT) SetATU(atu bool)

SetATU is a setter for the ATU

func (*CPUT) SetAc

func (cpu *CPUT) SetAc(ac int, val dg.DwordT)

SetAc is a setter for the ACs

func (*CPUT) SetDebugLogging

func (cpu *CPUT) SetDebugLogging(logging bool)

SetDebugLogging is a setter for debug logging

func (*CPUT) SetLef

func (cpu *CPUT) SetLef(lef bool)

SetLef sets the LEF mode bit for the current (PC) segment

func (*CPUT) SetN

func (cpu *CPUT) SetN(b bool)

SetN is a setter for the FPU N flag

func (*CPUT) SetOVK

func (cpu *CPUT) SetOVK(newOVK bool)

SetOVK is a setter for the OVK flag embedded in the PSR

func (*CPUT) SetOVR

func (cpu *CPUT) SetOVR(newOVR bool)

SetOVR is a setter for the OVR flag embedded in the PSR

func (*CPUT) SetPC

func (cpu *CPUT) SetPC(addr dg.PhysAddrT)

SetPC sets the Program Counter

func (*CPUT) SetSCPIO

func (cpu *CPUT) SetSCPIO(scp bool)

SetSCPIO is a setter for the SCP I/O flag

func (*CPUT) SetZ

func (cpu *CPUT) SetZ(b bool)

SetZ is a setter for the FPU Z flag

func (*CPUT) SetupStack

func (cpu *CPUT) SetupStack(wfp, wsp, wsb, wsl, wsfh dg.PhysAddrT)

SetupStack is a group-setter for the Wide Stack

func (*CPUT) Vrun

func (cpu *CPUT) Vrun(instrCounts *[maxInstrs]int) (syscallTrap bool, errDetail string)

Vrun is a simplified runloop for a Virtual CPU It should run until a system call is encountered

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL