ParameterBlock ParameterBlock::SelectBlock(LPCTSTR path) {
  IXMLDOMElement *result = e_;
  LPCTSTR start = path, end = path;
  while (result != NULL && (end = _tcschr(start, _T('\\'))) != NULL) {
    result = FindFirstElement(result, start, end - start);    
    start = end + 1;
  }
  if (*start != _T('\0') && result != NULL) {
    result = FindFirstElement(result, start, -1);
  }
  return ParameterBlock(result);
}
Esempio n. 2
0
/**
 *  Read multiplexer information from the .xml transistor characteristics.
 *  This contains the estimates of mux output voltages, depending on 1) Mux Size 2) Mux Vin
 *  */
static void power_tech_xml_load_multiplexer_info(ezxml_t parent) {
	ezxml_t child, prev, gc;
	int num_mux_sizes;
	int i, j;

	/* Process all multiplexer sizes */
	num_mux_sizes = CountChildren(parent, "multiplexer", 1);

	/* Add entries for 0 and 1, for convenience, although
	 * they will never be used
	 */
	g_power_tech->max_mux_sl_size = 1 + num_mux_sizes;
	g_power_tech->mux_voltage_inf = (t_power_mux_volt_inf*) my_calloc(
			g_power_tech->max_mux_sl_size + 1, sizeof(t_power_mux_volt_inf));

	child = FindFirstElement(parent, "multiplexer", TRUE);
	i = 1;
	while (child) {
		int num_voltages;

		assert(i == GetFloatProperty(child, "size", TRUE, 0));

		/* For each mux size, process all of the Vin levels */
		num_voltages = CountChildren(child, "voltages", 1);

		g_power_tech->mux_voltage_inf[i].num_voltage_pairs = num_voltages;
		g_power_tech->mux_voltage_inf[i].mux_voltage_pairs =
				(t_power_mux_volt_pair*) my_calloc(num_voltages,
						sizeof(t_power_mux_volt_pair));

		gc = FindFirstElement(child, "voltages", TRUE);
		j = 0;
		while (gc) {
			/* For each mux size, and Vin level, get the min/max V_out */
			g_power_tech->mux_voltage_inf[i].mux_voltage_pairs[j].v_in =
					GetFloatProperty(gc, "in", TRUE, 0.0);
			g_power_tech->mux_voltage_inf[i].mux_voltage_pairs[j].v_out_min =
					GetFloatProperty(gc, "out_min", TRUE, 0.0);
			g_power_tech->mux_voltage_inf[i].mux_voltage_pairs[j].v_out_max =
					GetFloatProperty(gc, "out_max", TRUE, 0.0);

			prev = gc;
			gc = gc->next;
			FreeNode(prev);
			j++;
		}

		prev = child;
		child = child->next;
		FreeNode(prev);
		i++;
	}
}
Esempio n. 3
0
/**
 *  Read NMOS subthreshold leakage currents from the .xml transistor characteristics
 *  This builds a table of (Vds,Ids) value pairs
 *  */
static void power_tech_xml_load_nmos_st_leakages(ezxml_t parent) {
	ezxml_t child, prev;
	int num_leakage_pairs;
	int i;

	num_leakage_pairs = CountChildren(parent, "nmos_leakage", 1);
	g_power_tech->num_leakage_pairs = num_leakage_pairs;
	g_power_tech->leakage_pairs = (t_power_nmos_leakage_pair*) my_calloc(
			num_leakage_pairs, sizeof(t_power_nmos_leakage_pair));

	child = FindFirstElement(parent, "nmos_leakage", TRUE);
	i = 0;
	while (child) {
		g_power_tech->leakage_pairs[i].v_ds = GetFloatProperty(child, "Vds",
				TRUE, 0.0);
		g_power_tech->leakage_pairs[i].i_ds = GetFloatProperty(child, "Ids",
				TRUE, 0.0);

		prev = child;
		child = child->next;
		FreeNode(prev);
		i++;
	}

}
Esempio n. 4
0
static void power_tech_xml_load_component(ezxml_t parent,
		PowerSpicedComponent ** component, char * name,
		float (*usage_fn)(float size)) {
	ezxml_t cur;
	ezxml_t child, prev;

	*component = new PowerSpicedComponent(usage_fn);

	cur = FindElement(parent, name, TRUE);
	child = FindFirstElement(cur, "instance", TRUE);
	while (child) {
		float size = GetFloatProperty(child, "size", TRUE, 0.);
		float power = GetFloatProperty(child, "power", TRUE, 0.);
		(*component)->add_entry(size, power);

		prev = child;
		child = child->next;
		FreeNode(prev);
	}
	FreeNode(cur);
}
Esempio n. 5
0
/**
 * Reads the transistor properties from the .xml file
 */
