cc_edge_ctrl.v 5.07 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	cc_edge_ctrl
// description: Control and input formatting for texture edge.
//
// designer:	Phil Gossett
// date:	12/13/94
//
////////////////////////////////////////////////////////////////////////

module cc_edge_ctrl (texture_edge_mode, cvg_times_alpha, alpha_cvg_select,
		a, lod_frac, max1, lfg, cvg_alpha_enable, clamp_a, lfrac);

input texture_edge_mode;
input cvg_times_alpha;
input alpha_cvg_select;
input [8:0] a;
input [4:0] lod_frac;

output max1;
output lfg;
output cvg_alpha_enable;
output [7:0] clamp_a;
output [4:0] lfrac;

wire [7:0] ppc_a;
wire [7:0] pc_a;
wire [8:5] a_l;
wire clamped;
wire pre_cvg_alpha_en;
wire [2:1] lod_frac_l;
wire [2:0] lf_l;

in01d2  icta ( .i(cvg_times_alpha),    .zn(cta_l));
nd02d2  ancs (.a1(alpha_cvg_select), .a2(cta_l), .zn(force_l));
in01d5  inp8 ( .i(a[8]),               .zn(a8_l));
in01d2  inp7 ( .i(a[7]),               .zn(a7_l));
nd02d2  anp8 (.a1(a7_l),    .a2(a[8]), .zn(a7_n));

nd02d2  ana7 (.a1(a8_l),    .a2(a[7]), .zn(ppc_a[7]));
nd02d2  ana6 (.a1(a8_l),    .a2(a[6]), .zn(ppc_a[6]));
nd02d2  ana5 (.a1(a8_l),    .a2(a[5]), .zn(ppc_a[5]));
nd02d2  ana4 (.a1(a8_l),    .a2(a[4]), .zn(ppc_a[4]));
nd02d2  ana3 (.a1(a8_l),    .a2(a[3]), .zn(ppc_a[3]));
nd02d2  ana2 (.a1(a8_l),    .a2(a[2]), .zn(ppc_a[2]));
nd02d2  ana1 (.a1(a8_l),    .a2(a[1]), .zn(ppc_a[1]));
nd02d2  ana0 (.a1(a8_l),    .a2(a[0]), .zn(ppc_a[0]));

an02d1h anp7 (.a1(force_l), .a2(ppc_a[7]), .z(pc_a[7]));
an02d1h anp6 (.a1(force_l), .a2(ppc_a[6]), .z(pc_a[6]));
an02d1h anp5 (.a1(force_l), .a2(ppc_a[5]), .z(pc_a[5]));
an02d1h anp4 (.a1(force_l), .a2(ppc_a[4]), .z(pc_a[4]));
an02d1h anp3 (.a1(force_l), .a2(ppc_a[3]), .z(pc_a[3]));
an02d1h anp2 (.a1(force_l), .a2(ppc_a[2]), .z(pc_a[2]));
an02d1h anp1 (.a1(force_l), .a2(ppc_a[1]), .z(pc_a[1]));
an02d1h anp0 (.a1(force_l), .a2(ppc_a[0]), .z(pc_a[0]));

nd02d2  ora7 (.a1(a7_n), .a2(pc_a[7]), .zn(clamp_a[7]));
nd02d2  ora6 (.a1(a7_n), .a2(pc_a[6]), .zn(clamp_a[6]));
nd02d2  ora5 (.a1(a7_n), .a2(pc_a[5]), .zn(clamp_a[5]));
nd02d2  ora4 (.a1(a7_n), .a2(pc_a[4]), .zn(clamp_a[4]));
nd02d2  ora3 (.a1(a7_n), .a2(pc_a[3]), .zn(clamp_a[3]));
nd02d2  ora2 (.a1(a7_n), .a2(pc_a[2]), .zn(clamp_a[2]));
nd02d2  ora1 (.a1(a7_n), .a2(pc_a[1]), .zn(clamp_a[1]));
nd02d2  ora0 (.a1(a7_n), .a2(pc_a[0]), .zn(clamp_a[0]));

an08d2  ancl (.a1(clamp_a[7]), .a2(clamp_a[6]),
	      .a3(clamp_a[5]), .a4(clamp_a[4]), 
	      .a5(clamp_a[3]), .a6(clamp_a[2]), 
	      .a7(clamp_a[1]), .a8(clamp_a[0]), .z(clamped));
