2006-02-10 05:02:38 +01:00
|
|
|
// -*- mode:c++ -*-
|
|
|
|
|
|
|
|
// Copyright (c) 2003-2005 The Regents of The University of Michigan
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met: redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer;
|
|
|
|
// redistributions in binary form must reproduce the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer in the
|
|
|
|
// documentation and/or other materials provided with the distribution;
|
|
|
|
// neither the name of the copyright holders nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived from
|
|
|
|
// this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2006-06-01 01:26:56 +02:00
|
|
|
//
|
|
|
|
// Authors: Steve Reinhardt
|
2006-02-10 05:02:38 +01:00
|
|
|
|
2006-05-29 05:26:15 +02:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Unimplemented instructions
|
|
|
|
//
|
|
|
|
|
2006-02-10 05:02:38 +01:00
|
|
|
output header {{
|
|
|
|
/**
|
|
|
|
* Static instruction class for unimplemented instructions that
|
|
|
|
* cause simulator termination. Note that these are recognized
|
|
|
|
* (legal) instructions that the simulator does not support; the
|
|
|
|
* 'Unknown' class is used for unrecognized/illegal instructions.
|
|
|
|
* This is a leaf class.
|
|
|
|
*/
|
|
|
|
class FailUnimplemented : public AlphaStaticInst
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Constructor
|
2006-03-03 21:28:25 +01:00
|
|
|
FailUnimplemented(const char *_mnemonic, ExtMachInst _machInst)
|
2006-02-10 05:02:38 +01:00
|
|
|
: AlphaStaticInst(_mnemonic, _machInst, No_OpClass)
|
|
|
|
{
|
|
|
|
// don't call execute() (which panics) if we're on a
|
|
|
|
// speculative path
|
|
|
|
flags[IsNonSpeculative] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
%(BasicExecDeclare)s
|
|
|
|
|
|
|
|
std::string
|
|
|
|
generateDisassembly(Addr pc, const SymbolTable *symtab) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for unimplemented instructions that cause a warning
|
|
|
|
* to be printed (but do not terminate simulation). This
|
|
|
|
* implementation is a little screwy in that it will print a
|
|
|
|
* warning for each instance of a particular unimplemented machine
|
|
|
|
* instruction, not just for each unimplemented opcode. Should
|
|
|
|
* probably make the 'warned' flag a static member of the derived
|
|
|
|
* class.
|
|
|
|
*/
|
|
|
|
class WarnUnimplemented : public AlphaStaticInst
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
/// Have we warned on this instruction yet?
|
|
|
|
mutable bool warned;
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// Constructor
|
2006-03-03 21:28:25 +01:00
|
|
|
WarnUnimplemented(const char *_mnemonic, ExtMachInst _machInst)
|
2006-02-10 05:02:38 +01:00
|
|
|
: AlphaStaticInst(_mnemonic, _machInst, No_OpClass), warned(false)
|
|
|
|
{
|
|
|
|
// don't call execute() (which panics) if we're on a
|
|
|
|
// speculative path
|
|
|
|
flags[IsNonSpeculative] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
%(BasicExecDeclare)s
|
|
|
|
|
|
|
|
std::string
|
|
|
|
generateDisassembly(Addr pc, const SymbolTable *symtab) const;
|
|
|
|
};
|
|
|
|
}};
|
|
|
|
|
|
|
|
output decoder {{
|
|
|
|
std::string
|
|
|
|
FailUnimplemented::generateDisassembly(Addr pc,
|
|
|
|
const SymbolTable *symtab) const
|
|
|
|
{
|
|
|
|
return csprintf("%-10s (unimplemented)", mnemonic);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string
|
|
|
|
WarnUnimplemented::generateDisassembly(Addr pc,
|
|
|
|
const SymbolTable *symtab) const
|
|
|
|
{
|
|
|
|
#ifdef SS_COMPATIBLE_DISASSEMBLY
|
|
|
|
return csprintf("%-10s", mnemonic);
|
|
|
|
#else
|
|
|
|
return csprintf("%-10s (unimplemented)", mnemonic);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
output exec {{
|
2006-02-22 02:10:40 +01:00
|
|
|
Fault
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
FailUnimplemented::execute(CPU_EXEC_CONTEXT *xc,
|
2006-02-10 05:02:38 +01:00
|
|
|
Trace::InstRecord *traceData) const
|
|
|
|
{
|
|
|
|
panic("attempt to execute unimplemented instruction '%s' "
|
|
|
|
"(inst 0x%08x, opcode 0x%x)", mnemonic, machInst, OPCODE);
|
2006-02-24 07:51:45 +01:00
|
|
|
return new UnimplementedOpcodeFault;
|
2006-02-10 05:02:38 +01:00
|
|
|
}
|
|
|
|
|
2006-02-22 02:10:40 +01:00
|
|
|
Fault
|
arch: teach ISA parser how to split code across files
This patch encompasses several interrelated and interdependent changes
to the ISA generation step. The end goal is to reduce the size of the
generated compilation units for instruction execution and decoding so
that batch compilation can proceed with all CPUs active without
exhausting physical memory.
The ISA parser (src/arch/isa_parser.py) has been improved so that it can
accept 'split [output_type];' directives at the top level of the grammar
and 'split(output_type)' python calls within 'exec {{ ... }}' blocks.
This has the effect of "splitting" the files into smaller compilation
units. I use air-quotes around "splitting" because the files themselves
are not split, but preprocessing directives are inserted to have the same
effect.
Architecturally, the ISA parser has had some changes in how it works.
In general, it emits code sooner. It doesn't generate per-CPU files,
and instead defers to the C preprocessor to create the duplicate copies
for each CPU type. Likewise there are more files emitted and the C
preprocessor does more substitution that used to be done by the ISA parser.
Finally, the build system (SCons) needs to be able to cope with a
dynamic list of source files coming out of the ISA parser. The changes
to the SCons{cript,truct} files support this. In broad strokes, the
targets requested on the command line are hidden from SCons until all
the build dependencies are determined, otherwise it would try, realize
it can't reach the goal, and terminate in failure. Since build steps
(i.e. running the ISA parser) must be taken to determine the file list,
several new build stages have been inserted at the very start of the
build. First, the build dependencies from the ISA parser will be emitted
to arch/$ISA/generated/inc.d, which is then read by a new SCons builder
to finalize the dependencies. (Once inc.d exists, the ISA parser will not
need to be run to complete this step.) Once the dependencies are known,
the 'Environments' are made by the makeEnv() function. This function used
to be called before the build began but now happens during the build.
It is easy to see that this step is quite slow; this is a known issue
and it's important to realize that it was already slow, but there was
no obvious cause to attribute it to since nothing was displayed to the
terminal. Since new steps that used to be performed serially are now in a
potentially-parallel build phase, the pathname handling in the SCons scripts
has been tightened up to deal with chdir() race conditions. In general,
pathnames are computed earlier and more likely to be stored, passed around,
and processed as absolute paths rather than relative paths. In the end,
some of these issues had to be fixed by inserting serializing dependencies
in the build.
Minor note:
For the null ISA, we just provide a dummy inc.d so SCons is never
compelled to try to generate it. While it seems slightly wrong to have
anything in src/arch/*/generated (i.e. a non-generated 'generated' file),
it's by far the simplest solution.
2014-05-10 00:58:47 +02:00
|
|
|
WarnUnimplemented::execute(CPU_EXEC_CONTEXT *xc,
|
2006-02-10 05:02:38 +01:00
|
|
|
Trace::InstRecord *traceData) const
|
|
|
|
{
|
|
|
|
if (!warned) {
|
|
|
|
warn("instruction '%s' unimplemented\n", mnemonic);
|
|
|
|
warned = true;
|
|
|
|
}
|
|
|
|
|
Changed the fault enum into a class, and fixed everything up to work with it. Next, the faults need to be pulled out of all the other code so that they are only used to communicate between the CPU and the ISA.
SConscript:
The new faults.cc file in sim allocates the system wide faults. When these faults are generated through a function interface in the ISA, this file may go away.
arch/alpha/alpha_memory.cc:
Changed Fault to Fault * and took the underscores out of fault names.
arch/alpha/alpha_memory.hh:
Changed Fault to Fault *. Also, added an include for the alpha faults.
arch/alpha/ev5.cc:
Changed the fault_addr array into a fault_addr function. Once all of the faults can be expected to have the same type, fault_addr can go away completely and the info it provided will come from the fault itself. Also, Fault was changed to Fault *, and underscores were taken out of fault names.
arch/alpha/isa/decoder.isa:
Changed Fault to Fault * and took the underscores out fault names.
arch/alpha/isa/fp.isa:
Changed Fault to Fault *, and took the underscores out of fault names.
arch/alpha/isa/main.isa:
Changed Fault to Fault *, removed underscores from fault names, and made an include of the alpha faults show up in all the generated files.
arch/alpha/isa/mem.isa:
Changed Fault to Fault * and removed underscores from fault names.
arch/alpha/isa/unimp.isa:
arch/alpha/isa/unknown.isa:
cpu/exec_context.hh:
cpu/ozone/cpu.hh:
cpu/simple/cpu.cc:
dev/alpha_console.cc:
dev/ide_ctrl.cc:
dev/isa_fake.cc:
dev/pciconfigall.cc:
dev/pcidev.cc:
dev/pcidev.hh:
dev/tsunami_cchip.cc:
dev/tsunami_io.cc:
dev/tsunami_pchip.cc:
Changed Fault to Fault *, and removed underscores from fault names.
arch/alpha/isa_traits.hh:
Changed the include of arch/alpha/faults.hh to sim/faults.hh, since the alpha faults weren't needed.
cpu/base_dyn_inst.cc:
Changed Fault to Fault *, and removed underscores from fault names. This file probably shouldn't use the Unimplemented Opcode fault.
cpu/base_dyn_inst.hh:
Changed Fault to Fault * and took the underscores out of the fault names.
cpu/exec_context.cc:
cpu/o3/alpha_dyn_inst.hh:
cpu/o3/alpha_dyn_inst_impl.hh:
cpu/o3/fetch.hh:
dev/alpha_console.hh:
dev/baddev.hh:
dev/ide_ctrl.hh:
dev/isa_fake.hh:
dev/ns_gige.hh:
dev/pciconfigall.hh:
dev/sinic.hh:
dev/tsunami_cchip.hh:
dev/tsunami_io.hh:
dev/tsunami_pchip.hh:
dev/uart.hh:
dev/uart8250.hh:
Changed Fault to Fault *.
cpu/o3/alpha_cpu.hh:
Changed Fault to Fault *, removed underscores from fault names.
cpu/o3/alpha_cpu_impl.hh:
Changed Fault to Fault *, removed underscores from fault names, and changed the fault_addr array to the fault_addr function. Once all faults are from the ISA, this function will probably go away.
cpu/o3/commit_impl.hh:
cpu/o3/fetch_impl.hh:
dev/baddev.cc:
Changed Fault to Fault *, and removed underscores from the fault names.
cpu/o3/regfile.hh:
Added an include for the alpha specific faults which will hopefully go away once the ipr stuff is moved, changed Fault to Fault *, and removed the underscores from fault names.
cpu/simple/cpu.hh:
Changed Fault to Fault *
dev/ns_gige.cc:
Changed Fault to Fault *, and removdd underscores from fault names.
dev/sinic.cc:
Changed Fault to Fault *, and removed the underscores from fault names.
dev/uart8250.cc:
Chanted Fault to Fault *, and removed underscores from fault names.
kern/kernel_stats.cc:
Removed underscores from fault names, and from NumFaults.
kern/kernel_stats.hh:
Changed the predeclaration of Fault from an enum to a class, and changd the "fault" function to work with the classes instead of the enum. Once there are no system wide faults anymore, this code will simplify back to something like it was originally.
sim/faults.cc:
This allocates the system wide faults.
sim/faults.hh:
This declares the system wide faults.
sim/syscall_emul.cc:
sim/syscall_emul.hh:
Removed the underscores from fault names.
--HG--
rename : arch/alpha/faults.cc => sim/faults.cc
rename : arch/alpha/faults.hh => sim/faults.hh
extra : convert_revision : 253d39258237333ae8ec4d8047367cb3ea68569d
2006-02-16 07:22:51 +01:00
|
|
|
return NoFault;
|
2006-02-10 05:02:38 +01:00
|
|
|
}
|
|
|
|
}};
|
|
|
|
|
|
|
|
|
|
|
|
def format FailUnimpl() {{
|
|
|
|
iop = InstObjParams(name, 'FailUnimplemented')
|
|
|
|
decode_block = BasicDecodeWithMnemonic.subst(iop)
|
|
|
|
}};
|
|
|
|
|
|
|
|
def format WarnUnimpl() {{
|
|
|
|
iop = InstObjParams(name, 'WarnUnimplemented')
|
|
|
|
decode_block = BasicDecodeWithMnemonic.subst(iop)
|
|
|
|
}};
|
|
|
|
|
|
|
|
output header {{
|
|
|
|
/**
|
|
|
|
* Static instruction class for unknown (illegal) instructions.
|
|
|
|
* These cause simulator termination if they are executed in a
|
|
|
|
* non-speculative mode. This is a leaf class.
|
|
|
|
*/
|
|
|
|
class Unknown : public AlphaStaticInst
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/// Constructor
|
2006-03-03 21:28:25 +01:00
|
|
|
Unknown(ExtMachInst _machInst)
|
2006-02-10 05:02:38 +01:00
|
|
|
: AlphaStaticInst("unknown", _machInst, No_OpClass)
|
|
|
|
{
|
|
|
|
// don't call execute() (which panics) if we're on a
|
|
|
|
// speculative path
|
|
|
|
flags[IsNonSpeculative] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
%(BasicExecDeclare)s
|
|
|
|
|
|
|
|
std::string
|
|
|
|
generateDisassembly(Addr pc, const SymbolTable *symtab) const;
|
|
|
|
};
|
|
|
|
}};
|
|
|
|
|