void power_tech_load_xml_file(char * cmos_tech_behavior_filepath) {
	ezxml_t cur, child, prev;
	const char * prop;
	char msg[BUFSIZE];

	if (!file_exists(cmos_tech_behavior_filepath)) {
		/* .xml transistor characteristics is missing */
		sprintf(msg,
				"The CMOS technology behavior file ('%s') does not exist.  No power information will be calculated.",
				cmos_tech_behavior_filepath);
		power_log_msg(POWER_LOG_ERROR, msg);

		g_power_tech->NMOS_inf.num_size_entries = 0;
		g_power_tech->NMOS_inf.long_trans_inf = NULL;
		g_power_tech->NMOS_inf.size_inf = NULL;

		g_power_tech->PMOS_inf.num_size_entries = 0;
		g_power_tech->PMOS_inf.long_trans_inf = NULL;
		g_power_tech->PMOS_inf.size_inf = NULL;

		g_power_tech->Vdd = 0.;
		g_power_tech->temperature = 85;
		g_power_tech->PN_ratio = 1.;
		return;
	}
	cur = ezxml_parse_file(cmos_tech_behavior_filepath);

	prop = FindProperty(cur, "file", TRUE);
	ezxml_set_attr(cur, "file", NULL);

	prop = FindProperty(cur, "size", TRUE);
	g_power_tech->tech_size = atof(prop);
	ezxml_set_attr(cur, "size", NULL);

	child = FindElement(cur, "operating_point", TRUE);
	g_power_tech->temperature = GetFloatProperty(child, "temperature", TRUE, 0);
	g_power_tech->Vdd = GetFloatProperty(child, "Vdd", TRUE, 0);
	FreeNode(child);

	child = FindElement(cur, "p_to_n", TRUE);
	g_power_tech->PN_ratio = GetFloatProperty(child, "ratio", TRUE, 0);
	FreeNode(child);

	/* Transistor Information */
	child = FindFirstElement(cur, "transistor", TRUE);
	process_tech_xml_load_transistor_info(child);

	prev = child;
	child = child->next;
	FreeNode(prev);

	process_tech_xml_load_transistor_info(child);
	FreeNode(child);

	/* Multiplexer Voltage Information */
	child = FindElement(cur, "multiplexers", TRUE);
	power_tech_xml_load_multiplexer_info(child);
	FreeNode(child);

	/* Vds Leakage Information */
	child = FindElement(cur, "nmos_leakages", TRUE);
	power_tech_xml_load_nmos_st_leakages(child);
	FreeNode(child);

	/* Buffer SC Info */
	child = FindElement(cur, "buffer_sc", TRUE);
	power_tech_xml_load_sc(child);
	FreeNode(child);

	/* Components */
	child = FindElement(cur, "components", TRUE);
	power_tech_xml_load_components(child);
	FreeNode(child);

	FreeNode(cur);
}
Esempio n. 6
0
/**
 * Read the transistor information from the .xml transistor characteristics.
 * For each transistor size, it extracts the:
 * - transistor node capacitances
 * - subthreshold leakage
 * - gate leakage
 */
