bl_norm.v
2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
////////////////////////////////////////////////////////////////////////
//
// Project Reality
//
// module: bl_norm
// description: Generate norm to shift down greater delta z
// for blend unit.
//
// designer: Phil Gossett
// date: 8/14/94
//
////////////////////////////////////////////////////////////////////////
module bl_norm (new, old, norma, normb);
input [3:0] new;
input [3:0] old;
output [2:0] norma;
output [2:0] normb;
wire [3:0] n_l;
wire [3:0] o_l;
wire [4:0] diffa;
wire [4:0] diffb;
wire [2:0] ca;
wire [2:0] cb;
in01d2 inn0 (.i(new[0]), .zn(n_l[0]));
in01d2 inn1 (.i(new[1]), .zn(n_l[1]));
in01d2 inn2 (.i(new[2]), .zn(n_l[2]));
in01d2 inn3 (.i(new[3]), .zn(n_l[3]));
in01d2 ino0 (.i(old[0]), .zn(o_l[0]));
in01d2 ino1 (.i(old[1]), .zn(o_l[1]));
in01d2 ino2 (.i(old[2]), .zn(o_l[2]));
in01d2 ino3 (.i(old[3]), .zn(o_l[3]));
ad01d1h dfa0 (.ci( 1'b1), .a(new[0]), .b(o_l[0]), .s(diffa[0]), .co(ca[0]));
ad01d1h dfa1 (.ci(ca[0]), .a(new[1]), .b(o_l[1]), .s(diffa[1]), .co(ca[1]));
ad01d1h dfa2 (.ci(ca[1]), .a(new[2]), .b(o_l[2]), .s(diffa[2]), .co(ca[2]));
ad01d1h dfa3 (.ci(ca[2]), .a(new[3]), .b(o_l[3]), .s(diffa[3]),
.co(diffa[4])); // inv
ad01d1h dfb0 (.ci( 1'b1), .a(old[0]), .b(n_l[0]), .s(diffb[0]), .co(cb[0]));
ad01d1h dfb1 (.ci(cb[0]), .a(old[1]), .b(n_l[1]), .s(diffb[1]), .co(cb[1]));
ad01d1h dfb2 (.ci(cb[1]), .a(old[2]), .b(n_l[2]), .s(diffb[2]), .co(cb[2]));
ad01d1h dfb3 (.ci(cb[2]), .a(old[3]), .b(n_l[3]), .s(diffb[3]),
.co(diffb[4])); // inv
or02d2 oraa (.a1(diffa[2]), .a2(diffa[3]), .z(ora));
fn05d2 anaa (.a1(diffa[4]), .b1(ora), .zn(ana));
an02d1h ana2 (.a1(diffa[4]), .a2(ora), .z(norma[2]));
an02d1h ana1 (.a1(diffa[1]), .a2(ana), .z(norma[1]));
an02d1h ana0 (.a1(diffa[0]), .a2(ana), .z(norma[0]));
or02d2 orbb (.a1(diffb[2]), .a2(diffb[3]), .z(orb));
fn05d2 anbb (.a1(diffb[4]), .b1(orb), .zn(anb));
an02d1h anb2 (.a1(diffb[4]), .a2(orb), .z(normb[2]));
an02d1h anb1 (.a1(diffb[1]), .a2(anb), .z(normb[1]));
an02d1h anb0 (.a1(diffb[0]), .a2(anb), .z(normb[0]));
endmodule // bl_norm