42#ifndef included_Retro_Rw11Cpu
43#define included_Retro_Rw11Cpu 1
50#include <condition_variable>
68 typedef std::map<std::string, std::shared_ptr<Rw11Cntl>>
cmap_t;
70 explicit Rw11Cpu(
const std::string& type);
82 const std::string&
Type()
const;
84 uint16_t
Base()
const;
85 uint16_t
IBase()
const;
99 void AddCntl(
const std::shared_ptr<Rw11Cntl>& spcntl);
100 bool TestCntl(
const std::string& name)
const;
101 void ListCntl(std::vector<std::string>& list)
const;
106 std::string
NextCntlName(
const std::string& base)
const;
117 const std::vector<uint16_t>& block);
119 std::vector<uint16_t>&& block);
127 uint16_t* buf,
size_t size,
129 bool singleblk=
false);
131 const uint16_t* buf,
size_t size,
133 bool singleblk=
false);
135 void ExecWibr(uint16_t ibaddr0, uint16_t data0,
136 uint16_t ibaddr1=0, uint16_t data1=0,
137 uint16_t ibaddr2=0, uint16_t data2=0);
140 bool MemRead(uint16_t addr, std::vector<uint16_t>& data,
142 bool MemWrite(uint16_t addr,
const std::vector<uint16_t>& data,
149 uint16_t& start,
bool trace=
false);
150 bool Boot(
const std::string& uname,
RerrMsg& emsg);
177 virtual void Dump(std::ostream& os,
int ind=0,
const char* text=0,
185 static const uint16_t
kCPAL = 0x0004;
186 static const uint16_t
kCPAH = 0x0005;
189 static const uint16_t
kCPR0 = 0x0008;
190 static const uint16_t
kCPPC = 0x000f;
static const uint8_t kBBit06
static const uint16_t kWBit06
static const uint16_t kWBit01
static const uint16_t kWBit08
static const uint16_t kWBit09
static const uint16_t kWBit00
static const uint16_t kWBit03
static const uint8_t kBBit07
static const uint8_t kBBit04
static const uint16_t kWBit07
static const uint8_t kBBit05
static const uint16_t kWBit02
static const uint16_t kITSTAT
IT.STAT reg offset.
static const uint16_t kMEMLOSIZE
MEM LOSIZE address.
static const uint8_t kStat_M_CmdMErr
stat: cmdmerr flag
static const uint16_t kCPURUST_STEP
cpu was stepped
bool HasPcnt() const
FIXME_docs.
static const uint16_t kPCDATA
PC.DATA reg offset.
static const uint16_t kCPURUST_VECFET
vector fetch halt
static const uint16_t kHBSTAT
HB.STAT reg offset.
const RlinkAddrMap & IAddrMap() const
FIXME_docs.
bool HasIbmon() const
FIXME_docs.
static const uint16_t kCPUUBMAP
UBMAP base address.
static const uint16_t kIISTADR
II.ADR reg offset.
void SetCpuActDown(uint16_t stat)
FIXME_docs.
static const uint16_t kMEMCNTRL
MEM CNTRL address.
static const uint16_t kCPURUST_RUNS
cpu running
uint16_t Base() const
FIXME_docs.
bool fHasIbtst
has ibtst (ibus tester)
static const uint16_t kHBHILIM
HB.HILIM reg offset.
static const uint16_t kIMSTAT
IM.STAT reg offset.
void Setup(Rw11 *pw11)
FIXME_docs.
static const uint16_t kKWPCTR
KWP.CTR reg offset.
static const uint16_t kCPMEM
CPMEM reg offset.
Rw11Cpu(const Rw11Cpu &)=delete
void SetupOpt()
FIXME_docs.
static const uint16_t kMMUPDRU
MMU PDRU address.
static const uint16_t kITBASE
Ibtst ibus address.
std::condition_variable fCpuActCond
static const uint16_t kCPUPIRQ
CPU PIRQ address.
static const uint16_t kCMIREG
CM.IREG reg offset.
static const uint16_t kCPFUNC_STOP
STOP func code.
bool fHasIist
has iist (smp comm)
static const uint16_t kCPR0
CPR0 reg offset.
static const uint16_t kKWPCSB
KWP.CSB reg offset.
void IAddrMapClear()
FIXME_docs.
bool Boot(const std::string &uname, RerrMsg &emsg)
FIXME_docs.
static const uint16_t kCPFUNC_NOOP
NOOP func code.
static const uint16_t kIMLOLIM
IM.LOLIM reg offset.
static const uint16_t kIMADDR
IM.ADDR reg offset.
RlinkConnect & Connect() const
FIXME_docs.
static const uint16_t kCPMEMBE_M_BE
membe: be field
static const uint16_t kSCBASE
DMSCNT reg base offset.
bool CpuAct() const
FIXME_docs.
static const uint16_t kHBNMAX
DMHBPT max number units.
Rw11Cpu & operator=(const Rw11Cpu &)=delete
void AllIAddrMapInsert(const std::string &name, uint16_t ibaddr)
FIXME_docs.
uint16_t ExecRibr(uint16_t ibaddr)
FIXME_docs.
static const uint16_t kIMHILIM
IM.HILIM reg offset.
static const uint16_t kCPMEMBE_M_BE0
membe: be0 flag
static const uint16_t kCPSTAT_M_CpuGo
cpugo mask
void RAddrMapClear()
FIXME_docs.
void ListCntl(std::vector< std::string > &list) const
FIXME_docs.
static const uint16_t kCPSTAT_M_SuspInt
suspint mask
static const uint16_t kMMUPDRS
MMU PDRS address.
static const uint16_t kCPURUST_SFAIL
sequencer failure
static const uint16_t kCMIPC
CM.IPC reg offset.
uint16_t IBase() const
FIXME_docs.
static const uint16_t kCPAH
CPAH reg offset.
bool fHasM9312
has m9312 (boot rom)
void SetCpuActUp()
FIXME_docs.
static const uint16_t kIMDATA
IM.DATA reg offset.
static const uint16_t kCPFUNC_STEP
STEP func code.
int AddRbibr(RlinkCommandList &clist, uint16_t ibaddr, size_t size)
FIXME_docs.
static const uint16_t kHBLOLIM
HB.LOLIM reg offset.
static const uint16_t kCPCONF
CPCONF reg offset.
static const uint16_t kCPSTAT_B_CpuRust
cpurust bit mask
uint16_t fHasHbpt
has dmhbpt (hardware breakpoint)
static const uint16_t kPCBASE
DMPCNT reg base offset.
RlinkAddrMap fRAddrMap
rbus name<->address mapping
RlogFile & LogFile() const
FIXME_docs.
static const uint16_t kCPAL
CPAL reg offset.
std::string NextCntlName(const std::string &base) const
FIXME_docs.
bool HasM9312() const
FIXME_docs.
RlinkServer & Server() const
FIXME_docs.
static const uint16_t kCMIADDR
CM.IADDR reg offset.
static const uint16_t kMEMHIADDR
MEM HIADDR address.
static const uint16_t kMMUMMR0
MMU MMR0 address.
static const uint16_t kCMDATA
CM.DATA reg offset.
bool IAddrMapInsert(const std::string &name, uint16_t ibaddr)
FIXME_docs.
bool HasIbtst() const
FIXME_docs.
static const uint16_t kCPURUST_VFAIL
vmbox failure
static const uint16_t kCPPSW
CPPSW reg offset.
void ModLalh(RlinkCommandList &clist, size_t ind, uint32_t addr, uint16_t mode=kCPAH_M_22BIT)
FIXME_docs.
static const uint16_t kSCCNTL
SC.CNTL reg offset.
static const uint16_t kCMADDR
CM.ADDR reg offset.
static const uint16_t kCPFUNC_RESUME
RESUME func code.
static const uint16_t kCPUSTKLIM
CPU STKLIM address.
static const uint16_t kHBBASE
DMHBPT reg base offset.
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
bool HasKw11p() const
FIXME_docs.
static const uint16_t kCPFUNC_CRESET
CRESET func code.
int AddLalh(RlinkCommandList &clist, uint32_t addr, uint16_t mode=kCPAH_M_22BIT)
FIXME_docs.
uint16_t HasHbpt() const
FIXME_docs.
static const uint16_t kCPURUST_SUSP
cpu was suspended
static const uint16_t kITDATA
IT.DATA reg offset.
size_t Index() const
FIXME_docs.
void SetupStd()
FIXME_docs.
static const uint16_t kCPMEMBE_M_STICK
membe: sticky flag
static const uint16_t kCPSTAT_M_CmdMErr
cmdmerr mask
static const uint16_t kCPURUST_RECRSV
rec red-stack halt
static const uint16_t kCPURUST_STOP
cpu was stopped
bool fHasIbmon
has ibmon (ibus monitor)
static const uint16_t kIISTBASE
IIST ibus address.
static const uint16_t kCPSTAT_M_CmdErr
cmderr mask
static const uint16_t kMEMLOADDR
MEM LOADDR address.
uint32_t fMemSize
memory size in byte
static const uint16_t kPCSTAT
PC.STAT reg offset.
static const uint16_t kKWPCSR
KWP.CSR reg offset.
static const uint16_t kCPFUNC_BRESET
BRESET func code.
bool fHasScnt
has dmscnt (state counter)
static const uint16_t kMMUPDRK
MMU PDRK address.
int AddWMem(RlinkCommandList &clist, uint32_t addr, const uint16_t *buf, size_t size, uint16_t mode=kCPAH_M_22BIT, bool singleblk=false)
FIXME_docs.
static const uint16_t kCPURUST_HALT
cpu executed HALT
static const uint16_t kCPURUST_RESET
cpu was reset
static const uint8_t kStat_M_CpuGo
stat: cpugo flag
bool HasKw11l() const
FIXME_docs.
static const uint16_t kCPUERR
CPU CPUERR address.
static const uint16_t kCPAH_M_22BIT
ena 22bit addressing
static const uint16_t kPCCNTL
PC.CNTL reg offset.
bool LoadAbs(const std::string &fname, RerrMsg &emsg, uint16_t &start, bool trace=false)
FIXME_docs.
static const uint16_t kITFIFO
IT.FIFO reg offset.
static const uint16_t kCPUSDREG
CPU SDREG address.
uint32_t MemSize() const
FIXME_docs.
int AddRMem(RlinkCommandList &clist, uint32_t addr, uint16_t *buf, size_t size, uint16_t mode=kCPAH_M_22BIT, bool singleblk=false)
FIXME_docs.
static const uint16_t kMEMHISIZE
MEM HISIZE address.
void ExecWibr(uint16_t ibaddr0, uint16_t data0, uint16_t ibaddr1=0, uint16_t data1=0, uint16_t ibaddr2=0, uint16_t data2=0)
FIXME_docs.
static const uint8_t kStat_M_CmdErr
stat: cmderr flag
static const uint16_t kMEMMAINT
MEM MAINT address.
bool ProbeCntl(Rw11Probe &dsc)
FIXME_docs.
bool MemWriteByte(uint32_t addr, uint8_t data, RerrMsg &emsg)
FIXME_docs.
bool IAddrMapErase(const std::string &name)
FIXME_docs.
int AddMembe(RlinkCommandList &clist, uint16_t be, bool stick=false)
FIXME_docs.
bool HasIist() const
FIXME_docs.
bool fHasPcnt
has dmpcnt (perf counters)
Rw11Cntl & Cntl(const std::string &name) const
FIXME_docs.
static const uint16_t kCPAH_M_ADDR
mask for 6bit msb
static const uint16_t kMMUPARK
MMU PARK address.
static const uint16_t kCPUMBRK
CPU MBRK address.
uint16_t IbusRemoteAddr(uint16_t ibaddr) const
FIXME_docs.
const RlinkAddrMap & RAddrMap() const
FIXME_docs.
static const uint16_t kCPSTAT_V_CpuRust
cpurust shift
std::map< std::string, std::shared_ptr< Rw11Cntl > > cmap_t
bool MemRead(uint16_t addr, std::vector< uint16_t > &data, size_t nword, RerrMsg &emsg)
FIXME_docs.
static const uint16_t kHBCNTL
HB.CNTL reg offset.
static const uint16_t kHBSIZE
DMHBPT unit size.
static const uint16_t kIMBASE
Ibmon ibus address.
Rw11 & W11() const
FIXME_docs.
static const uint16_t kCPSTAT_M_CpuRust
cpurust mask
static const uint16_t kCPMEMBE_M_BE1
membe: be1 flag
cmap_t fCntlMap
name->cntl map
static const uint16_t kCPPC
CPPC reg offset.
static const uint16_t kCPFUNC_START
START func code.
static const uint16_t kCPMEMI
CPMEMI reg offset.
bool HasScnt() const
FIXME_docs.
static const uint16_t kCPMEMBE
CPMEMBE reg offset.
virtual ~Rw11Cpu()
Destructor.
bool HasCmon() const
FIXME_docs.
void AddCntl(const std::shared_ptr< Rw11Cntl > &spcntl)
FIXME_docs.
bool fHasKw11l
has kw11-l (line clock)
int AddWibr(RlinkCommandList &clist, uint16_t ibaddr, uint16_t data)
FIXME_docs.
static const uint16_t kSCADDR
SC.ADDR reg offset.
static const uint16_t kM9BASE
M9312 ibus address.
int WaitCpuActDown(const Rtime &tout, Rtime &twait)
FIXME_docs.
Rw11Cpu()
default ctor blocker
static const uint8_t kStat_M_CpuSusp
stat: cpususp flag
void W11AttnHandler()
FIXME_docs.
static const uint16_t kMMUMMR3
MMU MMR3 address.
static const uint16_t kCPUPSW
CPU PSW address.
RlinkAddrMap fIAddrMap
ibus name<->address mapping
static const uint16_t kMMUPARU
MMU PARU address.
bool MemWrite(uint16_t addr, const std::vector< uint16_t > &data, RerrMsg &emsg)
FIXME_docs.
static const uint16_t kCPUSYSID
CPU SYSID address.
static const uint16_t kKWLBASE
KW11-L ibus address.
static const uint16_t kCPURUST_INIT
cpu in init state
static const uint16_t kMMUMMR2
MMU MMR2 address.
bool RAddrMapErase(const std::string &name)
FIXME_docs.
int AddRibr(RlinkCommandList &clist, uint16_t ibaddr)
FIXME_docs.
static const uint16_t kCMBASE
DMCMON reg base offset.
static const uint16_t kCPAH_M_UBM22
ubmap+22bit
uint16_t CpuStat() const
FIXME_docs.
void AllRAddrMapInsert(const std::string &name, uint16_t rbaddr)
FIXME_docs.
static const uint16_t kMMUMMR1
MMU MMR1 address.
static const uint16_t kCMIMAL
CM.IMAL reg offset.
bool RAddrMapInsert(const std::string &name, uint16_t rbaddr)
FIXME_docs.
static const uint16_t kKWPBASE
KW11-P ibus address.
int AddWbibr(RlinkCommandList &clist, uint16_t ibaddr, const std::vector< uint16_t > &block)
FIXME_docs.
static const uint16_t kITCNTL
IT.CNTL reg offset.
static const uint16_t kCPSTAT
CPSTAT reg offset.
static const uint16_t kSCDATA
SC.DATA reg offset.
static const uint16_t kIISTACR
II.ACR reg offset.
static const uint16_t kCPSTAT_M_SuspExt
suspext mask
static const uint16_t kMMUPARS
MMU PARS address.
static const uint16_t kCPCNTL
CPADDR reg offset.
bool fHasCmon
has dmcmon (cpu monitor)
static const uint16_t kCMCNTL
CM.CNTL reg offset.
bool fHasKw11p
has kw11-p (prog clock)
Rstats & Stats()
FIXME_docs.
static const uint16_t kCPSTAT_M_CpuSusp
cpususp mask
static const uint16_t kCMSTAT
CM.STAT reg offset.
static const uint16_t kCPAH_M_UBMAP
ena ubmap
static const uint16_t kMEMHM
MEM HM address.
static const uint16_t kCPURUST_HBPT
cpu hardware bpt
static const uint16_t kCPFUNC_SUSPEND
SUSPEND func code.
static const uint16_t kMEMSYSERR
MEM SYSERR address.
static const uint16_t kIMCNTL
IM.CNTL reg offset.
bool TestCntl(const std::string &name) const
FIXME_docs.
const std::string & Type() const
FIXME_docs.
Declaration of class ReventLoop.