static void process_tech_xml_load_transistor_info(ezxml_t parent) {
	t_transistor_inf * trans_inf;
	const char * prop;
	ezxml_t child, prev, grandchild;
	int i;

	/* Get transistor type: NMOS or PMOS */
	prop = FindProperty(parent, "type", TRUE);
	if (strcmp(prop, "nmos") == 0) {
		trans_inf = &g_power_tech->NMOS_inf;
	} else if (strcmp(prop, "pmos") == 0) {
		trans_inf = &g_power_tech->PMOS_inf;
	} else {
		assert(0);
	}
	ezxml_set_attr(parent, "type", NULL);

	/* Get long transistor information (W=1,L=2) */
	trans_inf->long_trans_inf = (t_transistor_size_inf*) my_malloc(
			sizeof(t_transistor_size_inf));

	child = FindElement(parent, "long_size", TRUE);
	assert(GetIntProperty(child, "L", TRUE, 0) == 2);
	trans_inf->long_trans_inf->size = GetFloatProperty(child, "W", TRUE, 0);

	grandchild = FindElement(child, "leakage_current", TRUE);
	trans_inf->long_trans_inf->leakage_subthreshold = GetFloatProperty(
			grandchild, "subthreshold", TRUE, 0);
	FreeNode(grandchild);

	grandchild = FindElement(child, "capacitance", TRUE);
	trans_inf->long_trans_inf->C_g = GetFloatProperty(grandchild, "C_g", TRUE,
			0);
	trans_inf->long_trans_inf->C_d = GetFloatProperty(grandchild, "C_d", TRUE,
			0);
	trans_inf->long_trans_inf->C_s = GetFloatProperty(grandchild, "C_s", TRUE,
			0);
	FreeNode(grandchild);

	/* Process all transistor sizes */
	trans_inf->num_size_entries = CountChildren(parent, "size", 1);
	trans_inf->size_inf = (t_transistor_size_inf*) my_calloc(
			trans_inf->num_size_entries, sizeof(t_transistor_size_inf));
	FreeNode(child);

	child = FindFirstElement(parent, "size", TRUE);
	i = 0;
	while (child) {
		assert(GetIntProperty(child, "L", TRUE, 0) == 1);

		trans_inf->size_inf[i].size = GetFloatProperty(child, "W", TRUE, 0);

		/* Get leakage currents */
		grandchild = FindElement(child, "leakage_current", TRUE);
		trans_inf->size_inf[i].leakage_subthreshold = GetFloatProperty(
				grandchild, "subthreshold", TRUE, 0);
		trans_inf->size_inf[i].leakage_gate = GetFloatProperty(grandchild,
				"gate", TRUE, 0);
		FreeNode(grandchild);

		/* Get node capacitances */
		grandchild = FindElement(child, "capacitance", TRUE);
		trans_inf->size_inf[i].C_g = GetFloatProperty(grandchild, "C_g", TRUE,
				0);
		trans_inf->size_inf[i].C_s = GetFloatProperty(grandchild, "C_s", TRUE,
				0);
		trans_inf->size_inf[i].C_d = GetFloatProperty(grandchild, "C_d", TRUE,
				0);
		FreeNode(grandchild);

		prev = child;
		child = child->next;
		FreeNode(prev);
		i++;
	}
}
Esempio n. 7
0
/**
 * Read short-circuit buffer information from the transistor .xml file.
 * This contains values for buffers of various 1) # Stages 2) Stage strength 3) Input type & capacitance
 */
