summaryrefslogtreecommitdiff
path: root/arch/sparc/isa/formats/mem.isa
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-04-06 14:52:44 -0400
committerGabe Black <gblack@eecs.umich.edu>2006-04-06 14:52:44 -0400
commit6d8d6d15cdf5547740afbd41efe7c0f1d62079f3 (patch)
treead61b78dd531bd4696f00aeda36ff97b145622a2 /arch/sparc/isa/formats/mem.isa
parenta4b31e8f6b3c8ea33a5dad3e194c9865b92b0962 (diff)
downloadgem5-6d8d6d15cdf5547740afbd41efe7c0f1d62079f3.tar.xz
Fixed up the isa description. Also added some capability to the isa_parser in the InstObjParams constructor.
arch/isa_parser.py: Expanded the capability of the InstObjParams constructor to allow adding in extra keys for use in templates. These are added as key, value tuples as optional arguements. arch/sparc/isa/base.isa: arch/sparc/isa/formats/mem.isa: arch/sparc/isa/formats/priv.isa: The genCompositeIop function is no longer needed, as this functionality is now in the InstObjParams constructor. arch/sparc/isa/decoder.isa: Fixed up alot of instructions, and fixed indentation. arch/sparc/isa/formats/integerop.isa: The genCompositeIop function is no longer needed, as this functionality is now in the InstObjParams constructor. Also changed the immediate values to be signed. base/traceflags.py: Added SPARC traceflag configs/test/hello_sparc: Recompiled without -mflat cpu/cpu_exec_context.cc: Used the regfile clear function rather than memsetting to 0. --HG-- extra : convert_revision : b9da6f264f3ebc4ce1815008dfff7f476b247ee9
Diffstat (limited to 'arch/sparc/isa/formats/mem.isa')
-rw-r--r--arch/sparc/isa/formats/mem.isa53
1 files changed, 44 insertions, 9 deletions
diff --git a/arch/sparc/isa/formats/mem.isa b/arch/sparc/isa/formats/mem.isa
index 8c9d21c01..db2a4aaaa 100644
--- a/arch/sparc/isa/formats/mem.isa
+++ b/arch/sparc/isa/formats/mem.isa
@@ -37,7 +37,7 @@ output header {{
std::string generateDisassembly(Addr pc,
const SymbolTable *symtab) const;
- int imm;
+ int32_t imm;
};
}};
@@ -46,7 +46,7 @@ output decoder {{
const SymbolTable *symtab) const
{
std::stringstream response;
- bool load = (_numDestRegs == 1);
+ bool load = flags[IsLoad];
printMnemonic(response, mnemonic);
if(!load)
@@ -72,7 +72,7 @@ output decoder {{
const SymbolTable *symtab) const
{
std::stringstream response;
- bool load = (_numDestRegs == 1);
+ bool load = flags[IsLoad];
printMnemonic(response, mnemonic);
if(!load)
@@ -102,7 +102,9 @@ def template MemExecute {{
%(op_decl)s;
%(op_rd)s;
%(ea_code)s;
+ %(load)s;
%(code)s;
+ %(store)s;
if(fault == NoFault)
{
@@ -114,16 +116,49 @@ def template MemExecute {{
}
}};
-// Primary format for memory instructions:
-def format Mem(code, *opt_flags) {{
+let {{
+ # Leave memAccessFlags at 0 for now
+ loadString = "xc->read(EA, (uint%(width)s_t&)Mem, 0);"
+ storeString = "uint64_t write_result = 0; \
+ xc->write((uint%(width)s_t)Mem, EA, 0, &write_result);"
+
+ def doMemFormat(code, load, store, name, Name, opt_flags):
addrCalcReg = 'EA = Rs1 + Rs2;'
addrCalcImm = 'EA = Rs1 + SIMM13;'
- iop = genCompositeIop(code, name, Name, 'Mem',
- opt_flags, ea_code=addrCalcReg)
- iop_imm = genCompositeIop(code, name, Name + 'Imm', 'MemImm',
- opt_flags, ea_code=addrCalcImm)
+ iop = InstObjParams(name, Name, 'Mem', code,
+ opt_flags, ("ea_code", addrCalcReg),
+ ("load", load), ("store", store))
+ iop_imm = InstObjParams(name, Name + 'Imm', 'MemImm', code,
+ opt_flags, ("ea_code", addrCalcImm),
+ ("load", load), ("store", store))
header_output = BasicDeclare.subst(iop) + BasicDeclare.subst(iop_imm)
decoder_output = BasicConstructor.subst(iop) + BasicConstructor.subst(iop_imm)
decode_block = ROrImmDecode.subst(iop)
exec_output = MemExecute.subst(iop) + MemExecute.subst(iop_imm)
+ return (header_output, decoder_output, exec_output, decode_block)
+}};
+
+def format Load(code, width, *opt_flags) {{
+ (header_output,
+ decoder_output,
+ exec_output,
+ decode_block) = doMemFormat(code,
+ loadString % {"width":width}, '', name, Name, opt_flags)
+}};
+
+def format Store(code, width, *opt_flags) {{
+ (header_output,
+ decoder_output,
+ exec_output,
+ decode_block) = doMemFormat(code, '',
+ storeString % {"width":width}, name, Name, opt_flags)
+}};
+
+def format LoadStore(code, width, *opt_flags) {{
+ (header_output,
+ decoder_output,
+ exec_output,
+ decode_block) = doMemFormat(code,
+ loadString % {"width":width}, storeString % {"width":width},
+ name, Name, opt_flags)
}};