Line 1... |
Line 1... |
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Filename: cpuscope.cpp
|
// Filename: cpuscope.cpp
|
//
|
//
|
// Project: XuLA2-LX25 SoC based upon the ZipCPU
|
// Project: OpenArty, an entirely open SoC based upon the Arty platform
|
//
|
//
|
// Purpose: To read out, and decompose, the results of the wishbone scope
|
// Purpose: To read out, and decompose, the results of the wishbone scope
|
// as applied to the ZipCPU internal operation.
|
// as applied to the ZipCPU internal operation.
|
//
|
//
|
// Creator: Dan Gisselquist, Ph.D.
|
// Creator: Dan Gisselquist, Ph.D.
|
Line 23... |
Line 23... |
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
// for more details.
|
// for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License along
|
// You should have received a copy of the GNU General Public License along
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
// with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
// target there if the PDF file isn't present.) If not, see
|
// target there if the PDF file isn't present.) If not, see
|
// <http://www.gnu.org/licenses/> for a copy.
|
// <http://www.gnu.org/licenses/> for a copy.
|
//
|
//
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
// http://www.gnu.org/licenses/gpl.html
|
// http://www.gnu.org/licenses/gpl.html
|
Line 51... |
Line 51... |
#include "scopecls.h"
|
#include "scopecls.h"
|
|
|
#define WBSCOPE R_CPUSCOPE
|
#define WBSCOPE R_CPUSCOPE
|
#define WBSCOPEDATA R_CPUSCOPED
|
#define WBSCOPEDATA R_CPUSCOPED
|
|
|
|
#include "zopcodes.h"
|
|
|
FPGA *m_fpga;
|
FPGA *m_fpga;
|
void closeup(int v) {
|
void closeup(int v) {
|
m_fpga->kill();
|
m_fpga->kill();
|
exit(0);
|
exit(0);
|
}
|
}
|
Line 74... |
Line 76... |
printf("TRIG ");
|
printf("TRIG ");
|
else
|
else
|
printf(" ");
|
printf(" ");
|
if (true) {
|
if (true) {
|
if ((val & 0x40000000)==0) {
|
if ((val & 0x40000000)==0) {
|
printf("%s <- 0x.%08x", regstr[(val>>32-6)&0xf], val&0x03ffffff);
|
printf("%s <- 0x.%07x", regstr[(val>>(32-6))&0xf], val&0x03ffffff);
|
} else if ((val & 0x60000000)==0x60000000) {
|
} else if ((val & 0x60000000)==0x60000000) {
|
|
uint32_t addr = val & 0x7ffffff;
|
if (val&0x08000000)
|
if (val&0x08000000)
|
printf("MEM-W[0x........] <- 0x.%07x %s",
|
printf("MEM-W[0x........] <- 0x.%07x %s",
|
(val&0x07ffffff),
|
addr,
|
(val&0x10000000)?"(GBL)":"");
|
(val&0x10000000)?"(GBL)":"");
|
else
|
else
|
printf("MEM-R[0x.%07x] -> (Not Givn) %s",
|
printf("MEM-R[0x.%07x] -> (Not Givn) %s",
|
(val&0x07ffffff),
|
(addr<<2)&0x0ffffffc,
|
(val&0x10000000)?"(GBL)":"");
|
(val&0x10000000)?"(GBL)":"");
|
} else if ((val & 0x70000000)==0x40000000)
|
} else if ((val & 0x70000000)==0x40000000) {
|
|
val &= 0x0fffffff;
|
|
val <<= 2;
|
printf("JMP 0x%08x", (val&0x0fffffff));
|
printf("JMP 0x%08x", (val&0x0fffffff));
|
else {
|
} else {
|
int master, halt, brk, sleep, gie, buserr, trap,
|
int master, halt, brk, sleep, buserr, trap,
|
ill, clri, pfv, pfi, dcdce, dcdv, dcdstall,
|
ill, clri, pfv, pfi, dcdce, dcdv, dcdstall,
|
opce, opvalid, oppipe, aluce, alubsy, aluwr,
|
opce, opvalid, oppipe, aluce, alubsy, aluwr,
|
aluill, aluwrf, memce, memwe, membsy;
|
memce, memwe, membsy;
|
|
// int gie, aluill, aluwrf;
|
master = (val>>27)&1;
|
master = (val>>27)&1;
|
halt = (val>>26)&1;
|
halt = (val>>26)&1;
|
brk = (val>>25)&1;
|
brk = (val>>25)&1;
|
sleep = (val>>24)&1;
|
sleep = (val>>24)&1;
|
gie = (val>>23)&1;
|
// gie = (val>>23)&1;
|
buserr = (val>>22)&1;
|
buserr = (val>>22)&1;
|
trap = (val>>21)&1;
|
trap = (val>>21)&1;
|
ill = (val>>20)&1;
|
ill = (val>>20)&1;
|
clri = (val>>19)&1;
|
clri = (val>>19)&1;
|
pfv = (val>>18)&1;
|
pfv = (val>>18)&1;
|
Line 111... |
Line 117... |
opvalid= (val>>12)&1;
|
opvalid= (val>>12)&1;
|
oppipe = (val>>11)&1;
|
oppipe = (val>>11)&1;
|
aluce = (val>>10)&1;
|
aluce = (val>>10)&1;
|
alubsy = (val>> 9)&1;
|
alubsy = (val>> 9)&1;
|
aluwr = (val>> 8)&1;
|
aluwr = (val>> 8)&1;
|
aluill = (val>> 7)&1;
|
// aluill = (val>> 7)&1;
|
aluwrf = (val>> 6)&1;
|
// aluwrf = (val>> 6)&1;
|
memce = (val>> 5)&1;
|
memce = (val>> 5)&1;
|
memwe = (val>> 4)&1;
|
memwe = (val>> 4)&1;
|
membsy = (val>> 3)&1;
|
membsy = (val>> 3)&1;
|
printf("FLAGS %08x", val);
|
printf("FLAGS %08x", val);
|
printf(" CE[%c%c%c%c]",
|
printf(" CE[%c%c%c%c]",
|
Line 212... |
Line 218... |
FPGAOPEN(m_fpga);
|
FPGAOPEN(m_fpga);
|
|
|
signal(SIGSTOP, closeup);
|
signal(SIGSTOP, closeup);
|
signal(SIGHUP, closeup);
|
signal(SIGHUP, closeup);
|
|
|
CPUSCOPE *scope = new CPUSCOPE(m_fpga, WBSCOPE, false);
|
CPUSCOPE *scope = new CPUSCOPE(m_fpga, WBSCOPE, true);
|
if (!scope->ready()) {
|
if (!scope->ready()) {
|
printf("Scope is not yet ready:\n");
|
printf("Scope is not yet ready:\n");
|
scope->decode_control();
|
scope->decode_control();
|
scope->decode(WBSCOPEDATA);
|
scope->decode(WBSCOPEDATA);
|
printf("\n");
|
printf("\n");
|
} else
|
} else {
|
|
printf("Scope is ready\n");
|
scope->read();
|
scope->read();
|
|
}
|
delete m_fpga;
|
delete m_fpga;
|
}
|
}
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|