bl_max.v 4.36 KB
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module:	bl_max
// description:	Max for blend unit. Assumes power of two inputs.
//		Or of inputs, then truncate to power of two.
//
// designer:	Phil Gossett
// date:	8/28/94
//
////////////////////////////////////////////////////////////////////////

module bl_max (a, b, z);

input [15:0] a;
input [15:0] b;

output [15:0] z;

wire [15:0] i;
wire [15:0] i1i;
wire [15:0] i2i;
wire [15:0] i3i;

or02d2  or0   (.a1(a[ 0]), .a2(b[ 0]),  .z(i[ 0]));
or02d2  or1   (.a1(a[ 1]), .a2(b[ 1]),  .z(i[ 1]));
or02d2  or2   (.a1(a[ 2]), .a2(b[ 2]),  .z(i[ 2]));
or02d2  or3   (.a1(a[ 3]), .a2(b[ 3]),  .z(i[ 3]));
or02d2  or4   (.a1(a[ 4]), .a2(b[ 4]),  .z(i[ 4]));
or02d2  or5   (.a1(a[ 5]), .a2(b[ 5]),  .z(i[ 5]));
or02d2  or6   (.a1(a[ 6]), .a2(b[ 6]),  .z(i[ 6]));
or02d2  or7   (.a1(a[ 7]), .a2(b[ 7]),  .z(i[ 7]));
or02d2  or8   (.a1(a[ 8]), .a2(b[ 8]),  .z(i[ 8]));
or02d2  or9   (.a1(a[ 9]), .a2(b[ 9]),  .z(i[ 9]));
or02d2  ora   (.a1(a[10]), .a2(b[10]),  .z(i[10]));
or02d2  orb   (.a1(a[11]), .a2(b[11]),  .z(i[11]));
or02d2  orc   (.a1(a[12]), .a2(b[12]),  .z(i[12]));
or02d2  ord   (.a1(a[13]), .a2(b[13]),  .z(i[13]));
or02d2  ore   (.a1(a[14]), .a2(b[14]),  .z(i[14]));
or02d2  orf   (.a1(a[15]), .a2(b[15]),  .z(i[15]));

nr02d2  quork (.a1(i[ 2]), .a2(i[ 3]), .zn(qork));
nr02d2  quorj (.a1(i[ 4]), .a2(i[ 5]), .zn(qorj));
nr02d2  quori (.a1(i[ 6]), .a2(i[ 7]), .zn(qori));
nr02d2  quorh (.a1(i[ 8]), .a2(i[ 9]), .zn(qorh));
nr02d2  quorg (.a1(i[10]), .a2(i[11]), .zn(qorg));
nr02d2  quorf (.a1(i[12]), .a2(i[13]), .zn(qorf));
nr02d2  quore (.a1(i[14]), .a2(i[15]), .zn(qore));
an02d1h quord (.a1( qori), .a2( qorj),  .z(qord));
an02d1h quorc (.a1( qorg), .a2( qorh),  .z(qorc));
an02d1h quorb (.a1( qore), .a2( qorf),  .z(qorb));
an02d1h quora (.a1( qorb), .a2( qorc),  .z(qora));

assign  i1i[15] = i[15];
fn05d2  and1e (.a1(i[14]), .b1(i[15]), .zn(i1i[14]));
assign  i1i[13] = i[13];
fn05d2  and1c (.a1(i[12]), .b1(i[13]), .zn(i1i[12]));
assign  i1i[11] = i[11];
fn05d2  and1a (.a1(i[10]), .b1(i[11]), .zn(i1i[10]));
assign  i1i[ 9] = i[ 9];
fn05d2  and18 (.a1(i[ 8]), .b1(i[ 9]), .zn(i1i[ 8]));
assign  i1i[ 7] = i[ 7];
fn05d2  and16 (.a1(i[ 6]), .b1(i[ 7]), .zn(i1i[ 6]));
assign  i1i[ 5] = i[ 5];
fn05d2  and14 (.a1(i[ 4]), .b1(i[ 5]), .zn(i1i[ 4]));
assign  i1i[ 3] = i[ 3];
fn05d2  and12 (.a1(i[ 2]), .b1(i[ 3]), .zn(i1i[ 2]));
assign  i1i[ 1] = i[ 1];
fn05d2  and10 (.a1(i[ 0]), .b1(i[ 1]), .zn(i1i[ 0]));