nd02d2  ndca (.a1(texture_edge_mode), .a2(clamped), .zn(pre_cvg_alpha_en));
an02d1h anca (.a1(cvg_times_alpha), .a2(pre_cvg_alpha_en),
						     .z(cvg_alpha_enable));

an02d1h anl3 (.a1(lod_frac[3]), .a2(texture_edge_mode), .z(lfrac[3]));
an02d1h anl2 (.a1(lfrac[3]), .a2(lod_frac[2]),          .z(lfrac[2]));
an02d1h anl1 (.a1(lfrac[3]), .a2(lod_frac[1]),          .z(lfrac[1]));
an02d1h anl0 (.a1(lfrac[3]), .a2(lod_frac[0]),          .z(lfrac[0]));
in01d4  anl4 ( .i(lfrac[3]),                           .zn(lfrac[4]));

in01d4  ina5 (.i(a[5]), .zn(a_l[5]));
in01d4  ina6 (.i(a[6]), .zn(a_l[6]));
in01d4  ina7 (.i(a[7]), .zn(a_l[7]));
in01d4  ina8 (.i(a[8]), .zn(a_l[8]));
in01d4  inl1 (.i(lod_frac[1]), .zn(lod_frac_l[1]));
in01d4  inl2 (.i(lod_frac[2]), .zn(lod_frac_l[2]));
in01d4  inf0 (.i(lfrac[0]), .zn(lf_l[0]));
in01d4  inf1 (.i(lfrac[1]), .zn(lf_l[1]));
in01d4  inf2 (.i(lfrac[2]), .zn(lf_l[2]));

nd05d2  maxa (	.a1(a_l[8]), .a2(a_l[7]), .a3(a_l[6]), .a4(a_l[5]),
		.a5(force_l),					    .zn(m1a));
nd05d2  maxb (	.a1(lfrac[3]),
		.a2(a_l[8]), .a3(a_l[7]), .a4(a_l[6]),
		.a5(force_l),					    .zn(m1b));
nd05d2  maxc (	.a1(lfrac[3]), .a2(lod_frac_l[2]),
		.a3(a_l[8]), .a4(a_l[7]),
		.a5(force_l),					    .zn(m1c));
nd07d2  maxd (	.a1(lfrac[3]), .a2(lod_frac_l[2]), .a3(lod_frac_l[1]),
		.a4(a_l[8]),              .a5(a_l[6]), .a6(a_l[5]),
		.a7(force_l),					    .zn(m1d));
nd07d2  maxe (	.a1(lfrac[3]), .a2(  lod_frac[2]), .a3(lod_frac_l[1]),
		.a4(a_l[8]), .a5(a_l[7]),              .a6(a_l[5]),
		.a7(force_l),					    .zn(m1e));
nd03d2  maxf (	.a1(  a[8]), .a2(  a[7]),
		.a3(force_l),					    .zn(m1f));
nd06d2  maxt (	.a1(m1a), .a2(m1b), .a3(m1c), .a4(m1d), .a5(m1e), .a6(m1f),
	                                                            .zn(max1));

nd05d2  lgsa (	.a1(lfrac[3]), .a2(lf_l[2]), .a3(lf_l[1]),
		.a4(clamp_a[7]), .a5(clamp_a[6]),                   .zn(lga));
nd06d2  lgsb (	.a1(lfrac[3]), .a2(lf_l[2]), .a3(lf_l[1]), .a4(lf_l[0]),
		.a5(clamp_a[7]), .a6(clamp_a[5]),                   .zn(lgb));
nd05d2  lgsc (	.a1(lfrac[3]), .a2(lf_l[2]),               .a3(lf_l[0]),
		.a4(clamp_a[7]), .a5(clamp_a[6]),                   .zn(lgc));
nd05d2  lgsd (	.a1(lfrac[3]), .a2(lf_l[2]),
		.a3(clamp_a[7]), .a4(clamp_a[6]), .a5(clamp_a[5]),  .zn(lgd));
nd06d2  lgse (	.a1(lfrac[3]),               .a2(lf_l[1]), .a3(lf_l[0]),
		.a4(clamp_a[7]), .a5(clamp_a[6]), .a6(clamp_a[5]),  .zn(lge));
an05d2  lgst (	.a1(lga), .a2(lgb), .a3(lgc), .a4(lgd), .a5(lge),    .z(lfgs));
an02d1h anga (.a1(cvg_times_alpha), .a2(lfgs),                       .z(lfg));

endmodule // cc_edge_ctrl