示例#1
0
int pla_parse(const void *data, size_t length, jed_data *result)
{
	const UINT8 *src = (const UINT8 *)data;
	const UINT8 *srcend = src + length;

	parse_info pinfo;
	memset(&pinfo, 0, sizeof(pinfo));

	result->numfuses = 0;
	memset(result->fusemap, 0, sizeof(result->fusemap));

	while (src < srcend)
	{
		switch (*src)
		{
			// comment line
			case '#':
				while (src < srcend && !iscrlf(*src))
					src++;
				break;

			// keyword
			case '.':
				src++;
				if (!process_field(result, &src, srcend, &pinfo))
					return JEDERR_INVALID_DATA;
				break;

			// terms
			case '0': case '1': case '-': case '~':
				if (!process_terms(result, &src, srcend, &pinfo))
					return JEDERR_INVALID_DATA;
				break;

			default:
				src++;
				break;
		}
	}

	// write output polarity
	if (pinfo.xorptr > 0)
	{
		if (LOG_PARSE) printf("Polarity: ");

		for (int i = 0; i < pinfo.outputs; i++)
		{
			int bit = pinfo.xorval[i/32] >> (i & 31) & 1;
			jed_set_fuse(result, result->numfuses++, bit);
			if (LOG_PARSE) printf("%d", bit);
		}
		if (LOG_PARSE) printf("\n");
	}

	return JEDERR_NONE;
}
示例#2
0
	void algorithm_page_name::process_terms(char **term_list, const char *source)
	{
		process_terms(links_, term_list, source);
	}