static set_error_t set_dbranch(void *dont_care, conf_object_t *obj, attr_value_t *val, attr_value_t *idx) { id_splitter_t *ids = (id_splitter_t *)obj; timing_model_interface_t *timing_interface; if (val->kind != Sim_Val_Object) return Sim_Set_Need_Object; ids->dbranch = val->u.object; timing_interface = SIM_get_interface(ids->dbranch, "timing-model"); if (!timing_interface) { pr("object `%s' has no timing interface\n", ids->dbranch->name); return Sim_Set_Interface_Not_Found; } ids->dbranch_if = *timing_interface; if (ids->dbranch_if.operate == NULL) { pr("object `%s' doesn't export the operate function!\n", ids->dbranch->name); return Sim_Set_Interface_Not_Found; } return Sim_Set_Ok; }
void ruby_set_g3_reg(conf_object_t *cpu, lang_void *parameter){ int proc_num = SIM_get_proc_no(cpu); sparc_v9_interface_t * m_v9_interface = (sparc_v9_interface_t *) SIM_get_interface(cpu, SPARC_V9_INTERFACE); for(int set=0; set < 4; set++) { for(int i=0; i <8; i++) { int registerNumber = i; uinteger_t value = m_v9_interface->read_global_register((conf_object_t *)cpu, set, registerNumber); cout << "ruby_set_g3_reg BEFORE: proc =" << proc_num << " GSET = " << set << " GLOBAL_REG = " << i << " VALUE = " << value << endl; } } uinteger_t value_ptr = (uinteger_t) parameter; int g3_regnum = SIM_get_register_number(cpu, "g3"); SIM_write_register(cpu, g3_regnum, (uinteger_t) value_ptr); cout << endl; for(int set=0; set < 4; set++) { for(int i=0; i <8; i++) { int registerNumber = i; uinteger_t value = m_v9_interface->read_global_register((conf_object_t *)cpu, set, registerNumber); cout << "ruby_set_g3_reg AFTER: proc =" << proc_num << " GSET = " << set << " GLOBAL_REG = " << i << " VALUE = " << value << endl; } } }
/* timing model */ static set_error_t set_timing_model(void *dont_care, conf_object_t *obj, attr_value_t *val, attr_value_t *idx) { trans_splitter_t *ts = (trans_splitter_t *) obj; if (val->kind == Sim_Val_Nil) { ts->tm_ifc = NULL; ts->timing_model = NULL; } else { /* get the timing model interface */ ts->tm_ifc = SIM_get_interface(val->u.object, TIMING_MODEL_INTERFACE); if (SIM_clear_exception()) { SIM_log_error(&ts->log, 0, "set_timing_model: " "object does not provide the " "timing model interface."); return Sim_Set_Illegal_Value; } ts->timing_model = val->u.object; } return Sim_Set_Ok; }
static set_error_t set_timing_model_attribute(void *dont_care, conf_object_t *obj, attr_value_t *val, attr_value_t *idx) { consistency_controller_object_t *cc = (consistency_controller_object_t *)obj; conf_object_t *next; /* accept nil as input to cancel the next timing model */ if (val->kind == Sim_Val_Nil) { cc->next_level_object = NULL; cc->next_level_timing_interface = NULL; } else { if (val->kind != Sim_Val_Object) return Sim_Set_Need_Object; next = val->u.object; if (SIM_get_pending_exception()) { return Sim_Set_Illegal_Value; } cc->next_level_timing_interface = SIM_get_interface(next, "timing-model"); if (SIM_get_pending_exception()) { return Sim_Set_Illegal_Value; } cc->next_level_object = next; } return Sim_Set_Ok; }