From 753adb38d5471d23315d1bcfc6a744d1c6e03975 Mon Sep 17 00:00:00 2001 From: Korey Sewell Date: Fri, 22 Jun 2007 19:03:42 -0400 Subject: mips import pt. 1 src/arch/mips/SConscript: "mips import pt.1". --HG-- extra : convert_revision : 2e393341938bebf32fb638a209262d074fad4cc1 --- src/arch/mips/isa/formats/branch.isa | 54 +++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'src/arch/mips/isa/formats/branch.isa') diff --git a/src/arch/mips/isa/formats/branch.isa b/src/arch/mips/isa/formats/branch.isa index a67f04dca..e959e4c1b 100644 --- a/src/arch/mips/isa/formats/branch.isa +++ b/src/arch/mips/isa/formats/branch.isa @@ -36,6 +36,7 @@ output header {{ #include + using namespace std; /** * Base class for instructions whose disassembly is not purely a @@ -216,7 +217,7 @@ output decoder {{ } }}; -def format Branch(code,*opt_flags) {{ +def format Branch(code, *opt_flags) {{ not_taken_code = ' NNPC = NNPC;\n' not_taken_code += '} \n' @@ -230,13 +231,13 @@ def format Branch(code,*opt_flags) {{ not_taken_code = ' NPC = NNPC;\n' not_taken_code += ' NNPC = NNPC + 4;\n' not_taken_code += '} \n' - inst_flags = ('IsCondDelaySlot', ) + inst_flags += ('IsCondDelaySlot', ) else: inst_flags += (x, ) #Take into account uncond. branch instruction - if 'cond == 1' in code: - inst_flags += ('IsUnCondControl', ) + if 'cond = 1' in code: + inst_flags += ('IsUncondControl', ) else: inst_flags += ('IsCondControl', ) @@ -254,6 +255,51 @@ def format Branch(code,*opt_flags) {{ exec_output = BasicExecute.subst(iop) }}; +def format DspBranch(code, *opt_flags) {{ + not_taken_code = ' NNPC = NNPC;\n' + not_taken_code += '} \n' + + #Build Instruction Flags + #Use Link & Likely Flags to Add Link/Condition Code + inst_flags = ('IsDirectControl', ) + for x in opt_flags: + if x == 'Link': + code += 'R31 = NNPC;\n' + elif x == 'Likely': + not_taken_code = ' NPC = NNPC;\n' + not_taken_code += ' NNPC = NNPC + 4;\n' + not_taken_code += '} \n' + inst_flags += ('IsCondDelaySlot', ) + else: + inst_flags += (x, ) + + #Take into account uncond. branch instruction + if 'cond = 1' in code: + inst_flags += ('IsUncondControl', ) + else: + inst_flags += ('IsCondControl', ) + + #Declaration code + decl_code = 'bool cond;\n' + decl_code += 'uint32_t dspctl;\n' + + #Fetch code + fetch_code = 'dspctl = DSPControl;\n' + + #Condition code + code = decl_code + fetch_code + code + code += 'if (cond) {\n' + code += ' NNPC = NPC + disp;\n' + code += '} else {\n' + code += not_taken_code + + iop = InstObjParams(name, Name, 'Branch', code, inst_flags) + header_output = BasicDeclare.subst(iop) + decoder_output = BasicConstructor.subst(iop) + decode_block = BasicDecode.subst(iop) + exec_output = BasicExecute.subst(iop) +}}; + def format Jump(code, *opt_flags) {{ #Build Instruction Flags #Use Link Flag to Add Link Code -- cgit v1.2.3