static void power_tech_xml_load_sc(ezxml_t parent) {
	ezxml_t child, prev, gc, ggc;
	int i, j, k;
	int num_buffer_sizes;

	/* Information for buffers, based on # of stages in buffer */
	num_buffer_sizes = CountChildren(parent, "stages", 1);
	g_power_tech->max_buffer_size = num_buffer_sizes; /* buffer size starts at 1, not 0 */
	g_power_tech->buffer_size_inf = (t_power_buffer_size_inf*) my_calloc(
			g_power_tech->max_buffer_size + 1, sizeof(t_power_buffer_size_inf));

	child = FindFirstElement(parent, "stages", TRUE);
	i = 1;
	while (child) {
		t_power_buffer_size_inf * size_inf = &g_power_tech->buffer_size_inf[i];

		GetIntProperty(child, "num_stages", TRUE, 1);

		/* For the given # of stages, find the records for the strength of each stage */
		size_inf->num_strengths = CountChildren(child, "strength", 1);
		size_inf->strength_inf = (t_power_buffer_strength_inf*) my_calloc(
				size_inf->num_strengths, sizeof(t_power_buffer_strength_inf));

		gc = FindFirstElement(child, "strength", TRUE);
		j = 0;
		while (gc) {
			t_power_buffer_strength_inf * strength_inf =
					&size_inf->strength_inf[j];

			/* Get the short circuit factor for a buffer with no level restorer at the input */
			strength_inf->stage_gain = GetFloatProperty(gc, "gain", TRUE, 0.0);
			strength_inf->sc_no_levr = GetFloatProperty(gc, "sc_nolevr", TRUE,
					0.0);

			/* Get the short circuit factor for buffers with level restorers at the input */
			strength_inf->num_levr_entries = CountChildren(gc, "input_cap", 1);
			strength_inf->sc_levr_inf = (t_power_buffer_sc_levr_inf*) my_calloc(
					strength_inf->num_levr_entries,
					sizeof(t_power_buffer_sc_levr_inf));

			ggc = FindFirstElement(gc, "input_cap", TRUE);
			k = 0;
			while (ggc) {
				t_power_buffer_sc_levr_inf * levr_inf =
						&strength_inf->sc_levr_inf[k];

				/* Short circuit factor is depdent on size of mux that drives the buffer */
				levr_inf->mux_size = GetIntProperty(ggc, "mux_size", TRUE, 0);
				levr_inf->sc_levr = GetFloatProperty(ggc, "sc_levr", TRUE, 0.0);

				prev = ggc;
				ggc = ggc->next;
				FreeNode(prev);
				k++;
			}

			prev = gc;
			gc = gc->next;
			FreeNode(prev);
			j++;
		}

		prev = child;
		child = child->next;
		FreeNode(prev);
		i++;
	}
}
Esempio n. 8
0
HRESULT
ClearElementFromAllSites(
    IN      IAppHostAdminManager *      pAdminMgr,
    IN      CONST WCHAR *               szConfigPath,
    IN      CONST WCHAR *               szElementName
    )
{
    HRESULT hr;
    CComPtr<IAppHostElementCollection> pSitesCollection;
    CComPtr<IAppHostElement> pSiteElement;
    CComPtr<IAppHostChildElementCollection> pChildCollection;
    ENUM_INDEX index;
    BOOL found;

    //
    // Enumerate the sites, remove the specified elements.
    //

    hr = GetSitesCollection(
             pAdminMgr,
             szConfigPath,
             &pSitesCollection
             );

    if (FAILED(hr))
    {
        DBGERROR_HR(hr);
        goto exit;
    }

    for (hr = FindFirstElement(pSitesCollection, &index, &pSiteElement) ;
         SUCCEEDED(hr) ;
         hr = FindNextElement(pSitesCollection, &index, &pSiteElement))
    {
        if (hr == S_FALSE)
        {
            hr = S_OK;
            break;
        }

        hr = pSiteElement->get_ChildElements(&pChildCollection);

        if (FAILED(hr))
        {
            DBGERROR_HR(hr);
            goto exit;
        }

        if (pChildCollection)
        {
            hr = ClearChildElementsByName(
                    pChildCollection,
                    szElementName,
                    &found
                    );

            if (FAILED(hr))
            {
                DBGERROR_HR(hr);
                goto exit;
            }
        }

        pSiteElement.Release();
    }

exit:

    return hr;

}