-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathInc16.hdl
27 lines (25 loc) · 1.09 KB
/
Inc16.hdl
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
/**
* 16-bit incrementer:
* out = in + 1 (arithmetic addition)
*/
CHIP Inc16 {
IN in[16];
OUT out[16];
PARTS:
HalfAdder(a=in[0], b=true, sum=out[0], carry=c0);
FullAdder(a=in[1], b=false, c=c0, sum=out[1], carry=c1);
FullAdder(a=in[2], b=false, c=c1, sum=out[2], carry=c2);
FullAdder(a=in[3], b=false, c=c2, sum=out[3], carry=c3);
FullAdder(a=in[4], b=false, c=c3, sum=out[4], carry=c4);
FullAdder(a=in[5], b=false, c=c4, sum=out[5], carry=c5);
FullAdder(a=in[6], b=false, c=c5, sum=out[6], carry=c6);
FullAdder(a=in[7], b=false, c=c6, sum=out[7], carry=c7);
FullAdder(a=in[8], b=false, c=c7, sum=out[8], carry=c8);
FullAdder(a=in[9], b=false, c=c8, sum=out[9], carry=c9);
FullAdder(a=in[10], b=false, c=c9, sum=out[10], carry=c10);
FullAdder(a=in[11], b=false, c=c10, sum=out[11], carry=c11);
FullAdder(a=in[12], b=false, c=c11, sum=out[12], carry=c12);
FullAdder(a=in[13], b=false, c=c12, sum=out[13], carry=c13);
FullAdder(a=in[14], b=false, c=c13, sum=out[14], carry=c14);
FullAdder(a=in[15], b=false, c=c14, sum=out[15], carry=c15);
}