Пример #1
0
void
exprTri1 (syn_ctx * ctx, char *name)
{
	char *buf = cell_name ("TRI");
	if (!name)
	{			//create definition
		if (!exists (ctx, buf))
		{
			o_p ("(cell %s (celltype GENERIC)\n", buf);
			i_i ();
			o_p ("(view netlist (viewtype NETLIST)\n");
			i_i ();
			o_p ("(interface\n");
			i_i ();
			o_p ("(port Q (direction OUTPUT))\n");	//output
			o_p ("(port A (direction INPUT))\n");	//input
			o_p ("(port ENA (direction INPUT))\n");	//ctrl
			i_d ();
			o_p (")\n");	//interface
			i_d ();	//builtin, no contents
			o_p (")\n");	//view
			i_d ();
			o_p (")\n");	//cell
			hash_put (ctx, buf);
		}
	}
	else
	{
		o_p ("(instance %s (viewref netlist (cellref %s (libraryref DESIGNS))))\n", name, buf);
	}
	free (buf);
}
Пример #2
0
int main(void)
{
  volatile float x = 1.3;
  volatile double y = 2.5;
  volatile float z = 3.5;
  volatile double a = 4.5;

  v_f(x);
  v_f(z);
  v_d(y);
  v_d(a);
  v_ff(x, z);
  v_fd(x, y);
  v_df(a, x);
  v_dd(y, a);

  i_f(x);
  i_f(z);
  i_d(y);
  i_d(a);
  i_ff(x, z);
  i_fd(x, y);
  i_df(a, x);
  i_dd(y, a);
}
	color physicalsky_color(const vector & ray_dir)
	{
		scalar haze_val = max(i_haze() + 2.0f, 2.0f);
		vector sun_dir_val(i_sun_direction());
		color sky_color(0.0f);
		int i_type = 0;
		switch ( i_type )
		{
		case 0:
			{
				sky_color = 0.0001f * get_haze_driven_sky_color(ray_dir, sun_dir_val, haze_val);
			}
			break;
		case 1:
			{
				sky_color = get_cie_standard_sky_color(ray_dir, sun_dir_val, color(i_zenith_luminance()), i_a(), i_b(), i_c(), i_d(), i_e());
			}
			break;
		default:
			{
				return color(0.0f);
			}
		}
		
		return i_multiplier() * sky_color * get_sun_intensity(ray_dir, sun_dir_val, haze_val, i_sun_disk_scale(), i_sun_disk_intensity(), 1.0f/*sun_glow_size()*/, i_sun_glow_intensity(), 5.0f/*sun_glow_falloff()*/);
	}
Пример #4
0
void
tbl_bufif (syn_ctx * ctx, char *name, int width, Opdesc const *op)
{
	char *buf = cell_name ("%s_%d", op->name, width);
	assert (width > 0);
	if (!name)
	{			//create definition
		if (!exists (ctx, buf))
		{
			int i;
			char *inv1 = NULL;
			char **inv_en = NULL;
			char **tris = NULL;
			if (op->buf_pol)
			{
				exprInv (ctx, NULL, width);
			}
			if (!op->en_pol)
			{
				exprInv (ctx, NULL, 1);
			}
			exprTri1 (ctx, NULL);


			o_p ("(cell %s (celltype GENERIC)\n", buf);
			i_i ();
			o_p ("(view netlist (viewtype NETLIST)\n");
			i_i ();
			o_p ("(interface\n");
			i_i ();
			for (i = 0; i < width; i++)
				o_p ("(port A_%d (direction INPUT))\n", i);	//inputs
			for (i = 0; i < width; i++)
				o_p ("(port B_%d (direction INPUT))\n", i);	//the enable
			for (i = 0; i < width; i++)
				o_p ("(port Q_%d (direction OUTPUT))\n", i);	//outputs
			i_d ();
			o_p (")\n");	//interface
			o_p ("(contents\n");
			i_i ();
			if (op->buf_pol)
			{
				inv1 = l_n ();
				exprInv (ctx, inv1, width);
			}

			if (!op->en_pol)
			{
				inv_en = calloc (width, sizeof (char *));
				assert (inv_en);
				for (i = 0; i < width; i++)
				{
					inv_en[i] = l_n ();
					exprInv (ctx, inv_en[i], 1);
				}
			}

			tris = calloc (width, sizeof (char *));
			assert (tris);
			for (i = 0; i < width; i++)
			{
				tris[i] = l_n ();
				exprTri1 (ctx, tris[i]);
			}

			if (op->buf_pol)
			{
				for (i = 0; i < width; i++)
				{
					n_n ();
					o_p ("(portref A_%d)\n", i);
					o_p ("(portref A_%d (instanceref %s))\n", i, inv1);
					n_e ();
					n_n ();
					o_p ("(portref Q_%d (instanceref %s))\n", i, inv1);
					o_p ("(portref A (instanceref %s))\n",
					     tris[i]);
					n_e ();
				}
			}
			else
			{
				for (i = 0; i < width; i++)
				{
					n_n ();
					o_p ("(portref A_%d)\n", i);
					o_p ("(portref A (instanceref %s))\n",
					     tris[i]);
					n_e ();

				}
			}

			if (!op->en_pol)
			{
				for (i = 0; i < width; i++)
				{
					n_n ();
					o_p ("(portref B_%d)\n");
					o_p ("(portref A (instanceref %s))\n",
					     inv_en[i]);
					n_e ();
					n_n ();
					o_p ("(portref Q (instanceref %s))\n",
					     inv_en[i]);
					o_p ("(portref ENA (instanceref %s))\n", tris[i]);
					n_e ();
				}

			}
			else
			{
				for (i = 0; i < width; i++)
				{
					n_n ();
					o_p ("(portref B_%d)\n", i);
					o_p ("(portref ENA (instanceref %s))\n", tris[i]);
					n_e ();
				}
			}

			for (i = 0; i < width; i++)
			{
				n_n ();
				o_p ("(portref Q (instanceref %s))\n",
				     tris[i]);
				o_p ("(portref Q_%d)\n", i);
				n_e ();
			}

			i_d ();
			o_p (")\n");	//contents
			i_d ();
			o_p (")\n");	//view
			i_d ();
			o_p (")\n");	//cell
			hash_put (ctx, buf);
			for (i = 0; i < width; i++)
				free (tris[i]);
			free (tris);
			if (!op->en_pol)
			{
				for (i = 0; i < width; i++)
					free (inv_en[i]);
				free (inv_en);
			}
			if (op->buf_pol)
				free (inv1);
		}
	}
	else
	{
		o_p ("(instance %s (viewref netlist (cellref %s (libraryref DESIGNS))))\n", name, buf);
	}
	free (buf);
}