Line 1... |
Line 1... |
/* sprs.c -- Simulation of OR1K special-purpose registers
|
/* sprs.c -- Simulation of OR1K special-purpose registers
|
|
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
Copyright (C) 1999 Damjan Lampret, lampret@opencores.org
|
|
Copyright (C) 2008 Embecosm Limited
|
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
|
|
This program is free software; you can redistribute it and/or modify
|
This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
|
#include <stdlib.h>
|
This program is free software; you can redistribute it and/or modify it
|
#include <stdio.h>
|
under the terms of the GNU General Public License as published by the Free
|
#include <string.h>
|
Software Foundation; either version 3 of the License, or (at your option)
|
#include <errno.h>
|
any later version.
|
|
|
#include "config.h"
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
more details.
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
/* This program is commented throughout in a fashion suitable for processing
|
|
with Doxygen. */
|
|
|
#ifdef HAVE_INTTYPES_H
|
|
#include <inttypes.h>
|
|
#endif
|
|
|
|
|
/* Autoconf and/or portability configuration */
|
|
#include "config.h"
|
#include "port.h"
|
#include "port.h"
|
#include "arch.h"
|
|
#include "abstract.h"
|
/* System includes */
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <errno.h>
|
|
|
|
/* Package includes */
|
|
#include "sprs.h"
|
#include "sim-config.h"
|
#include "sim-config.h"
|
#include "except.h"
|
#include "debug.h"
|
#include "opcode/or32.h"
|
|
#include "spr_defs.h"
|
|
#include "execute.h"
|
#include "execute.h"
|
#include "sprs.h"
|
#include "spr-defs.h"
|
#include "dcache_model.h"
|
|
#include "icache_model.h"
|
|
#include "tick.h"
|
#include "tick.h"
|
|
#include "dcache-model.h"
|
|
#include "icache-model.h"
|
#include "dmmu.h"
|
#include "dmmu.h"
|
#include "immu.h"
|
#include "immu.h"
|
|
#include "toplevel-support.h"
|
#include "pic.h"
|
#include "pic.h"
|
#include "debug.h"
|
|
|
|
DEFAULT_DEBUG_CHANNEL(spr);
|
DEFAULT_DEBUG_CHANNEL(spr);
|
DECLARE_DEBUG_CHANNEL(immu);
|
DECLARE_DEBUG_CHANNEL(immu);
|
|
|
static int audio_cnt = 0;
|
static int audio_cnt = 0;
|
Line 137... |
Line 140... |
cpu_state.delay_insn = 0;
|
cpu_state.delay_insn = 0;
|
pcnext = value + 4;
|
pcnext = value + 4;
|
}
|
}
|
break;
|
break;
|
case SPR_PICSR:
|
case SPR_PICSR:
|
if(!pic_state->edge_trigger)
|
if(!config.pic.edge_trigger)
|
cpu_state.sprs[SPR_PICSR] = prev_val;
|
cpu_state.sprs[SPR_PICSR] = prev_val;
|
break;
|
break;
|
case SPR_PICMR:
|
case SPR_PICMR:
|
if(cpu_state.sprs[SPR_SR] & SPR_SR_IEE)
|
if(cpu_state.sprs[SPR_SR] & SPR_SR_IEE)
|
pic_ints_en();
|
pic_ints_en();
|
Line 163... |
Line 166... |
PRINTF("Audio closed.\n");
|
PRINTF("Audio closed.\n");
|
sim_done();
|
sim_done();
|
break;
|
break;
|
case SPR_PMR:
|
case SPR_PMR:
|
/* PMR[SDF] and PMR[DCGE] are ignored completely. */
|
/* PMR[SDF] and PMR[DCGE] are ignored completely. */
|
if (value & SPR_PMR_SUME) {
|
if (config.pm.enabled && (value & SPR_PMR_SUME)) {
|
PRINTF ("SUSPEND: PMR[SUME] bit was set.\n");
|
PRINTF ("SUSPEND: PMR[SUME] bit was set.\n");
|
sim_done();
|
sim_done();
|
}
|
}
|
break;
|
break;
|
default:
|
default:
|