예제 #1
0
파일: psim.c 프로젝트: kywe665/ECEn-324
/* Report system state */
static void sim_report() 
{

#ifdef HAS_GUI
    if (gui_mode) {
	report_pc(f_pc, pc_curr->exception != EXC_BUBBLE,
		  if_id_curr->stage_pc, if_id_curr->exception != EXC_BUBBLE,
		  id_ex_curr->stage_pc, id_ex_curr->exception != EXC_BUBBLE,
		  ex_mem_curr->stage_pc, ex_mem_curr->exception != EXC_BUBBLE,
		  mem_wb_curr->stage_pc, mem_wb_curr->exception != EXC_BUBBLE);
	report_state("F", 0, format_pc(pc_next));
	report_state("F", 1, format_pc(pc_curr));
	report_state("D", 0, format_if_id(if_id_next));
	report_state("D", 1, format_if_id(if_id_curr));
	report_state("E", 0, format_id_ex(id_ex_next));
	report_state("E", 1, format_id_ex(id_ex_curr));
	report_state("M", 0, format_ex_mem(ex_mem_next));
	report_state("M", 1, format_ex_mem(ex_mem_curr));
	report_state("W", 0, format_mem_wb(mem_wb_next));
	report_state("W", 1, format_mem_wb(mem_wb_curr));
	/* signal_sources(); */
	show_cc(cc);
	show_cpi();
    }
#endif

}
bool
export_stream_reader::
next() {

    if (_isp==0) return false;

    _isp->getline(_line_buf,_line_buf_size);

    if (! *_isp) {
        if (_isp->eof()) { // normal eof:
            _is_line_set=false;
            return false;
        }

        std::ostringstream oss;
        oss << "ERROR: Unexpected read failure in export_stream_reader.next(). Current object state:\n";
        oss << "\texport_stream_label: " << name() << "\n";
        oss << "\tfailed attempting to read export_line_no: " << (_line_no+1) << "\n";
        if ((! _isp->bad()) && ((strlen(_line_buf)+1) == _line_buf_size)) {
            oss << "\texport line length possibly exceeded line buffer size of: " << (_line_buf_size-1) << "\n";
        }
        throw blt_exception(oss.str().c_str());
    }

    try {
        _is_line_set=true;
        _line_no++;
        _elp.set_export_line(_line_buf);
    } catch (const blt_exception&) {
        log_os << "ERROR:: Exception caught in export_stream_reader.next() Current object state:\n";
        report_state(log_os);
        throw;
    }
    return true;
}
예제 #3
0
파일: vscale.c 프로젝트: timburrow/ovj3
static void
update_callback(Panel_item, int, Event *)
{
    settings_update();
    func_update();
    report_state();
}
예제 #4
0
/* main tick */
void mxchipWNet_HA_tick(void)
{
  mxchipTick();
  if (!is_wifi_disalbed()) {
    if (is_network_state(STA_CONNECT) == 0 && is_network_state(UAP_START) == 0) {
      if (MS_TIMER > uap_start_time) {
        uap_start();
      }
    }

    if(is_network_state(STA_CONNECT) && cloud_enable && MS_TIMER > cloud_retry)
      connect_to_cloud();

    tcp_recv_tick();
  }
  
  if(need_report){
    report_state();
    need_report = 0;
  }

  if (need_reload == 1) {
    msleep(500);
    NVIC_SystemReset();
  }
}
예제 #5
0
파일: vscale.c 프로젝트: timburrow/ovj3
static void
uflow_callback(Menu menu, Menu_item mi)
{
    int cmi = (int)xv_get(mi, MENU_VALUE);
    if (cmi<0){
	cmi = vsi.default_vsfunc->lookup->table[0];
    }
    vsi.uflow_cmi = vsi.default_vsfunc->uflow_cmi = cmi;
    report_state();
}
예제 #6
0
static void
report(int num, const char *state, int expected, int got, int res,
    int res_expected)
{

	if (res != res_expected) {
		printf("not ok %-2d", num);
		report_state(state);
		printf("poll result %d expected %d. ",
		    res, res_expected);
	} else {
		if (expected == got)
			printf("ok %-2d    ", num);
		else
			printf("not ok %-2d", num);
		report_state(state);
	}
	printf("expected %s; got %s\n", decode_events(expected),
	    decode_events(got));
	fflush(stdout);
}
예제 #7
0
파일: ssim.c 프로젝트: kywe665/ECEn-324
/* Report system state */
static void sim_report() {

#ifdef HAS_GUI
    if (gui_mode) {
	report_pc(pc);
	if (plusmode) {
	    report_state("PREV", format_prev());
	    report_state("PC", format_pc());
	} else {
	    report_state("OPC", format_pc());
	}
	report_state("F", format_f());
	report_state("D", format_d());
	report_state("E", format_e());
	report_state("M", format_m());
	if (!plusmode) {
	    report_state("NPC", format_npc());
	}
	show_cc(cc);
    }
#endif// HAS_GUI

}
예제 #8
0
파일: vscale.c 프로젝트: timburrow/ovj3
static void
canvas_event_proc(Xv_Window, Event *event)
{
    int i;
    register int x, y;		// location of mouse pointer on canvas
    float fx;			// Normalized location of mouse on canvas
    float fy;
    register int x0, y0;
    float dis;
    static int knot = -1;	// Which knot mouse controls (-1=>none)
    static float mctl = 0.5;	// Relative Y distance of ctl point from here
    static float fyother = 0;	// Y position of other line end

    x = (int) event_x(event);
    y = (int) event_y(event);
    fx = (float)x / (vsi.canvas_width - 1);
    fy = (float)(vsi.canvas_height - 1 - y) / (vsi.canvas_height - 1);

    switch (event_action(event)){
      case ACTION_SELECT:
      case ACTION_ADJUST:
	if (event_is_down(event)){
	    /*fprintf(stderr,"%.4f, %.4f, k=%.3f\n",
		    fx, fy, knot2logparm(fx, fy));/*CMP*/
	    /* Find out which knot we want to change */
	    /* See if mouse pointer <= 2 * G_APERTURE pixels from a knot. */
	    int tst = 4 * G_APERTURE * G_APERTURE;
	    knot = -1;
	    for (i=0; i<vsi.nknots[vsi.myknots]; i++){
		x0 = (int)(vsi.knotlists[vsi.myknots][i].x
			   * (vsi.canvas_width - 1) + 0.5);
		y0 = (int)(vsi.canvas_height
			   * (1-vsi.knotlists[vsi.myknots][i].y) + 0.5);
		if ((dis=(x-x0)*(x-x0) + (y-y0)*(y-y0)) <= tst){
		    knot = i;
		    tst = dis;
		}
	    }
	    if (vsi.myknots == LIN_KNOTS || vsi.myknots == SPL_KNOTS){
		if (event_action(event) == ACTION_SELECT){
		    if (knot < 0){
			knot = create_knot(fx, fy);
		    }
		}else{		// ACTION_ADJUST
		    // Cannot delete end points
		    if (knot > 0 && knot < vsi.nknots[vsi.myknots]-1){
			delete_knot(knot);
		    }
		    knot = -1;
		}
	    }else if (vsi.myknots == CRV_KNOTS){
		// Remember relative position of control knot
		if (knot == 0){
		    fyother = vsi.knotlists[vsi.myknots][2].y;
		}else if (knot == 2){
		    fyother = vsi.knotlists[vsi.myknots][0].y;
		}
		if (fabs(fyother - fy) > 5.0 / (1 + vsi.canvas_height)){
		    mctl = ((vsi.knotlists[vsi.myknots][1].y - fy)
			    / (fyother-fy));
		}
	    }
	}else{
	    /* (event_is_up) */
	    set_func_command();
	    func_update();
	    report_state();	// Notify client of new settings
	    knot = -1;
	    return;
	}
	break;

      case LOC_DRAG:
	if (knot == -1){
	    return;
	}
	break;

      default:
	return;
    }

    // Apply constraints to adjustment of knots
    if (fy < 0){ // Always stay on canvas
	fy = 0;
    }else if (fy > 1){
	fy = 1;
    }
    if (vsi.myknots == CRV_KNOTS){ // Special contraints for these
	if (knot == 0 || knot == 2){
	    // Keep control knot between end points
	    /*fprintf(stderr,"knot=%d, mctl=%f, fyother=%f, fy=%f\n",
		    knot, mctl, fyother, fy);/*CMP*/
	    vsi.knotlists[vsi.myknots][1].y = fy + mctl * (fyother - fy);
	}else if (knot == 1){
	    fy = bound(fy,
		       vsi.knotlists[vsi.myknots][0].y,
		       vsi.knotlists[vsi.myknots][2].y);
	}
    }
    if (knot > 0 && knot < vsi.nknots[vsi.myknots] - 1){
	// Knots cannot move past neighbors in x direction
	if (fx <= vsi.knotlists[vsi.myknots][knot-1].x){
	    fx = (vsi.knotlists[vsi.myknots][knot-1].x
		  + 1.0 / (vsi.canvas_width - 1));
	}else if (fx >= vsi.knotlists[vsi.myknots][knot+1].x){
	    fx = (vsi.knotlists[vsi.myknots][knot+1].x
		  - 1.0 / (vsi.canvas_width - 1));
	}
	vsi.knotlists[vsi.myknots][knot].x = fx;
	vsi.knotlists[vsi.myknots][knot].y = fy;
    }else if (knot == 0){	// First knot stays at left edge
	vsi.knotlists[vsi.myknots][knot].x = 0;
	vsi.knotlists[vsi.myknots][knot].y = fy;
    }else if (knot == vsi.nknots[vsi.myknots] - 1){ // Last knot at right edge
	vsi.knotlists[vsi.myknots][knot].x = 1;
	vsi.knotlists[vsi.myknots][knot].y = fy;
    }
    func_update();
}