Beispiel #1
0
void EMips::reset()
{
#ifdef DEBUG_EXEC
  setTrace(true);
#endif
  unsigned int t;
  pc=0;
  npc=pc+4;
  ir=0;
  for(t=0;t<32;t++) { G[t]=0; }
  for(t=0;t<32;t++) { F[t]=0.0; }
  tookBranch=false; branch_address=0;
  op=0;  opName=(char *)NULL;
  top=0;  bop=0;
  opFormat=EMIPS_FORMAT_UNKNOWN; opSubFormat=0; opFlags=0;
  hasFPU=true; hasMMU=true;
  // TODO: where does a MIPS normally go on reset?
  //writeReg(25,resetEntry&0xffff0000);  // TODO: kludge!!!
  ULONG globPtr=0;
  if(map) {
    EModule *mod=map->getFirstModule();
    if(mod) {
      EMapSymbol *dataNode=mod->lookupNodeByName(".data");
      if(dataNode) globPtr=dataNode->addr;
      else DEBUG_OUT<<"Couldn't set gp, no .data node!\n";
    }
    else DEBUG_OUT<<"Couldn't set gp, no module!\n";
  }
  else DEBUG_OUT<<"Couldn't set gp, no map!\n";
  writeReg(0x1c,globPtr);
  clearStackTrace();
  ECPUAbstract::reset();
}
Beispiel #2
0
/**
 * Creates the different Modules
 * @param cmdLineArgs
 */
void createModules(Rose_STL_Container<string> &cmdLineArgs, vector<ModuleBase *> *moduleList) {

    setTrace(cmdLineArgs);

    // Parse the Meta File
    string filename = "";
    if (CommandlineProcessing::isOptionWithParameter(cmdLineArgs, "--meta", "*",filename,
            true)) {
        trace << "Filename set" << filename << std::endl;
    }
    Parser *parser = new Parser(filename);
    meta = parser->parseFile();
    trace << " Printing Meta " << endl;
    meta->print();
    trace << " Meta Processing done." << endl;

    // Array of Struct Module Check
    AOSModuleCheck *aosModuleCheck = new AOSModuleCheck(cmdLineArgs, meta);
    moduleList->push_back(aosModuleCheck);

    // Array of Struct Module
    AOSModule *aosModule = new AOSModule(cmdLineArgs, meta);
    moduleList->push_back(aosModule);

    // Hardware Optimization Module
    HaOptModule *haoptModule = new HaOptModule(cmdLineArgs, meta);
    moduleList->push_back(haoptModule);

}
Beispiel #3
0
Atm_led& Atm_led::trace( Stream& stream ) {
  setTrace( &stream, atm_serial_debug::trace,
            "LED\0EVT_ON_TIMER\0EVT_OFF_TIMER\0EVT_WT_TIMER\0EVT_COUNTER\0EVT_ON\0EVT_OFF\0EVT_"
            "BLINK\0EVT_TOGGLE\0EVT_TOGGLE_BLINK\0ELSE\0"
            "IDLE\0ON\0START\0BLINK_OFF\0LOOP\0DONE\0OFF\0WT_ON\0WT_START" );
  return *this;
}
void TimelineZoomControl::clear()
{
    m_timer.stop();
    setWindowLocked(false);
    setRange(-1, -1);
    setTrace(-1, -1);
}
Beispiel #5
0
Node<FunctionNode>::Link FunctionParser::function(bool isForeign) {
  if (isForeign) skip(); // Skip "foreign"
  Trace trace = current().trace;
  skip(); // Skip "function" or "method"
  std::string ident = "";
  FunctionSignature::Arguments args {};
  std::unique_ptr<TypeInfo> returnType;
  // Is not anon func
  if (accept(TT::IDENTIFIER)) {
    ident = current().data;
    skip();
  }
  if (isForeign && ident.empty()) throw Error("SyntaxError", "Foreign functions can't be anonymous", trace);
  // Has arguments
  if (accept(TT::SQPAREN_LEFT)) {
    skip();
    args = getSigArgs();
  }
  // Has return type
  if (accept(TT::FAT_ARROW)) {
    skip();
    returnType = std::make_unique<TypeInfo>(getTypeList());
  }
  auto func = Node<FunctionNode>::make(ident, FunctionSignature(returnType == nullptr ? nullptr : *returnType, args), isForeign);
  func->setTrace(trace);
  // Only non-foreign functions have code bodies
  if (!isForeign) func->setCode(block(FUNCTION_BLOCK));
  // Foreign declarations end in semicolon
  if (isForeign) expectSemi();
  return func;
}
Beispiel #6
0
Node<MemberNode>::Link TypeParser::member(Visibility vis, bool isStatic) {
  Trace mbTrace = current().trace;
  auto parsedAsDecl = declaration();
  auto mbNode = Node<MemberNode>::make(parsedAsDecl->getIdentifier(), parsedAsDecl->getTypeInfo().getEvalTypeList(), isStatic, vis == INVALID ? PRIVATE : vis);
  mbNode->setTrace(mbTrace);
  if (parsedAsDecl->getChildren().size() > 0) mbNode->setInit(Node<ExpressionNode>::staticPtrCast(parsedAsDecl->removeChild(0)));
  return mbNode;
}
Beispiel #7
0
TR_LoadExtensions::TR_LoadExtensions(TR::OptimizationManager *manager)
   : TR::Optimization(manager),
     excludedNodes(NULL), loadExtensionPreference(NULL)
   {
   setTrace(comp()->getOptions()->getOptsToTrace() != NULL && TR::SimpleRegex::match(comp()->getOptions()->getOptsToTrace(), "traceLoadExtensions"));

   cg()->getExtendedToInt64GlobalRegisters().Clear();
   }
