Esempio n. 1
0
TristateComponentState* tristate_component_state_construct (GType object_type, Connection* inputWire, Connection* controlWire, Connection* outputWire, ComponentInst** ancestry, int ancestry_length1, ComponentInst* componentInst) {
	TristateComponentState* self = NULL;
	Connection* _tmp0_;
	Connection* _tmp1_;
	Connection* _tmp2_;
	Connection* _tmp3_;
	Connection* _tmp4_;
	Connection* _tmp5_;
	Connection* _tmp6_;
	Connection* _tmp7_;
	ComponentInst** _tmp8_;
	gint _tmp8__length1;
	ComponentInst** _tmp9_;
	gint _tmp9__length1;
	ComponentInst* _tmp10_;
	ComponentInst* _tmp11_;
	g_return_val_if_fail (inputWire != NULL, NULL);
	g_return_val_if_fail (controlWire != NULL, NULL);
	g_return_val_if_fail (outputWire != NULL, NULL);
	g_return_val_if_fail (componentInst != NULL, NULL);
	self = (TristateComponentState*) component_state_construct (object_type);
	_tmp0_ = inputWire;
	_tmp1_ = _connection_ref0 (_tmp0_);
	_connection_unref0 (self->priv->inputWire);
	self->priv->inputWire = _tmp1_;
	_tmp2_ = inputWire;
	connection_set_affects (_tmp2_, (ComponentState*) self);
	_tmp3_ = controlWire;
	_tmp4_ = _connection_ref0 (_tmp3_);
	_connection_unref0 (self->priv->controlWire);
	self->priv->controlWire = _tmp4_;
	_tmp5_ = controlWire;
	connection_set_affects (_tmp5_, (ComponentState*) self);
	_tmp6_ = outputWire;
	_tmp7_ = _connection_ref0 (_tmp6_);
	_connection_unref0 (self->priv->outputWire);
	self->priv->outputWire = _tmp7_;
	_tmp8_ = ancestry;
	_tmp8__length1 = ancestry_length1;
	_tmp9_ = (_tmp8_ != NULL) ? _vala_array_dup88 (_tmp8_, _tmp8__length1) : ((gpointer) _tmp8_);
	_tmp9__length1 = _tmp8__length1;
	((ComponentState*) self)->ancestry = (_vala_array_free (((ComponentState*) self)->ancestry, ((ComponentState*) self)->ancestry_length1, (GDestroyNotify) component_inst_unref), NULL);
	((ComponentState*) self)->ancestry = _tmp9_;
	((ComponentState*) self)->ancestry_length1 = _tmp9__length1;
	_tmp10_ = componentInst;
	_tmp11_ = _component_inst_ref0 (_tmp10_);
	_component_inst_unref0 (((ComponentState*) self)->componentInst);
	((ComponentState*) self)->componentInst = _tmp11_;
	return self;
}
Esempio n. 2
0
ToggleComponentState* toggle_component_state_construct (GType object_type, Connection* outputWire, ComponentInst** ancestry, int ancestry_length1, ComponentInst* componentInst) {
	ToggleComponentState* self = NULL;
	Connection* _tmp0_ = NULL;
	Connection* _tmp1_ = NULL;
	ComponentInst** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	ComponentInst** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	ComponentInst* _tmp4_ = NULL;
	ComponentInst* _tmp5_ = NULL;
	g_return_val_if_fail (outputWire != NULL, NULL);
	g_return_val_if_fail (componentInst != NULL, NULL);
	self = (ToggleComponentState*) component_state_construct (object_type);
	_tmp0_ = outputWire;
	_tmp1_ = _connection_ref0 (_tmp0_);
	_connection_unref0 (self->priv->outputWire);
	self->priv->outputWire = _tmp1_;
	self->priv->output = FALSE;
	_tmp2_ = ancestry;
	_tmp2__length1 = ancestry_length1;
	_tmp3_ = (_tmp2_ != NULL) ? _vala_array_dup37 (_tmp2_, _tmp2__length1) : ((gpointer) _tmp2_);
	_tmp3__length1 = _tmp2__length1;
	((ComponentState*) self)->ancestry = (_vala_array_free (((ComponentState*) self)->ancestry, ((ComponentState*) self)->ancestry_length1, (GDestroyNotify) component_inst_unref), NULL);
	((ComponentState*) self)->ancestry = _tmp3_;
	((ComponentState*) self)->ancestry_length1 = _tmp3__length1;
	_tmp4_ = componentInst;
	_tmp5_ = _component_inst_ref0 (_tmp4_);
	_component_inst_unref0 (((ComponentState*) self)->componentInst);
	((ComponentState*) self)->componentInst = _tmp5_;
	return self;
}
Esempio n. 3
0
ConstantComponentState* constant_component_state_construct (GType object_type, Connection* outputWire, gboolean constantValue, ComponentInst** ancestry, int ancestry_length1, ComponentInst* componentInst) {
	ConstantComponentState* self = NULL;
	Connection* _tmp0_;
	Connection* _tmp1_;
	gboolean _tmp2_;
	ComponentInst** _tmp3_;
	gint _tmp3__length1;
	ComponentInst** _tmp4_;
	gint _tmp4__length1;
	ComponentInst* _tmp5_;
	ComponentInst* _tmp6_;
	g_return_val_if_fail (outputWire != NULL, NULL);
	g_return_val_if_fail (componentInst != NULL, NULL);
	self = (ConstantComponentState*) component_state_construct (object_type);
	_tmp0_ = outputWire;
	_tmp1_ = _connection_ref0 (_tmp0_);
	_connection_unref0 (self->priv->outputWire);
	self->priv->outputWire = _tmp1_;
	_tmp2_ = constantValue;
	self->priv->output = _tmp2_;
	_tmp3_ = ancestry;
	_tmp3__length1 = ancestry_length1;
	_tmp4_ = (_tmp3_ != NULL) ? _vala_array_dup75 (_tmp3_, _tmp3__length1) : ((gpointer) _tmp3_);
	_tmp4__length1 = _tmp3__length1;
	((ComponentState*) self)->ancestry = (_vala_array_free (((ComponentState*) self)->ancestry, ((ComponentState*) self)->ancestry_length1, (GDestroyNotify) component_inst_unref), NULL);
	((ComponentState*) self)->ancestry = _tmp4_;
	((ComponentState*) self)->ancestry_length1 = _tmp4__length1;
	_tmp5_ = componentInst;
	_tmp6_ = _component_inst_ref0 (_tmp5_);
	_component_inst_unref0 (((ComponentState*) self)->componentInst);
	((ComponentState*) self)->componentInst = _tmp6_;
	return self;
}
Esempio n. 4
0
static void or_component_state_real_update (ComponentState* base) {
	OrComponentState * self;
	gboolean output;
	Connection** _tmp0_;
	gint _tmp0__length1;
	Connection* _tmp5_;
	gboolean _tmp6_;
	self = (OrComponentState*) base;
	output = FALSE;
	_tmp0_ = self->priv->inputWires;
	_tmp0__length1 = self->priv->inputWires_length1;
	{
		Connection** inputWire_collection = NULL;
		gint inputWire_collection_length1 = 0;
		gint _inputWire_collection_size_ = 0;
		gint inputWire_it = 0;
		inputWire_collection = _tmp0_;
		inputWire_collection_length1 = _tmp0__length1;
		for (inputWire_it = 0; inputWire_it < _tmp0__length1; inputWire_it = inputWire_it + 1) {
			Connection* _tmp1_;
			Connection* inputWire = NULL;
			_tmp1_ = _connection_ref0 (inputWire_collection[inputWire_it]);
			inputWire = _tmp1_;
			{
				Connection* _tmp2_;
				gboolean _tmp3_;
				gboolean _tmp4_;
				_tmp2_ = inputWire;
				_tmp3_ = connection_get_signalState (_tmp2_);
				_tmp4_ = _tmp3_;
				if (_tmp4_ == TRUE) {
					output = TRUE;
				}
				_connection_unref0 (inputWire);
			}
		}
	}
	_tmp5_ = self->priv->outputWire;
	_tmp6_ = output;
	connection_set_signalState (_tmp5_, _tmp6_);
}
Esempio n. 5
0
ClockComponentState* clock_component_state_construct (GType object_type, Connection* outputWire, gint onFor, gint offFor, ComponentInst** ancestry, int ancestry_length1, ComponentInst* componentInst) {
	ClockComponentState* self = NULL;
	Connection* _tmp0_;
	Connection* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	ComponentInst** _tmp5_;
	gint _tmp5__length1;
	ComponentInst** _tmp6_;
	gint _tmp6__length1;
	ComponentInst* _tmp7_;
	ComponentInst* _tmp8_;
	g_return_val_if_fail (outputWire != NULL, NULL);
	g_return_val_if_fail (componentInst != NULL, NULL);
	self = (ClockComponentState*) component_state_construct (object_type);
	_tmp0_ = outputWire;
	_tmp1_ = _connection_ref0 (_tmp0_);
	_connection_unref0 (self->priv->outputWire);
	self->priv->outputWire = _tmp1_;
	_tmp2_ = onFor;
	self->priv->onFor = _tmp2_;
	_tmp3_ = offFor;
	self->priv->offFor = _tmp3_;
	_tmp4_ = offFor;
	self->priv->nextToggle = _tmp4_;
	self->priv->output = FALSE;
	_tmp5_ = ancestry;
	_tmp5__length1 = ancestry_length1;
	_tmp6_ = (_tmp5_ != NULL) ? _vala_array_dup24 (_tmp5_, _tmp5__length1) : ((gpointer) _tmp5_);
	_tmp6__length1 = _tmp5__length1;
	((ComponentState*) self)->ancestry = (_vala_array_free (((ComponentState*) self)->ancestry, ((ComponentState*) self)->ancestry_length1, (GDestroyNotify) component_inst_unref), NULL);
	((ComponentState*) self)->ancestry = _tmp6_;
	((ComponentState*) self)->ancestry_length1 = _tmp6__length1;
	_tmp7_ = componentInst;
	_tmp8_ = _component_inst_ref0 (_tmp7_);
	_component_inst_unref0 (((ComponentState*) self)->componentInst);
	((ComponentState*) self)->componentInst = _tmp8_;
	return self;
}
Esempio n. 6
0
static void clock_component_def_real_compile_component (ComponentDef* base, CompiledCircuit* compiledCircuit, ComponentInst* componentInst, Connection** connections, int connections_length1, ComponentInst** ancestry, int ancestry_length1) {
	ClockComponentDef * self;
	Connection* _tmp0_;
	Connection* outputWire;
	gint onFor = 0;
	gint offFor = 0;
	Connection** _tmp1_;
	gint _tmp1__length1;
	gint _tmp21_;
	gint _tmp22_;
	Connection* _tmp23_;
	gint _tmp24_;
	gint _tmp25_;
	ComponentInst** _tmp26_;
	gint _tmp26__length1;
	ComponentInst* _tmp27_;
	ClockComponentState* _tmp28_;
	ComponentState* componentState;
	CompiledCircuit* _tmp29_;
	GError * _inner_error_ = NULL;
	self = (ClockComponentDef*) base;
	g_return_if_fail (compiledCircuit != NULL);
	_tmp0_ = connection_new_fake ();
	outputWire = _tmp0_;
	_tmp1_ = connections;
	_tmp1__length1 = connections_length1;
	{
		Connection** connection_collection = NULL;
		gint connection_collection_length1 = 0;
		gint _connection_collection_size_ = 0;
		gint connection_it = 0;
		connection_collection = _tmp1_;
		connection_collection_length1 = _tmp1__length1;
		for (connection_it = 0; connection_it < _tmp1__length1; connection_it = connection_it + 1) {
			Connection* _tmp2_;
			Connection* connection = NULL;
			_tmp2_ = _connection_ref0 (connection_collection[connection_it]);
			connection = _tmp2_;
			{
				Connection* _tmp3_;
				WireInst* _tmp4_;
				WireInst* _tmp5_;
				ComponentInst* _tmp6_;
				PinInst** _tmp7_;
				gint _tmp7__length1;
				PinInst* _tmp8_;
				WireInst** _tmp9_;
				gint _tmp9__length1;
				WireInst* _tmp10_;
				_tmp3_ = connection;
				_tmp4_ = connection_get_wireInst (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = componentInst;
				_tmp7_ = _tmp6_->pinInsts;
				_tmp7__length1 = _tmp6_->pinInsts_length1;
				_tmp8_ = _tmp7_[0];
				_tmp9_ = _tmp8_->wireInsts;
				_tmp9__length1 = _tmp8_->wireInsts_length1;
				_tmp10_ = _tmp9_[0];
				if (_tmp5_ == _tmp10_) {
					Connection* _tmp11_;
					Connection* _tmp12_;
					_tmp11_ = connection;
					_tmp12_ = _connection_ref0 (_tmp11_);
					_connection_unref0 (outputWire);
					outputWire = _tmp12_;
				}
				_connection_unref0 (connection);
			}
		}
	}
	{
		ComponentInst* _tmp13_;
		PropertySet* _tmp14_;
		gint _tmp15_ = 0;
		gint _tmp16_;
		_tmp13_ = componentInst;
		_tmp14_ = _tmp13_->configuration;
		_tmp15_ = property_item_int_get_data_throw (_tmp14_, "On For", &_inner_error_);
		_tmp16_ = _tmp15_;
		if (_inner_error_ != NULL) {
			goto __catch18_g_error;
		}
		onFor = _tmp16_;
	}
	goto __finally18;
	__catch18_g_error:
	{
		g_clear_error (&_inner_error_);
		_inner_error_ = NULL;
		onFor = 25;
	}
	__finally18:
	if (_inner_error_ != NULL) {
		_connection_unref0 (outputWire);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	{
		ComponentInst* _tmp17_;
		PropertySet* _tmp18_;
		gint _tmp19_ = 0;
		gint _tmp20_;
		_tmp17_ = componentInst;
		_tmp18_ = _tmp17_->configuration;
		_tmp19_ = property_item_int_get_data_throw (_tmp18_, "Off For", &_inner_error_);
		_tmp20_ = _tmp19_;
		if (_inner_error_ != NULL) {
			goto __catch19_g_error;
		}
		offFor = _tmp20_;
	}
	goto __finally19;
	__catch19_g_error:
	{
		g_clear_error (&_inner_error_);
		_inner_error_ = NULL;
		offFor = 25;
	}
	__finally19:
	if (_inner_error_ != NULL) {
		_connection_unref0 (outputWire);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp21_ = onFor;
	if (_tmp21_ < 1) {
		onFor = 1;
	}
	_tmp22_ = offFor;
	if (_tmp22_ < 1) {
		offFor = 1;
	}
	_tmp23_ = outputWire;
	_tmp24_ = onFor;
	_tmp25_ = offFor;
	_tmp26_ = ancestry;
	_tmp26__length1 = ancestry_length1;
	_tmp27_ = componentInst;
	_tmp28_ = clock_component_state_new (_tmp23_, _tmp24_, _tmp25_, _tmp26_, _tmp26__length1, _tmp27_);
	componentState = (ComponentState*) _tmp28_;
	_tmp29_ = compiledCircuit;
	compiled_circuit_add_component (_tmp29_, componentState);
	_component_state_unref0 (componentState);
	_connection_unref0 (outputWire);
}
Esempio n. 7
0
static void constant_component_def_real_compile_component (ComponentDef* base, CompiledCircuit* compiledCircuit, ComponentInst* componentInst, Connection** connections, int connections_length1, ComponentInst** ancestry, int ancestry_length1) {
	ConstantComponentDef * self;
	Connection* outputWire = NULL;
	Connection* _tmp0_ = NULL;
	gchar* constantString = NULL;
	gboolean constantValue = FALSE;
	Connection** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	const gchar* _tmp19_ = NULL;
	ComponentState* componentState = NULL;
	Connection* _tmp20_ = NULL;
	gboolean _tmp21_ = FALSE;
	ComponentInst** _tmp22_ = NULL;
	gint _tmp22__length1 = 0;
	ComponentInst* _tmp23_ = NULL;
	ConstantComponentState* _tmp24_ = NULL;
	CompiledCircuit* _tmp25_ = NULL;
	GError * _inner_error_ = NULL;
	self = (ConstantComponentDef*) base;
	g_return_if_fail (compiledCircuit != NULL);
	_tmp0_ = connection_new_fake ();
	outputWire = _tmp0_;
	constantValue = FALSE;
	_tmp1_ = connections;
	_tmp1__length1 = connections_length1;
	{
		Connection** connection_collection = NULL;
		gint connection_collection_length1 = 0;
		gint _connection_collection_size_ = 0;
		gint connection_it = 0;
		connection_collection = _tmp1_;
		connection_collection_length1 = _tmp1__length1;
		for (connection_it = 0; connection_it < _tmp1__length1; connection_it = connection_it + 1) {
			Connection* _tmp2_ = NULL;
			Connection* connection = NULL;
			_tmp2_ = _connection_ref0 (connection_collection[connection_it]);
			connection = _tmp2_;
			{
				Connection* _tmp3_ = NULL;
				WireInst* _tmp4_ = NULL;
				WireInst* _tmp5_ = NULL;
				ComponentInst* _tmp6_ = NULL;
				PinInst** _tmp7_ = NULL;
				gint _tmp7__length1 = 0;
				PinInst* _tmp8_ = NULL;
				WireInst** _tmp9_ = NULL;
				gint _tmp9__length1 = 0;
				WireInst* _tmp10_ = NULL;
				_tmp3_ = connection;
				_tmp4_ = connection_get_wireInst (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = componentInst;
				_tmp7_ = _tmp6_->pinInsts;
				_tmp7__length1 = _tmp6_->pinInsts_length1;
				_tmp8_ = _tmp7_[0];
				_tmp9_ = _tmp8_->wireInsts;
				_tmp9__length1 = _tmp8_->wireInsts_length1;
				_tmp10_ = _tmp9_[0];
				if (_tmp5_ == _tmp10_) {
					Connection* _tmp11_ = NULL;
					Connection* _tmp12_ = NULL;
					_tmp11_ = connection;
					_tmp12_ = _connection_ref0 (_tmp11_);
					_connection_unref0 (outputWire);
					outputWire = _tmp12_;
				}
				_connection_unref0 (connection);
			}
		}
	}
	{
		gchar* _tmp13_ = NULL;
		ComponentInst* _tmp14_ = NULL;
		PropertySet* _tmp15_ = NULL;
		gchar* _tmp16_ = NULL;
		gchar* _tmp17_ = NULL;
		_tmp14_ = componentInst;
		_tmp15_ = _tmp14_->configuration;
		_tmp16_ = property_item_selection_get_data_throw (_tmp15_, "Value", &_inner_error_);
		_tmp13_ = _tmp16_;
		if (_inner_error_ != NULL) {
			goto __catch24_g_error;
		}
		_tmp17_ = _tmp13_;
		_tmp13_ = NULL;
		_g_free0 (constantString);
		constantString = _tmp17_;
		_g_free0 (_tmp13_);
	}
	goto __finally24;
	__catch24_g_error:
	{
		gchar* _tmp18_ = NULL;
		g_clear_error (&_inner_error_);
		_inner_error_ = NULL;
		_tmp18_ = g_strdup ("0");
		_g_free0 (constantString);
		constantString = _tmp18_;
	}
	__finally24:
	if (_inner_error_ != NULL) {
		_g_free0 (constantString);
		_connection_unref0 (outputWire);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp19_ = constantString;
	if (g_strcmp0 (_tmp19_, "1") == 0) {
		constantValue = TRUE;
	}
	_tmp20_ = outputWire;
	_tmp21_ = constantValue;
	_tmp22_ = ancestry;
	_tmp22__length1 = ancestry_length1;
	_tmp23_ = componentInst;
	_tmp24_ = constant_component_state_new (_tmp20_, _tmp21_, _tmp22_, _tmp22__length1, _tmp23_);
	componentState = (ComponentState*) _tmp24_;
	_tmp25_ = compiledCircuit;
	compiled_circuit_add_component (_tmp25_, componentState);
	_component_state_unref0 (componentState);
	_g_free0 (constantString);
	_connection_unref0 (outputWire);
}
MultiplexerComponentState* multiplexer_component_state_construct (GType object_type, Connection** selectWires, int selectWires_length1, Connection** dataWires, int dataWires_length1, Connection* outputWire, ComponentInst** ancestry, int ancestry_length1, ComponentInst* componentInst) {
	MultiplexerComponentState* self = NULL;
	Connection** _tmp0_ = NULL;
	gint _tmp0__length1 = 0;
	Connection** _tmp1_ = NULL;
	gint _tmp1__length1 = 0;
	Connection** _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	Connection** _tmp5_ = NULL;
	gint _tmp5__length1 = 0;
	Connection** _tmp6_ = NULL;
	gint _tmp6__length1 = 0;
	Connection** _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	Connection* _tmp10_ = NULL;
	Connection* _tmp11_ = NULL;
	ComponentInst** _tmp12_ = NULL;
	gint _tmp12__length1 = 0;
	ComponentInst** _tmp13_ = NULL;
	gint _tmp13__length1 = 0;
	ComponentInst* _tmp14_ = NULL;
	ComponentInst* _tmp15_ = NULL;
	g_return_val_if_fail (outputWire != NULL, NULL);
	g_return_val_if_fail (componentInst != NULL, NULL);
	self = (MultiplexerComponentState*) component_state_construct (object_type);
	_tmp0_ = selectWires;
	_tmp0__length1 = selectWires_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup29 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->priv->selectWires = (_vala_array_free (self->priv->selectWires, self->priv->selectWires_length1, (GDestroyNotify) connection_unref), NULL);
	self->priv->selectWires = _tmp1_;
	self->priv->selectWires_length1 = _tmp1__length1;
	self->priv->_selectWires_size_ = self->priv->selectWires_length1;
	_tmp2_ = selectWires;
	_tmp2__length1 = selectWires_length1;
	{
		Connection** selectWire_collection = NULL;
		gint selectWire_collection_length1 = 0;
		gint _selectWire_collection_size_ = 0;
		gint selectWire_it = 0;
		selectWire_collection = _tmp2_;
		selectWire_collection_length1 = _tmp2__length1;
		for (selectWire_it = 0; selectWire_it < _tmp2__length1; selectWire_it = selectWire_it + 1) {
			Connection* _tmp3_ = NULL;
			Connection* selectWire = NULL;
			_tmp3_ = _connection_ref0 (selectWire_collection[selectWire_it]);
			selectWire = _tmp3_;
			{
				Connection* _tmp4_ = NULL;
				_tmp4_ = selectWire;
				connection_set_affects (_tmp4_, (ComponentState*) self);
				_connection_unref0 (selectWire);
			}
		}
	}
	_tmp5_ = dataWires;
	_tmp5__length1 = dataWires_length1;
	_tmp6_ = (_tmp5_ != NULL) ? _vala_array_dup30 (_tmp5_, _tmp5__length1) : ((gpointer) _tmp5_);
	_tmp6__length1 = _tmp5__length1;
	self->priv->dataWires = (_vala_array_free (self->priv->dataWires, self->priv->dataWires_length1, (GDestroyNotify) connection_unref), NULL);
	self->priv->dataWires = _tmp6_;
	self->priv->dataWires_length1 = _tmp6__length1;
	self->priv->_dataWires_size_ = self->priv->dataWires_length1;
	_tmp7_ = dataWires;
	_tmp7__length1 = dataWires_length1;
	{
		Connection** dataWire_collection = NULL;
		gint dataWire_collection_length1 = 0;
		gint _dataWire_collection_size_ = 0;
		gint dataWire_it = 0;
		dataWire_collection = _tmp7_;
		dataWire_collection_length1 = _tmp7__length1;
		for (dataWire_it = 0; dataWire_it < _tmp7__length1; dataWire_it = dataWire_it + 1) {
			Connection* _tmp8_ = NULL;
			Connection* dataWire = NULL;
			_tmp8_ = _connection_ref0 (dataWire_collection[dataWire_it]);
			dataWire = _tmp8_;
			{
				Connection* _tmp9_ = NULL;
				_tmp9_ = dataWire;
				connection_set_affects (_tmp9_, (ComponentState*) self);
				_connection_unref0 (dataWire);
			}
		}
	}
	_tmp10_ = outputWire;
	_tmp11_ = _connection_ref0 (_tmp10_);
	_connection_unref0 (self->priv->outputWire);
	self->priv->outputWire = _tmp11_;
	_tmp12_ = ancestry;
	_tmp12__length1 = ancestry_length1;
	_tmp13_ = (_tmp12_ != NULL) ? _vala_array_dup31 (_tmp12_, _tmp12__length1) : ((gpointer) _tmp12_);
	_tmp13__length1 = _tmp12__length1;
	((ComponentState*) self)->ancestry = (_vala_array_free (((ComponentState*) self)->ancestry, ((ComponentState*) self)->ancestry_length1, (GDestroyNotify) component_inst_unref), NULL);
	((ComponentState*) self)->ancestry = _tmp13_;
	((ComponentState*) self)->ancestry_length1 = _tmp13__length1;
	_tmp14_ = componentInst;
	_tmp15_ = _component_inst_ref0 (_tmp14_);
	_component_inst_unref0 (((ComponentState*) self)->componentInst);
	((ComponentState*) self)->componentInst = _tmp15_;
	return self;
}
Esempio n. 9
0
static void tristate_component_def_real_compile_component (ComponentDef* base, CompiledCircuit* compiledCircuit, ComponentInst* componentInst, Connection** connections, int connections_length1, ComponentInst** ancestry, int ancestry_length1) {
    TristateComponentDef * self;
    Connection* _tmp0_;
    Connection* inputWire;
    Connection* _tmp1_;
    Connection* controlWire;
    Connection* _tmp2_;
    Connection* outputWire;
    Connection** _tmp3_;
    gint _tmp3__length1;
    Connection* _tmp35_;
    Connection* _tmp36_;
    Connection* _tmp37_;
    ComponentInst** _tmp38_;
    gint _tmp38__length1;
    ComponentInst* _tmp39_;
    TristateComponentState* _tmp40_;
    ComponentState* componentState;
    CompiledCircuit* _tmp41_;
    self = (TristateComponentDef*) base;
    g_return_if_fail (compiledCircuit != NULL);
    _tmp0_ = connection_new_fake ();
    inputWire = _tmp0_;
    _tmp1_ = connection_new_fake ();
    controlWire = _tmp1_;
    _tmp2_ = connection_new_fake ();
    outputWire = _tmp2_;
    _tmp3_ = connections;
    _tmp3__length1 = connections_length1;
    {
        Connection** connection_collection = NULL;
        gint connection_collection_length1 = 0;
        gint _connection_collection_size_ = 0;
        gint connection_it = 0;
        connection_collection = _tmp3_;
        connection_collection_length1 = _tmp3__length1;
        for (connection_it = 0; connection_it < _tmp3__length1; connection_it = connection_it + 1) {
            Connection* _tmp4_;
            Connection* connection = NULL;
            _tmp4_ = _connection_ref0 (connection_collection[connection_it]);
            connection = _tmp4_;
            {
                Connection* _tmp5_;
                WireInst* _tmp6_;
                WireInst* _tmp7_;
                ComponentInst* _tmp8_;
                PinInst** _tmp9_;
                gint _tmp9__length1;
                PinInst* _tmp10_;
                WireInst** _tmp11_;
                gint _tmp11__length1;
                WireInst* _tmp12_;
                Connection* _tmp15_;
                WireInst* _tmp16_;
                WireInst* _tmp17_;
                ComponentInst* _tmp18_;
                PinInst** _tmp19_;
                gint _tmp19__length1;
                PinInst* _tmp20_;
                WireInst** _tmp21_;
                gint _tmp21__length1;
                WireInst* _tmp22_;
                Connection* _tmp25_;
                WireInst* _tmp26_;
                WireInst* _tmp27_;
                ComponentInst* _tmp28_;
                PinInst** _tmp29_;
                gint _tmp29__length1;
                PinInst* _tmp30_;
                WireInst** _tmp31_;
                gint _tmp31__length1;
                WireInst* _tmp32_;
                _tmp5_ = connection;
                _tmp6_ = connection_get_wireInst (_tmp5_);
                _tmp7_ = _tmp6_;
                _tmp8_ = componentInst;
                _tmp9_ = _tmp8_->pinInsts;
                _tmp9__length1 = _tmp8_->pinInsts_length1;
                _tmp10_ = _tmp9_[0];
                _tmp11_ = _tmp10_->wireInsts;
                _tmp11__length1 = _tmp10_->wireInsts_length1;
                _tmp12_ = _tmp11_[0];
                if (_tmp7_ == _tmp12_) {
                    Connection* _tmp13_;
                    Connection* _tmp14_;
                    _tmp13_ = connection;
                    _tmp14_ = _connection_ref0 (_tmp13_);
                    _connection_unref0 (inputWire);
                    inputWire = _tmp14_;
                }
                _tmp15_ = connection;
                _tmp16_ = connection_get_wireInst (_tmp15_);
                _tmp17_ = _tmp16_;
                _tmp18_ = componentInst;
                _tmp19_ = _tmp18_->pinInsts;
                _tmp19__length1 = _tmp18_->pinInsts_length1;
                _tmp20_ = _tmp19_[1];
                _tmp21_ = _tmp20_->wireInsts;
                _tmp21__length1 = _tmp20_->wireInsts_length1;
                _tmp22_ = _tmp21_[0];
                if (_tmp17_ == _tmp22_) {
                    Connection* _tmp23_;
                    Connection* _tmp24_;
                    _tmp23_ = connection;
                    _tmp24_ = _connection_ref0 (_tmp23_);
                    _connection_unref0 (controlWire);
                    controlWire = _tmp24_;
                }
                _tmp25_ = connection;
                _tmp26_ = connection_get_wireInst (_tmp25_);
                _tmp27_ = _tmp26_;
                _tmp28_ = componentInst;
                _tmp29_ = _tmp28_->pinInsts;
                _tmp29__length1 = _tmp28_->pinInsts_length1;
                _tmp30_ = _tmp29_[2];
                _tmp31_ = _tmp30_->wireInsts;
                _tmp31__length1 = _tmp30_->wireInsts_length1;
                _tmp32_ = _tmp31_[0];
                if (_tmp27_ == _tmp32_) {
                    Connection* _tmp33_;
                    Connection* _tmp34_;
                    _tmp33_ = connection;
                    _tmp34_ = _connection_ref0 (_tmp33_);
                    _connection_unref0 (outputWire);
                    outputWire = _tmp34_;
                }
                _connection_unref0 (connection);
            }
        }
    }
    _tmp35_ = inputWire;
    _tmp36_ = controlWire;
    _tmp37_ = outputWire;
    _tmp38_ = ancestry;
    _tmp38__length1 = ancestry_length1;
    _tmp39_ = componentInst;
    _tmp40_ = tristate_component_state_new (_tmp35_, _tmp36_, _tmp37_, _tmp38_, _tmp38__length1, _tmp39_);
    componentState = (ComponentState*) _tmp40_;
    _tmp41_ = compiledCircuit;
    compiled_circuit_add_component (_tmp41_, componentState);
    _component_state_unref0 (componentState);
    _connection_unref0 (outputWire);
    _connection_unref0 (controlWire);
    _connection_unref0 (inputWire);
}
Esempio n. 10
0
static void pe_dflipflop_component_def_real_compile_component (ComponentDef* base, CompiledCircuit* compiledCircuit, ComponentInst* componentInst, Connection** connections, int connections_length1, ComponentInst** ancestry, int ancestry_length1) {
    PeDFlipflopComponentDef * self;
    Connection* _tmp0_;
    Connection* dataWire;
    Connection* _tmp1_;
    Connection* clockWire;
    Connection* _tmp2_;
    Connection* outputWire;
    Connection* _tmp3_;
    Connection* outputNotWire;
    Connection** _tmp4_;
    gint _tmp4__length1;
    Connection* _tmp46_;
    Connection* _tmp47_;
    Connection* _tmp48_;
    Connection* _tmp49_;
    ComponentInst** _tmp50_;
    gint _tmp50__length1;
    ComponentInst* _tmp51_;
    PeDFlipflopComponentState* _tmp52_;
    ComponentState* componentState;
    CompiledCircuit* _tmp53_;
    self = (PeDFlipflopComponentDef*) base;
    g_return_if_fail (compiledCircuit != NULL);
    _tmp0_ = connection_new_fake ();
    dataWire = _tmp0_;
    _tmp1_ = connection_new_fake ();
    clockWire = _tmp1_;
    _tmp2_ = connection_new_fake ();
    outputWire = _tmp2_;
    _tmp3_ = connection_new_fake ();
    outputNotWire = _tmp3_;
    _tmp4_ = connections;
    _tmp4__length1 = connections_length1;
    {
        Connection** connection_collection = NULL;
        gint connection_collection_length1 = 0;
        gint _connection_collection_size_ = 0;
        gint connection_it = 0;
        connection_collection = _tmp4_;
        connection_collection_length1 = _tmp4__length1;
        for (connection_it = 0; connection_it < _tmp4__length1; connection_it = connection_it + 1) {
            Connection* _tmp5_;
            Connection* connection = NULL;
            _tmp5_ = _connection_ref0 (connection_collection[connection_it]);
            connection = _tmp5_;
            {
                Connection* _tmp6_;
                WireInst* _tmp7_;
                WireInst* _tmp8_;
                ComponentInst* _tmp9_;
                PinInst** _tmp10_;
                gint _tmp10__length1;
                PinInst* _tmp11_;
                WireInst** _tmp12_;
                gint _tmp12__length1;
                WireInst* _tmp13_;
                Connection* _tmp16_;
                WireInst* _tmp17_;
                WireInst* _tmp18_;
                ComponentInst* _tmp19_;
                PinInst** _tmp20_;
                gint _tmp20__length1;
                PinInst* _tmp21_;
                WireInst** _tmp22_;
                gint _tmp22__length1;
                WireInst* _tmp23_;
                Connection* _tmp26_;
                WireInst* _tmp27_;
                WireInst* _tmp28_;
                ComponentInst* _tmp29_;
                PinInst** _tmp30_;
                gint _tmp30__length1;
                PinInst* _tmp31_;
                WireInst** _tmp32_;
                gint _tmp32__length1;
                WireInst* _tmp33_;
                Connection* _tmp36_;
                WireInst* _tmp37_;
                WireInst* _tmp38_;
                ComponentInst* _tmp39_;
                PinInst** _tmp40_;
                gint _tmp40__length1;
                PinInst* _tmp41_;
                WireInst** _tmp42_;
                gint _tmp42__length1;
                WireInst* _tmp43_;
                _tmp6_ = connection;
                _tmp7_ = connection_get_wireInst (_tmp6_);
                _tmp8_ = _tmp7_;
                _tmp9_ = componentInst;
                _tmp10_ = _tmp9_->pinInsts;
                _tmp10__length1 = _tmp9_->pinInsts_length1;
                _tmp11_ = _tmp10_[0];
                _tmp12_ = _tmp11_->wireInsts;
                _tmp12__length1 = _tmp11_->wireInsts_length1;
                _tmp13_ = _tmp12_[0];
                if (_tmp8_ == _tmp13_) {
                    Connection* _tmp14_;
                    Connection* _tmp15_;
                    _tmp14_ = connection;
                    _tmp15_ = _connection_ref0 (_tmp14_);
                    _connection_unref0 (dataWire);
                    dataWire = _tmp15_;
                }
                _tmp16_ = connection;
                _tmp17_ = connection_get_wireInst (_tmp16_);
                _tmp18_ = _tmp17_;
                _tmp19_ = componentInst;
                _tmp20_ = _tmp19_->pinInsts;
                _tmp20__length1 = _tmp19_->pinInsts_length1;
                _tmp21_ = _tmp20_[1];
                _tmp22_ = _tmp21_->wireInsts;
                _tmp22__length1 = _tmp21_->wireInsts_length1;
                _tmp23_ = _tmp22_[0];
                if (_tmp18_ == _tmp23_) {
                    Connection* _tmp24_;
                    Connection* _tmp25_;
                    _tmp24_ = connection;
                    _tmp25_ = _connection_ref0 (_tmp24_);
                    _connection_unref0 (clockWire);
                    clockWire = _tmp25_;
                }
                _tmp26_ = connection;
                _tmp27_ = connection_get_wireInst (_tmp26_);
                _tmp28_ = _tmp27_;
                _tmp29_ = componentInst;
                _tmp30_ = _tmp29_->pinInsts;
                _tmp30__length1 = _tmp29_->pinInsts_length1;
                _tmp31_ = _tmp30_[2];
                _tmp32_ = _tmp31_->wireInsts;
                _tmp32__length1 = _tmp31_->wireInsts_length1;
                _tmp33_ = _tmp32_[0];
                if (_tmp28_ == _tmp33_) {
                    Connection* _tmp34_;
                    Connection* _tmp35_;
                    _tmp34_ = connection;
                    _tmp35_ = _connection_ref0 (_tmp34_);
                    _connection_unref0 (outputWire);
                    outputWire = _tmp35_;
                }
                _tmp36_ = connection;
                _tmp37_ = connection_get_wireInst (_tmp36_);
                _tmp38_ = _tmp37_;
                _tmp39_ = componentInst;
                _tmp40_ = _tmp39_->pinInsts;
                _tmp40__length1 = _tmp39_->pinInsts_length1;
                _tmp41_ = _tmp40_[3];
                _tmp42_ = _tmp41_->wireInsts;
                _tmp42__length1 = _tmp41_->wireInsts_length1;
                _tmp43_ = _tmp42_[0];
                if (_tmp38_ == _tmp43_) {
                    Connection* _tmp44_;
                    Connection* _tmp45_;
                    _tmp44_ = connection;
                    _tmp45_ = _connection_ref0 (_tmp44_);
                    _connection_unref0 (outputNotWire);
                    outputNotWire = _tmp45_;
                }
                _connection_unref0 (connection);
            }
        }
    }
    _tmp46_ = dataWire;
    _tmp47_ = clockWire;
    _tmp48_ = outputWire;
    _tmp49_ = outputNotWire;
    _tmp50_ = ancestry;
    _tmp50__length1 = ancestry_length1;
    _tmp51_ = componentInst;
    _tmp52_ = pe_dflipflop_component_state_new (_tmp46_, _tmp47_, _tmp48_, _tmp49_, _tmp50_, _tmp50__length1, _tmp51_);
    componentState = (ComponentState*) _tmp52_;
    _tmp53_ = compiledCircuit;
    compiled_circuit_add_component (_tmp53_, componentState);
    _component_state_unref0 (componentState);
    _connection_unref0 (outputNotWire);
    _connection_unref0 (outputWire);
    _connection_unref0 (clockWire);
    _connection_unref0 (dataWire);
}
Esempio n. 11
0
OrComponentState* or_component_state_construct (GType object_type, Connection** inputWires, int inputWires_length1, Connection* outputWire, ComponentInst** ancestry, int ancestry_length1, ComponentInst* componentInst) {
	OrComponentState* self = NULL;
	Connection** _tmp0_;
	gint _tmp0__length1;
	Connection** _tmp1_;
	gint _tmp1__length1;
	Connection** _tmp2_;
	gint _tmp2__length1;
	Connection* _tmp5_;
	Connection* _tmp6_;
	ComponentInst** _tmp7_;
	gint _tmp7__length1;
	ComponentInst** _tmp8_;
	gint _tmp8__length1;
	ComponentInst* _tmp9_;
	ComponentInst* _tmp10_;
	g_return_val_if_fail (outputWire != NULL, NULL);
	g_return_val_if_fail (componentInst != NULL, NULL);
	self = (OrComponentState*) component_state_construct (object_type);
	_tmp0_ = inputWires;
	_tmp0__length1 = inputWires_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup32 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->priv->inputWires = (_vala_array_free (self->priv->inputWires, self->priv->inputWires_length1, (GDestroyNotify) connection_unref), NULL);
	self->priv->inputWires = _tmp1_;
	self->priv->inputWires_length1 = _tmp1__length1;
	self->priv->_inputWires_size_ = self->priv->inputWires_length1;
	_tmp2_ = inputWires;
	_tmp2__length1 = inputWires_length1;
	{
		Connection** inputWire_collection = NULL;
		gint inputWire_collection_length1 = 0;
		gint _inputWire_collection_size_ = 0;
		gint inputWire_it = 0;
		inputWire_collection = _tmp2_;
		inputWire_collection_length1 = _tmp2__length1;
		for (inputWire_it = 0; inputWire_it < _tmp2__length1; inputWire_it = inputWire_it + 1) {
			Connection* _tmp3_;
			Connection* inputWire = NULL;
			_tmp3_ = _connection_ref0 (inputWire_collection[inputWire_it]);
			inputWire = _tmp3_;
			{
				Connection* _tmp4_;
				_tmp4_ = inputWire;
				connection_set_affects (_tmp4_, (ComponentState*) self);
				_connection_unref0 (inputWire);
			}
		}
	}
	_tmp5_ = outputWire;
	_tmp6_ = _connection_ref0 (_tmp5_);
	_connection_unref0 (self->priv->outputWire);
	self->priv->outputWire = _tmp6_;
	_tmp7_ = ancestry;
	_tmp7__length1 = ancestry_length1;
	_tmp8_ = (_tmp7_ != NULL) ? _vala_array_dup33 (_tmp7_, _tmp7__length1) : ((gpointer) _tmp7_);
	_tmp8__length1 = _tmp7__length1;
	((ComponentState*) self)->ancestry = (_vala_array_free (((ComponentState*) self)->ancestry, ((ComponentState*) self)->ancestry_length1, (GDestroyNotify) component_inst_unref), NULL);
	((ComponentState*) self)->ancestry = _tmp8_;
	((ComponentState*) self)->ancestry_length1 = _tmp8__length1;
	_tmp9_ = componentInst;
	_tmp10_ = _component_inst_ref0 (_tmp9_);
	_component_inst_unref0 (((ComponentState*) self)->componentInst);
	((ComponentState*) self)->componentInst = _tmp10_;
	return self;
}