assign  i2i[15] = i1i[15];
assign  i2i[14] = i1i[14];
an02d1h and2d (.a1(i1i[13]), .a2(qore), .z(i2i[13]));
an02d1h and2c (.a1(i1i[12]), .a2(qore), .z(i2i[12]));
assign  i2i[11] = i1i[11];
assign  i2i[10] = i1i[10];
an02d1h and29 (.a1(i1i[ 9]), .a2(qorg), .z(i2i[ 9]));
an02d1h and28 (.a1(i1i[ 8]), .a2(qorg), .z(i2i[ 8]));
assign  i2i[ 7] = i1i[ 7];
assign  i2i[ 6] = i1i[ 6];
an02d1h and25 (.a1(i1i[ 5]), .a2(qori), .z(i2i[ 5]));
an02d1h and24 (.a1(i1i[ 4]), .a2(qori), .z(i2i[ 4]));
assign  i2i[ 3] = i1i[ 3];
assign  i2i[ 2] = i1i[ 2];
an02d1h and21 (.a1(i1i[ 1]), .a2(qork), .z(i2i[ 1]));
an02d1h and20 (.a1(i1i[ 0]), .a2(qork), .z(i2i[ 0]));

assign  i3i[15] = i2i[15];
assign  i3i[14] = i2i[14];
assign  i3i[13] = i2i[13];
assign  i3i[12] = i2i[12];
an02d1h and3b (.a1(i2i[11]), .a2(qorb), .z(i3i[11]));
an02d1h and3a (.a1(i2i[10]), .a2(qorb), .z(i3i[10]));
an02d1h and39 (.a1(i2i[ 9]), .a2(qorb), .z(i3i[ 9]));
an02d1h and38 (.a1(i2i[ 8]), .a2(qorb), .z(i3i[ 8]));
assign  i3i[ 7] = i2i[ 7];
assign  i3i[ 6] = i2i[ 6];
assign  i3i[ 5] = i2i[ 5];
assign  i3i[ 4] = i2i[ 4];
an02d1h and33 (.a1(i2i[ 3]), .a2(qord), .z(i3i[ 3]));
an02d1h and32 (.a1(i2i[ 2]), .a2(qord), .z(i3i[ 2]));
an02d1h and31 (.a1(i2i[ 1]), .a2(qord), .z(i3i[ 1]));
an02d1h and30 (.a1(i2i[ 0]), .a2(qord), .z(i3i[ 0]));

assign  z[15] = i3i[15];
assign  z[14] = i3i[14];
assign  z[13] = i3i[13];
assign  z[12] = i3i[12];
assign  z[11] = i3i[11];
assign  z[10] = i3i[10];
assign  z[ 9] = i3i[ 9];
assign  z[ 8] = i3i[ 8];
an02d1h and47 (.a1(i3i[ 7]), .a2(qora), .z(z[ 7]));
an02d1h and46 (.a1(i3i[ 6]), .a2(qora), .z(z[ 6]));
an02d1h and45 (.a1(i3i[ 5]), .a2(qora), .z(z[ 5]));
an02d1h and44 (.a1(i3i[ 4]), .a2(qora), .z(z[ 4]));
an02d1h and43 (.a1(i3i[ 3]), .a2(qora), .z(z[ 3]));
an02d1h and42 (.a1(i3i[ 2]), .a2(qora), .z(z[ 2]));
an02d1h and41 (.a1(i3i[ 1]), .a2(qora), .z(z[ 1]));
an02d1h and40 (.a1(i3i[ 0]), .a2(qora), .z(z[ 0]));

endmodule // bl_max