Beispiel #8
0
Atm_fade& Atm_fade::trace( Stream& stream ) {
#ifndef TINYMachine
  setTrace( &stream, atm_serial_debug::trace,
            "FADE\0EVT_CNT_FADE\0EVT_TM_FADE\0EVT_TM_ON\0EVT_TM_OFF\0EVT_CNT_RPT\0EVT_ON\0EVT_OFF\0EVT_"
            "BLINK\0ELSE\0IDLE\0ON\0START\0STARTU\0UP\0STARTD\0DOWN\0REPEAT" );
#endif
  return *this;
}
Beispiel #9
0
Node<MethodNode>::Link TypeParser::method(Visibility vis, bool isStatic, bool isForeign) {
  Trace methTrace = current().trace;
  auto parsedAsFunc = function(isForeign);
  auto methNode = Node<MethodNode>::make(parsedAsFunc->getIdentifier(), parsedAsFunc->getSignature(), vis, isStatic);
  methNode->setTrace(methTrace);
  if (isForeign) {
    expectSemi();
  } else {
    methNode->setCode(Node<BlockNode>::staticPtrCast(parsedAsFunc->removeChild(0)));
  }
  return methNode;
}
Beispiel #10
0
Node<DeclarationNode>::Link DeclarationParser::declarationFromTypes(TypeList typeList) {
  Token identToken = current();
  skip();
  auto decl = Node<DeclarationNode>::make(identToken.data, typeList);
  decl->setTrace(identToken.trace);
  // Do initialization only if it exists
  if (accept("=")) {
    skip();
    decl->setInit(expression());
  }
  return decl;
}
Beispiel #11
0
void EArm::reset()
{
#ifdef DEBUG_EXEC
  setTrace(true);
#endif
  breakpoint=0xffffffff;  // since we start at 0, breakpoint's default
  intLock=false;
  pc=0;  // Jump to zero
  cpsr=0;
  clearStackTrace();
  ECPUAbstract::reset();
}
AdvancedOptionsWidget::AdvancedOptionsWidget( QWidget *parent ) :
	OptionsDialogPage( parent ),
	ui( new Ui::AdvancedOptionsWidget ) {
	ui->setupUi( this );

	connect( ui->labelTrace, SIGNAL( clicked() ), this, SLOT( setTrace() ) );
	connect( ui->labelDebug, SIGNAL( clicked() ), this, SLOT( setDebug() ) );
	connect( ui->labelInfo, SIGNAL( clicked() ), this, SLOT( setInfo() ) );
	connect( ui->labelWarn, SIGNAL( clicked() ), this, SLOT( setWarn() ) );
	connect( ui->labelError, SIGNAL( clicked() ), this, SLOT( setError() ) );
	connect( ui->labelFatal, SIGNAL( clicked() ), this, SLOT( setFatal() ) );

	ui->loggingLevel->setValue( QsLogging::Logger::instance().loggingLevel() );
}
Beispiel #13
0
void EHitachi::reset()
{
#ifdef DEBUG_EXEC
    setTrace(true);
#endif
    breakpoint=0xffff;  // since we start at 0, breakpoint's default
    intLock=false;
    for(unsigned int t=0; t<8; t++) {
        R[t]=0;
    }
    sp=0;  // NOTE: R7 is sp!
    pc=0;  // Jump to zero
    ccr=0;
    clearStackTrace();
    ECPUAbstract::reset();
}
Beispiel #14
0
void Ez80::reset()
{
#ifdef DEBUG_EXEC
  setTrace(true);
#endif
  breakpoint=0xffff;  // since we start at 0, breakpoint's default
  ix=0;  iy=0;  sp=0;
  a=0;  f=0;
  b=0;  c=0;  d=0;  e=0;  h=0;  l=0;
  a1=0;  f1=0;
  b1=0;  c1=0;  d1=0;  e1=0;  h1=0;  l1=0;
  i=0;
  intLock=false;
  pc=0;  // Jump to zero
  clearStackTrace();
  ECPUAbstract::reset();
}
bool CasmReader::hasBinaryHeader(std::shared_ptr<Queue> Binary,
                                 std::shared_ptr<SymbolTable> AlgSymtab) {
  // Note: This is inefficent, but at least works.
  auto Inflator = std::make_shared<InflateAst>();
  InterpreterFlags Flags;
  Interpreter MyReader(std::make_shared<ByteReader>(Binary), Inflator, Flags,
                       AlgSymtab);
  if (TraceRead || TraceTree) {
    auto Trace = std::make_shared<TraceClass>("CasmInterpreter");
    Trace->setTraceProgress(true);
    MyReader.setTrace(Trace);
    if (TraceTree)
      Inflator->setTrace(Trace);
  }
  MyReader.algorithmStartHasFileHeader();
  MyReader.algorithmReadBackFilled();
  return !MyReader.errorsFound();
}
Beispiel #16
0
Node<ConstructorNode>::Link TypeParser::constructor(Visibility vis, bool isForeign) {
  Trace constrTrace = current().trace;
  skip(); // Skip "constructor"
  FunctionSignature::Arguments args {};
  // Has arguments
  if (accept(TT::SQPAREN_LEFT)) {
    skip();
    args = getSigArgs();
  }
  auto constr = Node<ConstructorNode>::make(args, vis == INVALID ? PUBLIC : vis, isForeign);
  constr->setTrace(constrTrace);
  if (isForeign) {
    expectSemi();
  } else {
    constr->setCode(block(FUNCTION_BLOCK));    
  }
  return constr;
}
Beispiel #17
0
Node<BranchNode>::Link IfStatementParser::ifStatement() {
  auto branch = Node<BranchNode>::make();
  branch->setTrace(current().trace);
  branch->setCondition(expression());
  branch->setSuccessBlock(block(IF_BLOCK));
  skip(-1); // Go back to the block termination token
  if (accept(TT::ELSE)) {
    skip();
    // Else-if structure
    if (accept(TT::IF)) {
      skip();
      branch->setFailiureBlock(ifStatement());
    // Simple else block
    } else if (accept(TT::DO)) {
      branch->setFailiureBlock(block(CODE_BLOCK));
    } else {
      throw Error("SyntaxError", "Else must be followed by a block or an if statement", current().trace);
    }
  }
  return branch;
}
Beispiel #18
0
ASTNode::Link StatementParser::statement() {
  if (accept(TT::TYPE)) {
    return type();
  } else if (accept(TT::IF)) {
    skip();
    return ifStatement();
  } else if (accept(TT::FOR)) {
    auto loop = Node<LoopNode>::make();
    loop->setTrace(current().trace);
    skip(); // Skip "for"
    loop->setInit(declaration(false));
    expectSemi();
    loop->setCondition(expression(false));
    expectSemi();
    loop->setUpdate(expression(false));
    loop->setCode(block(CODE_BLOCK));
    return loop;
  } if (accept(TT::WHILE)) {
    skip(); // Skip "while"
    auto loop = Node<LoopNode>::make();
    loop->setTrace(current().trace);
    loop->setCondition(expression());
    loop->setCode(block(CODE_BLOCK));
    return loop;
  } else if (accept(TT::DO)) {
    return block(CODE_BLOCK);
  } else if (accept(TT::DEFINE)) {
    auto decl = declaration();
    expectSemi();
    return decl;
  } else if (accept(TT::IDENTIFIER)) {
    skip();
    if (accept(TT::IDENTIFIER) || accept(",")) {
      skip(-1); // Go back to the prev identifier
      auto decl = declaration();
      expectSemi();
      return decl;
    } else {
      skip(-1); // Get the entire expression
      auto e = expression();
      expectSemi();
      return e;
    }
  } else if (accept(TT::BREAK)) {
    skip();
    return Node<BreakLoopNode>::make();
  } else if (accept(TT::CONTINUE)) {
    throw InternalError("Unimplemented", {METADATA_PAIRS, {"token", "loop continue"}});
  } else if (accept(TT::RETURN)) {
    auto trace = current().trace;
    skip(); // Skip "return"
    auto retValue = expression(false);
    expectSemi();
    auto retNode = Node<ReturnNode>::make();
    retNode->setTrace(trace);
    if (retValue != nullptr) retNode->setValue(retValue);
    return retNode;
  } else if (accept(TT::FUNCTION)) {
    return function();
  } else if (accept(TT::FOREIGN)) {
    return function(true);
  } else {
    auto e = expression();
    expectSemi();
    return e;
  }
}
Beispiel #19
0
Node<ExpressionNode>::Link ExpressionParser::expressionImpl(Node<ExpressionNode>::Link lhs, int minPrecedence) {
  Node<ExpressionNode>::Link base = nullptr;
  
  Node<ExpressionNode>::Link lastExpr = nullptr;
  Token tok = current();
  if (acceptEndOfExpression()) return lhs;
  if (lhs != nullptr) {
    skip(-1);
    auto tt = current().type;
    skip(1);
    // If we have any of:
    // IDENTIFIER, C_PAREN_RIGHT, postfix ops
    // before a paren, it's a function call
    auto isCallable =
      tt == TT::IDENTIFIER ||
      tt == TT::PAREN_RIGHT ||
      (tt == TT::OPERATOR && lhs->getToken().op().hasFixity(POSTFIX));
    if (accept(TT::PAREN_LEFT) && isCallable) {
      auto fCall = parseExpressionPrimary(true);
      auto args = fCall->removeChild(0);
      fCall->addChild(lhs);
      fCall->addChild(args);
      lhs = fCall;
      // If the expression finishes here, return
      if (acceptEndOfExpression()) return lhs;
      // Otherwise, update tok
      tok = current();
    }
  }
  while (tok.op().hasArity(BINARY) && tok.op().getPrec() >= minPrecedence) {
    auto tokExpr = Node<ExpressionNode>::make(tok);
    tokExpr->setTrace(tok.trace);
    tokExpr->addChild(lhs);
    skip();
    auto rhs = parseExpressionPrimary();
    tok = current();
    while (tok.isOp() && tok.op().hasArity(BINARY) &&
      (
        tok.op().getPrec() <= tokExpr->getToken().op().getPrec() ||
        (tok.op().getPrec() == tokExpr->getToken().op().getPrec() && tok.op().hasAsoc(ASSOCIATE_FROM_RIGHT))
      )
    ) {
      tokExpr->addChild(rhs);
      tokExpr = expressionImpl(tokExpr, tok.op().getPrec());
      rhs = nullptr;
      tok = current();
    }
    lhs = rhs;
    if (base == nullptr) {
      base = lastExpr = tokExpr;
    } else {
      lastExpr->addChild(tokExpr);
      lastExpr = tokExpr;
    }
    if (acceptEndOfExpression()) break;
  }
  if (base == nullptr) {
    base = lhs;
  } else if (lhs != nullptr) {
    lastExpr->addChild(lhs);
  }
  return base;
}
Beispiel #20
0
Node<ExpressionNode>::Link ExpressionParser::exprFromCurrent() {
  auto e = Node<ExpressionNode>::make(current());
  e->setTrace(current().trace);
  return e;
}