update links for Makefile
[slipway.git] / misc / mpardemo.v
1 module half_add(a, b, s, c);
2   input a, b;
3   output s, c;
4   assign s = a ^ b;
5   assign c = a & b;
6 endmodule /* half_add */
7
8 module add(a, b, ci, o, co);
9    input a, b, ci;
10    output o, co;
11    wire c1, c2, x;
12    half_add h1(a, b,  x, c1);
13    half_add h2(x, ci, o, c2);
14    assign co = c1 | c2;
15 endmodule /* add */
16
17 module main(a, b, ci, out);
18
19    input  [7:0] a;
20    input  [7:0] b;
21    input        ci;
22    output [8:0] out;
23    wire   [7:0] c;
24
25    add a1(a[0], b[0], ci,   out[0], c[0]);
26    add a2(a[1], b[1], c[0], out[1], c[1]);
27    add a3(a[2], b[2], c[1], out[2], c[2]);
28    add a4(a[3], b[3], c[2], out[3], c[3]);
29    add a5(a[4], b[4], c[3], out[4], c[4]);
30    add a6(a[5], b[5], c[4], out[5], c[5]);
31    add a7(a[6], b[6], c[5], out[6], c[6]);
32    add a8(a[7], b[7], c[6], out[7], out[8]);
33
34 endmodule /* main */
35