예제 #1
0
파일: soc.c 프로젝트: zmj64351508/ARMUE
uint32_t run_soc(soc_t* soc)
{
    cpu_t *cpu = soc->cpu[0];

    if(config.gdb_debug){
        LOG(LOG_DEBUG, "last pc is %x\n", cpu->run_info.last_pc);
        if(cpu->run_info.halting == MAYBE){
            /* The break operation code is set by debugger. So the last operation code executed
               should be a break trap set by the debugger. That means we should re-execute the
               operation code in that address. Restore last PC value to the PC can do such thing.*/
            if(is_sw_breakpoint(soc->stub, cpu->run_info.last_pc)){
                cpu->run_info.halting = TRUE;
                cpu->set_raw_pc(cpu->run_info.last_pc, cpu);
            }
            // The break operation code is directly wrote in the program
            else{
                cpu->run_info.halting = FALSE;
            }
        }

        if(soc->stub->status == RSP_STEP){
            cpu->run_info.halting = TRUE;
        }

        /* cpu halting for debug */
        while(cpu->run_info.halting){
            handle_rsp(soc->stub, cpu);
        }
    }

    /* store last pc */
    cpu->run_info.last_pc = cpu->get_raw_pc(cpu);

    /* basic steps to run a single operation code */
    uint32_t opcode   = cpu->fetch32(cpu);
    ins_t    ins_info = cpu->decode(cpu, &opcode);
                        cpu->excute(cpu, ins_info);


    add_cycle(cpu);
    check_timer(cpu);

    /* check peripheral input every 100 */
    pmp_parsed_pkt_t pmp_pkt;
    int result;
    if(config.client && reach_check_point(cpu)){
        core_connect_t *peri_connect = armue_get_peri_connect(cpu);
        bool_t has_input = pmp_check_input(peri_connect);
        if(has_input){
            // start input parsing loop
            pmp_parse_loop(peri_connect){
                result = pmp_parse_input(peri_connect, &pmp_pkt);
                if(result >= 0){
                    dispatch_peri_event(&pmp_pkt);
                }
            }
            peri_connect->recv_buf[peri_connect->recv_len] = '\0';
            LOG(LOG_INFO, "Peripheral packet type[%d] received: %s\n", pmp_pkt.pkt_kind, peri_connect->recv_buf);
        }
        updata_check_point(cpu, 10);
    }
QualitativeParameter::QualitativeParameter(std::vector<QString> * _enumeration,QDateTime _datetime,QWidget * parent)
	: QDialog(parent)
{
	this->enumeration=new std::vector<QString>();
	enumeration=_enumeration;
	this->dateTime=_datetime;
	this->labelvalue = new QLabel(tr("Value :"));
	this->labelunit = new QLabel(tr("Unit :"));
	labelEdit = new QLineEdit;
	addCycle = new QPushButton(tr("&+"));
	this->addCycle->setEnabled(false);
	addCycle->setCheckable(true);
	removeCycle = new QPushButton(tr("&-"));
	this->removeCycle->setEnabled(false);
	connect(removeCycle,SIGNAL(clicked()),this,SLOT(remove_cycle()));
	connect(addCycle,SIGNAL(clicked()),this,SLOT(add_cycle()));
	this->counter=0;
	this->counter_row=0;
	this->_time=new QDateTimeEdit;
	this->_time->setDisplayFormat("hh:mm:ss");
	this->values=new QComboBox;
	this->unit=new QComboBox;
	this->title=new QLabel("                              Quality Context");
	this->title->setStyleSheet("background-color: white;border-style: outset;border-width: 2px;border-color: beige;");
	this->labelvalue->setBuddy(values);
	this->labelunit->setBuddy(unit);
	_value=new QRadioButton("Fixed Value");
	_cycle=new QRadioButton("Cycle Value");
	_value->setChecked(true);
	this->okButton =new QPushButton(tr("OK"));
	this->okButton->setDefault(true);
	this->okButton->setEnabled(false);
	this->cancelButton = new QPushButton(tr("Cancel"));

	connect(values,SIGNAL(currentIndexChanged(QString)),this,SLOT(enabledOkButton(QString)));
	connect(values,SIGNAL(activated(int)),labelvalue,SLOT(show()));
	connect(okButton,SIGNAL(clicked()),this,SLOT(OkClicked()));

	QVBoxLayout * topleftLayout = new QVBoxLayout;
	QHBoxLayout * topleftLayout1 = new QHBoxLayout;
	topleftLayout1->addWidget(labelvalue);
	topleftLayout1->addWidget(values);
	QHBoxLayout * topleftLayout2 = new QHBoxLayout;
	topleftLayout2->addWidget(labelunit);
	topleftLayout2->addWidget(unit);
	topleftLayout->addLayout(topleftLayout1);
	topleftLayout->addLayout(topleftLayout2);
	QHBoxLayout * bottomLeftLayout = new QHBoxLayout;
	bottomLeftLayout->addWidget(_value);
	bottomLeftLayout->addWidget(_cycle);
	QVBoxLayout * leftLayout = new QVBoxLayout;
	leftLayout->addLayout(topleftLayout);
	leftLayout->addLayout(bottomLeftLayout);
	extension = new QWidget;
	connect(_cycle,SIGNAL(toggled(bool)),extension,SLOT(setVisible(bool)));
	connect(_cycle,SIGNAL(toggled(bool)),this,SLOT(inactive_value(bool)));
	QGridLayout *extensionLayout = new QGridLayout;
	extensionLayout->setSizeConstraint(QLayout::SetFixedSize);
	extensionLayout->addWidget(_time,counter_row,0);
	QLabel * tmp_label = new QLabel(tr("value :"));
	QComboBox * tmp_text = new QComboBox;
	for(std::vector<QString>::iterator it=this->enumeration->begin();it!=this->enumeration->end();++it){
		tmp_text->addItem((*it));
	}
	tmp_label->setBuddy(tmp_text);
	counter++;
	extensionLayout->addWidget(tmp_label,counter_row,1);
	counter++;
	extensionLayout->addWidget(tmp_text,counter_row,2);

	extension->setLayout(extensionLayout);
	//extension->setFixedHeight(sizeHint().height());
	QVBoxLayout * rightLayout = new QVBoxLayout;
	rightLayout->addWidget(this->cancelButton);
	rightLayout->addWidget(this->okButton);
	rightLayout->addWidget(this->addCycle);
	rightLayout->addWidget(this->removeCycle);
	rightLayout->addStretch();

	QHBoxLayout * mainLayout = new QHBoxLayout;
	mainLayout->addLayout(leftLayout);
	mainLayout->addLayout(rightLayout);
	QVBoxLayout * supermainlayout=new QVBoxLayout;
	supermainlayout->addWidget(this->title);
	supermainlayout->addLayout(mainLayout);
	supermainlayout->addWidget(extension);
	setLayout(supermainlayout);
	setWindowTitle(tr("qualitative tuning"));
	//setFixedHeight((sizeHint().height()));
	this->setStyleSheet("QDialog  { border-color: black; color: red;  border-style: outset;border-width: 2px;height: 5px;background-color: rgb(235,230,234); }");

	setMaximumHeight(400);
	extension->hide();


}