/****************************************************************************** ** FILE: simple.fs ** Basic sparc instruction simulator (with in-order pipeline simulation). */ #include "sparc_v9.fs" #include "pipeline.fs" fun initialize() { R4(14,system?start_sp); return (system?start_pc, system?start_pc + 4, 0?cvt(cwp_t), pipe); } val init = initialize(); fun main(pc, npc, cwp, _pipe : Pipe) { // Copy arguments to global variables PC = pc; nPC = npc; CWP = cwp; pipe = _pipe; srcQ?clear(); storeQ?clear(); destQ?clear(); address = 0; nPC2 = nPC + 4; // default next nPC PC?exec(); // execute instruction instructions = instructions + 1?cvt(ullong); init = (nPC, nPC2, CWP, pipe); }