blifutils 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ # Module sqrt8
2
+ # Generated by PICCOLO on Sunday 26 November 2017 at 17:05:04
3
+ # Defined line 6 from file "/home/theotime/Documents/projects/blifutils/test/sqrt8.piccolo"
4
+ #
5
+ # INTERFACE:
6
+ # Inputs: radicand<8>, go<1>
7
+ # Outputs: squareRoot<4>, done<1>
8
+ #
9
+ # NETLIST ANALYSIS:
10
+ #
11
+ # Number of components: ......................... 6
12
+ # Number of primitives: ......................... 0
13
+ # Maximum primitive input bit width: ............ 0
14
+ # Average primitive input bit width: ............ 0
15
+ #
16
+ # Number of inputs: ............................. 2
17
+ # Number of outputs: ............................ 2
18
+ # Number of input bits: ......................... 9
19
+ # Number of output bits: ........................ 5
20
+ #
21
+ # Number of nets: .............................. 16
22
+ # Maximum number of fanout per net: ............. 1
23
+ # Average number of fanout per net: ........... 1.0
24
+ #
25
+ # Number of instanciated modules: ............... 2
26
+ # Module Instances
27
+ # sqrt8_PO ....... 1
28
+ # sqrt8_PC ....... 1
29
+
30
+ .model sqrt8
31
+ .inputs radicand[7] radicand[6] radicand[5] radicand[4] radicand[3] radicand[2] radicand[1] radicand[0]
32
+ .inputs go[0]
33
+ .outputs squareRoot[3] squareRoot[2] squareRoot[1] squareRoot[0]
34
+ .outputs done[0]
35
+ .search sqrt8_PO.blif
36
+ .search sqrt8_PC.blif
37
+ .subckt sqrt8_PO radicand[0]=radicand[0] radicand[1]=radicand[1] radicand[2]=radicand[2] radicand[3]=radicand[3] radicand[4]=radicand[4] radicand[5]=radicand[5] radicand[6]=radicand[6] radicand[7]=radicand[7] state[0]=n0 state[1]=n1 squareRoot[0]=squareRoot[0] squareRoot[1]=squareRoot[1] squareRoot[2]=squareRoot[2] squareRoot[3]=squareRoot[3]
38
+ .subckt sqrt8_PC go[0]=go[0] done[0]=done[0] state[0]=n0 state[1]=n1
39
+ .end
40
+
@@ -0,0 +1,132 @@
1
+ /* This module computes 8-bit square root
2
+ * It is completely expanded so that each part can be seen in yEd
3
+ */
4
+
5
+
6
+ module sqrt8(input<8> radicand, input go, output<4> squareRoot, output done) :
7
+ wire<2> state
8
+ {
9
+ instance sqrt8_PC(go, done, state);
10
+ instance sqrt8_PO(radicand, state, squareRoot);
11
+ }
12
+
13
+
14
+ module sqrt8_PO(input<8> radicand, input<2> state, output<4> squareRoot) :
15
+ wire<4> sqrtr,
16
+ wire fbit
17
+ {
18
+ instance sqrt8_PO_work(state, radicand, sqrtr, fbit);
19
+ instance sqrt8_PO_sqrtr(state, fbit, sqrtr);
20
+ instance sqrt8_PO_output(state, sqrtr, squareRoot);
21
+ }
22
+
23
+
24
+ module sqrt8_PO_work(input<2> state, input<8> radicand, input<4> sqrtr, output fbit) :
25
+ reg<16> work,
26
+ wire<8> diff
27
+ {
28
+ diff = work[15:8] - (2b00 : sqrtr : 2b01);
29
+ fbit = diff[7];
30
+
31
+ switch (state) {
32
+ case 'd1:
33
+ work = work[13:0] : 2b00;
34
+ case 'd2:
35
+ if (!fbit) {
36
+ work[15:8] = diff;
37
+ }
38
+ default:
39
+ work = 8b0 : radicand;
40
+ }
41
+ }
42
+
43
+
44
+ module sqrt8_PO_sqrtr(input<2> state, input fbit, output<4> sqrtr) :
45
+ reg<4> sqrtrInt
46
+ {
47
+ switch (state) {
48
+ case 'd0:
49
+ sqrtrInt = 'b0;
50
+ case 'd2:
51
+ sqrtrInt = sqrtrInt[2:0] : (~fbit);
52
+ }
53
+
54
+ sqrtr = sqrtrInt;
55
+ }
56
+
57
+
58
+ module sqrt8_PO_output(input<2> state, input<4> sqrtr, output<4> squareRoot) :
59
+ reg<4> squareRootInt
60
+ {
61
+ switch (state) {
62
+ case 'd3:
63
+ squareRootInt = sqrtr;
64
+ }
65
+
66
+ squareRoot = squareRootInt;
67
+ }
68
+
69
+
70
+ module sqrt8_PC(input go, output done, output<2> state) :
71
+ wire<2> counter
72
+ {
73
+ instance sqrt8_PC_state(go, counter, state);
74
+ instance sqrt8_PC_counter(state, counter);
75
+ instance sqrt8_PC_done(state, done);
76
+ }
77
+
78
+
79
+ module sqrt8_PC_done(input<2> state, output done) :
80
+ reg doneInt
81
+ {
82
+ switch (state) {
83
+ case 'd3:
84
+ doneInt = 'b1;
85
+ default:
86
+ doneInt = 'b0;
87
+ }
88
+
89
+ done = doneInt;
90
+ }
91
+
92
+
93
+ module sqrt8_PC_counter(input<2> state, output<2> counter) :
94
+ reg<2> counterInt
95
+ {
96
+ switch (state) {
97
+ case 'd0:
98
+ counterInt = 'd0;
99
+ case 'd2:
100
+ counterInt = counterInt + 'd1;
101
+ }
102
+
103
+ counter = counterInt;
104
+ }
105
+
106
+
107
+ module sqrt8_PC_state(input go, input<2> counter, output<2> state) :
108
+ reg<2> stateInt := 'd0
109
+ {
110
+ switch (stateInt) {
111
+ case 'd0:
112
+ if (go) {
113
+ stateInt = 'd1;
114
+ }
115
+
116
+ case 'd1:
117
+ stateInt = 'd2;
118
+
119
+ case 'd2:
120
+ if (counter == 'd3) {
121
+ stateInt = 'd3;
122
+ } else {
123
+ stateInt = 'd1;
124
+ }
125
+
126
+ case 'd3:
127
+ stateInt = 'd0;
128
+ }
129
+
130
+ state = stateInt;
131
+ }
132
+
@@ -0,0 +1,43 @@
1
+ # Module sqrt8_PC
2
+ # Generated by PICCOLO on Sunday 26 November 2017 at 17:05:04
3
+ # Defined line 70 from file "/home/theotime/Documents/projects/blifutils/test/sqrt8.piccolo"
4
+ #
5
+ # INTERFACE:
6
+ # Inputs: go<1>
7
+ # Outputs: done<1>, state<2>
8
+ #
9
+ # NETLIST ANALYSIS:
10
+ #
11
+ # Number of components: ......................... 6
12
+ # Number of primitives: ......................... 0
13
+ # Maximum primitive input bit width: ............ 0
14
+ # Average primitive input bit width: ............ 0
15
+ #
16
+ # Number of inputs: ............................. 1
17
+ # Number of outputs: ............................ 2
18
+ # Number of input bits: ......................... 1
19
+ # Number of output bits: ........................ 3
20
+ #
21
+ # Number of nets: ............................... 6
22
+ # Maximum number of fanout per net: ............. 3
23
+ # Average number of fanout per net: ........... 1.7
24
+ #
25
+ # Number of instanciated modules: ............... 3
26
+ # Module Instances
27
+ # sqrt8_PC_done .......... 1
28
+ # sqrt8_PC_state ......... 1
29
+ # sqrt8_PC_counter ....... 1
30
+
31
+ .model sqrt8_PC
32
+ .inputs _clk_
33
+ .inputs go[0]
34
+ .outputs done[0]
35
+ .outputs state[1] state[0]
36
+ .search sqrt8_PC_done.blif
37
+ .search sqrt8_PC_state.blif
38
+ .search sqrt8_PC_counter.blif
39
+ .subckt sqrt8_PC_done state[0]=state[0] state[1]=state[1] done[0]=done[0] _clk_=_clk_
40
+ .subckt sqrt8_PC_state go[0]=go[0] counter[0]=n0 counter[1]=n1 state[0]=state[0] state[1]=state[1] _clk_=_clk_
41
+ .subckt sqrt8_PC_counter state[0]=state[0] state[1]=state[1] counter[0]=n0 counter[1]=n1 _clk_=_clk_
42
+ .end
43
+
@@ -0,0 +1,61 @@
1
+ # Module sqrt8_PC_counter
2
+ # Generated by PICCOLO on Sunday 26 November 2017 at 17:05:04
3
+ # Defined line 93 from file "/home/theotime/Documents/projects/blifutils/test/sqrt8.piccolo"
4
+ #
5
+ # INTERFACE:
6
+ # Inputs: state<2>
7
+ # Outputs: counter<2>
8
+ #
9
+ # NETLIST ANALYSIS:
10
+ #
11
+ # Number of components: ......................... 8
12
+ # Number of primitives: ......................... 6
13
+ # Maximum primitive input bit width: ............ 4
14
+ # Average primitive input bit width: .......... 2.2
15
+ #
16
+ # Number of inputs: ............................. 1
17
+ # Number of outputs: ............................ 1
18
+ # Number of input bits: ......................... 2
19
+ # Number of output bits: ........................ 2
20
+ #
21
+ # Number of nets: ............................... 8
22
+ # Maximum number of fanout per net: ............. 4
23
+ # Average number of fanout per net: ........... 1.9
24
+ #
25
+ # Number of instanciated modules: ............... 0
26
+ #
27
+ # Primitives:
28
+ # Single output selector ........................ 2
29
+ # Register ...................................... 2
30
+ # Single output NOT gate ........................ 1
31
+ # Single output XOR gate ........................ 1
32
+ #
33
+ # Number of register bits: ...................... 2
34
+ # Number of constant bits: ...................... 0
35
+ #
36
+ # Maximum selector total input bit width: ....... 4
37
+ # Average selector total input bit width: ..... 4.0
38
+ # Maximum selector input bit width: ............. 2
39
+ # Average selector input bit width: ........... 2.0
40
+ # Maximum selector selector bit width: .......... 2
41
+ # Average selector selector bit width: ........ 2.0
42
+
43
+ .model sqrt8_PC_counter
44
+ .inputs _clk_
45
+ .inputs state[1] state[0]
46
+ .outputs counter[1] counter[0]
47
+ .latch n0 counter[0] re _clk_ 0
48
+ .latch n1 counter[1] re _clk_ 0
49
+ .names counter[1] counter[0] n3
50
+ 10 1
51
+ 01 1
52
+ .names state[0] state[1] counter[0] n2 n0
53
+ 1-1- 1
54
+ 01-1 1
55
+ .names state[0] state[1] counter[1] n3 n1
56
+ 1-1- 1
57
+ 01-1 1
58
+ .names counter[0] n2
59
+ 0 1
60
+ .end
61
+
@@ -0,0 +1,49 @@
1
+ # Module sqrt8_PC_done
2
+ # Generated by PICCOLO on Sunday 26 November 2017 at 17:05:04
3
+ # Defined line 79 from file "/home/theotime/Documents/projects/blifutils/test/sqrt8.piccolo"
4
+ #
5
+ # INTERFACE:
6
+ # Inputs: state<2>
7
+ # Outputs: done<1>
8
+ #
9
+ # NETLIST ANALYSIS:
10
+ #
11
+ # Number of components: ......................... 4
12
+ # Number of primitives: ......................... 2
13
+ # Maximum primitive input bit width: ............ 2
14
+ # Average primitive input bit width: .......... 1.5
15
+ #
16
+ # Number of inputs: ............................. 1
17
+ # Number of outputs: ............................ 1
18
+ # Number of input bits: ......................... 2
19
+ # Number of output bits: ........................ 1
20
+ #
21
+ # Number of nets: ............................... 4
22
+ # Maximum number of fanout per net: ............. 1
23
+ # Average number of fanout per net: ........... 1.0
24
+ #
25
+ # Number of instanciated modules: ............... 0
26
+ #
27
+ # Primitives:
28
+ # Single output selector ........................ 1
29
+ # Register ...................................... 1
30
+ #
31
+ # Number of register bits: ...................... 1
32
+ # Number of constant bits: ...................... 0
33
+ #
34
+ # Maximum selector total input bit width: ....... 2
35
+ # Average selector total input bit width: ..... 2.0
36
+ # Maximum selector input bit width: ............. 0
37
+ # Average selector input bit width: ........... 0.0
38
+ # Maximum selector selector bit width: .......... 2
39
+ # Average selector selector bit width: ........ 2.0
40
+
41
+ .model sqrt8_PC_done
42
+ .inputs _clk_
43
+ .inputs state[1] state[0]
44
+ .outputs done[0]
45
+ .latch n0 done[0] re _clk_ 0
46
+ .names state[0] state[1] n0
47
+ 11 1
48
+ .end
49
+
@@ -0,0 +1,68 @@
1
+ # Module sqrt8_PC_state
2
+ # Generated by PICCOLO on Sunday 26 November 2017 at 17:05:04
3
+ # Defined line 107 from file "/home/theotime/Documents/projects/blifutils/test/sqrt8.piccolo"
4
+ #
5
+ # INTERFACE:
6
+ # Inputs: go<1>, counter<2>
7
+ # Outputs: state<2>
8
+ #
9
+ # NETLIST ANALYSIS:
10
+ #
11
+ # Number of components: ........................ 11
12
+ # Number of primitives: ......................... 8
13
+ # Maximum primitive input bit width: ............ 5
14
+ # Average primitive input bit width: .......... 2.0
15
+ #
16
+ # Number of inputs: ............................. 2
17
+ # Number of outputs: ............................ 1
18
+ # Number of input bits: ......................... 3
19
+ # Number of output bits: ........................ 2
20
+ #
21
+ # Number of nets: .............................. 11
22
+ # Maximum number of fanout per net: ............. 4
23
+ # Average number of fanout per net: ........... 1.6
24
+ #
25
+ # Number of instanciated modules: ............... 0
26
+ #
27
+ # Primitives:
28
+ # Single output NOT gate ........................ 3
29
+ # Single output selector ........................ 2
30
+ # Register ...................................... 2
31
+ # Single output OR gate ........................ 1
32
+ #
33
+ # Number of register bits: ...................... 2
34
+ # Number of constant bits: ...................... 0
35
+ #
36
+ # Maximum selector total input bit width: ....... 5
37
+ # Average selector total input bit width: ..... 4.5
38
+ # Maximum selector input bit width: ............. 2
39
+ # Average selector input bit width: ........... 1.5
40
+ # Maximum selector selector bit width: .......... 3
41
+ # Average selector selector bit width: ........ 3.0
42
+
43
+ .model sqrt8_PC_state
44
+ .inputs _clk_
45
+ .inputs go[0]
46
+ .inputs counter[1] counter[0]
47
+ .outputs state[1] state[0]
48
+ .latch n0 state[0] re _clk_ 0
49
+ .latch n1 state[1] re _clk_ 0
50
+ .names n4 n5 n3
51
+ 1- 1
52
+ -1 1
53
+ .names n3 n2
54
+ 0 1
55
+ .names go[0] state[0] state[1] state[0] n0
56
+ 10-- 1
57
+ -01- 1
58
+ 0001 1
59
+ .names go[0] state[0] state[1] n2 state[1] n1
60
+ -10-- 1
61
+ -011- 1
62
+ 000-1 1
63
+ .names counter[0] n4
64
+ 0 1
65
+ .names counter[1] n5
66
+ 0 1
67
+ .end
68
+
@@ -0,0 +1,43 @@
1
+ # Module sqrt8_PO
2
+ # Generated by PICCOLO on Sunday 26 November 2017 at 17:05:04
3
+ # Defined line 14 from file "/home/theotime/Documents/projects/blifutils/test/sqrt8.piccolo"
4
+ #
5
+ # INTERFACE:
6
+ # Inputs: radicand<8>, state<2>
7
+ # Outputs: squareRoot<4>
8
+ #
9
+ # NETLIST ANALYSIS:
10
+ #
11
+ # Number of components: ......................... 6
12
+ # Number of primitives: ......................... 0
13
+ # Maximum primitive input bit width: ............ 0
14
+ # Average primitive input bit width: ............ 0
15
+ #
16
+ # Number of inputs: ............................. 2
17
+ # Number of outputs: ............................ 1
18
+ # Number of input bits: ........................ 10
19
+ # Number of output bits: ........................ 4
20
+ #
21
+ # Number of nets: .............................. 19
22
+ # Maximum number of fanout per net: ............. 3
23
+ # Average number of fanout per net: ........... 1.4
24
+ #
25
+ # Number of instanciated modules: ............... 3
26
+ # Module Instances
27
+ # sqrt8_PO_output ....... 1
28
+ # sqrt8_PO_sqrtr ........ 1
29
+ # sqrt8_PO_work ......... 1
30
+
31
+ .model sqrt8_PO
32
+ .inputs _clk_
33
+ .inputs radicand[7] radicand[6] radicand[5] radicand[4] radicand[3] radicand[2] radicand[1] radicand[0]
34
+ .inputs state[1] state[0]
35
+ .outputs squareRoot[3] squareRoot[2] squareRoot[1] squareRoot[0]
36
+ .search sqrt8_PO_output.blif
37
+ .search sqrt8_PO_sqrtr.blif
38
+ .search sqrt8_PO_work.blif
39
+ .subckt sqrt8_PO_output state[0]=state[0] state[1]=state[1] sqrtr[0]=n0 sqrtr[1]=n1 sqrtr[2]=n2 sqrtr[3]=n3 squareRoot[0]=squareRoot[0] squareRoot[1]=squareRoot[1] squareRoot[2]=squareRoot[2] squareRoot[3]=squareRoot[3] _clk_=_clk_
40
+ .subckt sqrt8_PO_sqrtr state[0]=state[0] state[1]=state[1] fbit[0]=n4 sqrtr[0]=n0 sqrtr[1]=n1 sqrtr[2]=n2 sqrtr[3]=n3 _clk_=_clk_
41
+ .subckt sqrt8_PO_work state[0]=state[0] state[1]=state[1] radicand[0]=radicand[0] radicand[1]=radicand[1] radicand[2]=radicand[2] radicand[3]=radicand[3] radicand[4]=radicand[4] radicand[5]=radicand[5] radicand[6]=radicand[6] radicand[7]=radicand[7] sqrtr[0]=n0 sqrtr[1]=n1 sqrtr[2]=n2 sqrtr[3]=n3 fbit[0]=n4 _clk_=_clk_
42
+ .end
43
+
@@ -0,0 +1,67 @@
1
+ # Module sqrt8_PO_output
2
+ # Generated by PICCOLO on Sunday 26 November 2017 at 17:05:04
3
+ # Defined line 58 from file "/home/theotime/Documents/projects/blifutils/test/sqrt8.piccolo"
4
+ #
5
+ # INTERFACE:
6
+ # Inputs: state<2>, sqrtr<4>
7
+ # Outputs: squareRoot<4>
8
+ #
9
+ # NETLIST ANALYSIS:
10
+ #
11
+ # Number of components: ........................ 11
12
+ # Number of primitives: ......................... 8
13
+ # Maximum primitive input bit width: ............ 4
14
+ # Average primitive input bit width: .......... 2.5
15
+ #
16
+ # Number of inputs: ............................. 2
17
+ # Number of outputs: ............................ 1
18
+ # Number of input bits: ......................... 6
19
+ # Number of output bits: ........................ 4
20
+ #
21
+ # Number of nets: .............................. 14
22
+ # Maximum number of fanout per net: ............. 4
23
+ # Average number of fanout per net: ........... 1.7
24
+ #
25
+ # Number of instanciated modules: ............... 0
26
+ #
27
+ # Primitives:
28
+ # Single output selector ........................ 4
29
+ # Register ...................................... 4
30
+ #
31
+ # Number of register bits: ...................... 4
32
+ # Number of constant bits: ...................... 0
33
+ #
34
+ # Maximum selector total input bit width: ....... 4
35
+ # Average selector total input bit width: ..... 4.0
36
+ # Maximum selector input bit width: ............. 2
37
+ # Average selector input bit width: ........... 2.0
38
+ # Maximum selector selector bit width: .......... 2
39
+ # Average selector selector bit width: ........ 2.0
40
+
41
+ .model sqrt8_PO_output
42
+ .inputs _clk_
43
+ .inputs state[1] state[0]
44
+ .inputs sqrtr[3] sqrtr[2] sqrtr[1] sqrtr[0]
45
+ .outputs squareRoot[3] squareRoot[2] squareRoot[1] squareRoot[0]
46
+ .latch n0 squareRoot[0] re _clk_ 0
47
+ .latch n1 squareRoot[1] re _clk_ 0
48
+ .latch n2 squareRoot[2] re _clk_ 0
49
+ .latch n3 squareRoot[3] re _clk_ 0
50
+ .names state[0] state[1] squareRoot[0] sqrtr[0] n0
51
+ -01- 1
52
+ 0-1- 1
53
+ 11-1 1
54
+ .names state[0] state[1] squareRoot[1] sqrtr[1] n1
55
+ -01- 1
56
+ 0-1- 1
57
+ 11-1 1
58
+ .names state[0] state[1] squareRoot[2] sqrtr[2] n2
59
+ -01- 1
60
+ 0-1- 1
61
+ 11-1 1
62
+ .names state[0] state[1] squareRoot[3] sqrtr[3] n3
63
+ -01- 1
64
+ 0-1- 1
65
+ 11-1 1
66
+ .end
67
+