Line 1... |
Line 1... |
///////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Filename: zipdbg.cpp
|
// Filename: zipdbg.cpp
|
//
|
//
|
// Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
// Project: XuLA2-LX25 SoC based upon the ZipCPU
|
//
|
|
// Purpose:
|
|
//
|
//
|
|
// Purpose: Provide a debugger to step through the ZipCPU assembler,
|
|
// evaluate the ZipCPU's current state, modify registers as(if)
|
|
// needed, etc. All of this through the JTAG port of the XuLA2 board.
|
//
|
//
|
// Creator: Dan Gisselquist, Ph.D.
|
// Creator: Dan Gisselquist, Ph.D.
|
// Gisselquist Tecnology, LLC
|
// Gisselquist Technology, LLC
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
// Copyright (C) 2015, Gisselquist Technology, LLC
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
//
|
//
|
// This program is free software (firmware): you can redistribute it and/or
|
// This program is free software (firmware): you can redistribute it and/or
|
// modify it under the terms of the GNU General Public License as published
|
// modify it under the terms of the GNU General Public License as published
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
// your option) any later version.
|
// your option) any later version.
|
Line 22... |
Line 23... |
// This program is distributed in the hope that it will be useful, but WITHOUT
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
// 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
|
|
// 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
|
|
// <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
|
//
|
//
|
//
|
//
|
///////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
|
//
|
//
|
//
|
//
|
// BUGS:
|
// BUGS:
|
// - No ability to verify CPU functionality (3rd party simulator)
|
// - No ability to verify CPU functionality (3rd party simulator)
|
// - No ability to set/clear breakpoints
|
// - No ability to set/clear breakpoints
|
//
|
//
|
//
|
//
|
//
|
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <signal.h>
|
#include <signal.h>
|
#include <time.h>
|
#include <time.h>
|
#include <unistd.h>
|
#include <unistd.h>
|
#include <string.h>
|
#include <string.h>
|
Line 152... |
Line 156... |
|
|
m_state.m_smem[0].m_a = m_state.m_sp;
|
m_state.m_smem[0].m_a = m_state.m_sp;
|
for(int i=1; i<5; i++)
|
for(int i=1; i<5; i++)
|
m_state.m_smem[i].m_a = m_state.m_smem[i-1].m_a+1;
|
m_state.m_smem[i].m_a = m_state.m_smem[i-1].m_a+1;
|
for(int i=0; i<5; i++) {
|
for(int i=0; i<5; i++) {
|
|
m_state.m_smem[i].m_valid = true;
|
|
if (m_state.m_smem[i].m_a < 0x2000)
|
|
m_state.m_smem[i].m_valid = false;
|
|
else if (m_state.m_smem[i].m_a < 0x4000)
|
|
m_state.m_smem[i].m_valid = false;
|
|
else if (m_state.m_smem[i].m_a < 0x800000)
|
|
m_state.m_smem[i].m_valid = false;
|
|
else if (m_state.m_smem[i].m_a < 0x1000000)
|
|
m_state.m_smem[i].m_valid = true;
|
|
else
|
|
m_state.m_smem[i].m_valid = false;
|
|
if (m_state.m_smem[i].m_valid)
|
try {
|
try {
|
m_state.m_smem[i].m_d = readio(m_state.m_smem[i].m_a);
|
m_state.m_smem[i].m_d = readio(m_state.m_smem[i].m_a);
|
m_state.m_smem[i].m_valid = true;
|
m_state.m_smem[i].m_valid = true;
|
} catch(BUSERR be) {
|
} catch(BUSERR be) {
|
m_state.m_smem[i].m_valid = false;
|
m_state.m_smem[i].m_valid = false;
|