-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* auto gen * add logic to repeat simulation of a file --------- Co-authored-by: Sanjit Basker <tijnasreksab@gmail.com>
- Loading branch information
1 parent
5707538
commit 54bc548
Showing
5 changed files
with
195 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import random | ||
|
||
inputs = [f'input{i}' for i in range(8)] | ||
vals = [f'0b{"".join(str(random.randint(0, 1)) for _ in range(32))}' for i in range(8)] | ||
print(' '.join(f'{a}={b}' for a, b in zip(inputs, vals))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
; cargo run -r -- -f gen_xor_cat.btor2 | ||
; many XORs followed by splitting the output into chunks | ||
1 sort bitvec 32 | ||
2 sort bitvec 64 | ||
3 sort bitvec 128 | ||
4 sort bitvec 256 | ||
5 sort bitvec 512 | ||
6 input 1 input0 | ||
7 input 1 input1 | ||
8 input 1 input2 | ||
9 input 1 input3 | ||
10 input 1 input4 | ||
11 input 1 input5 | ||
12 input 1 input6 | ||
13 input 1 input7 | ||
14 xor 1 8 12 | ||
15 xor 1 7 6 | ||
16 xor 1 12 10 | ||
17 xor 1 13 6 | ||
18 xor 1 10 6 | ||
19 xor 1 9 11 | ||
20 xor 1 8 6 | ||
21 xor 1 12 7 | ||
22 xor 1 10 9 | ||
23 xor 1 8 13 | ||
24 xor 1 9 12 | ||
25 xor 1 12 13 | ||
26 xor 1 13 12 | ||
27 xor 1 7 6 | ||
28 xor 1 9 8 | ||
29 xor 1 8 6 | ||
30 xor 1 28 18 | ||
31 xor 1 15 23 | ||
32 xor 1 29 22 | ||
33 xor 1 27 28 | ||
34 xor 1 24 27 | ||
35 xor 1 14 26 | ||
36 xor 1 19 29 | ||
37 xor 1 19 24 | ||
38 xor 1 24 24 | ||
39 xor 1 23 20 | ||
40 xor 1 17 18 | ||
41 xor 1 18 22 | ||
42 xor 1 23 25 | ||
43 xor 1 20 28 | ||
44 xor 1 27 16 | ||
45 xor 1 26 26 | ||
46 concat 2 30 31 | ||
47 concat 2 32 33 | ||
48 concat 2 34 35 | ||
49 concat 2 36 37 | ||
50 concat 2 38 39 | ||
51 concat 2 40 41 | ||
52 concat 2 42 43 | ||
53 concat 2 44 45 | ||
54 concat 3 46 47 | ||
55 concat 3 48 49 | ||
56 concat 3 50 51 | ||
57 concat 3 52 53 | ||
58 concat 4 54 55 | ||
59 concat 4 56 57 | ||
60 concat 5 58 59 | ||
61 slice 1 60 31 0 | ||
62 slice 1 60 63 32 | ||
63 slice 1 60 95 64 | ||
64 slice 1 60 127 96 | ||
65 slice 1 60 159 128 | ||
66 slice 1 60 191 160 | ||
67 slice 1 60 223 192 | ||
68 slice 1 60 255 224 | ||
69 output 61 output0 | ||
70 output 62 output1 | ||
71 output 63 output2 | ||
72 output 64 output3 | ||
73 output 65 output4 | ||
74 output 66 output5 | ||
75 output 67 output6 | ||
76 output 68 output7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
from random import randint | ||
|
||
"""; BTOR description generated by Yosys 0.33+65 (git sha1 90124dce5, clang 15.0.0 -fPIC -Os) for module std_neq. | ||
; ARGS: left=54321 right=12345 | ||
1 sort bitvec 32 | ||
2 input 1 left ; core.sv:167.34-167.38 | ||
3 input 1 right ; core.sv:168.34-168.39 | ||
4 sort bitvec 1 | ||
5 neq 4 2 3 | ||
6 output 5 out ; core.sv:169.18-169.21 | ||
; end of yosys output""" | ||
|
||
if __name__ == '__main__': | ||
starting_lines = [ | ||
'; many XORs followed by splitting the output into chunks' | ||
] + [f'{i} sort bitvec {16 * (2 ** i)}' for i in range(1, 6)] | ||
|
||
arg_lines = [] | ||
for node_id in range(6, 14): | ||
arg_lines.append(f'{node_id} input 1 input{node_id - 6}') | ||
|
||
xor_lines = [] | ||
for node_id in range(14, 30): | ||
xor_lines.append(f'{node_id} xor 1 {randint(6, 13)} {randint(6, 13)}') | ||
|
||
double_xor_lines = [] | ||
for node_id in range(30, 46): | ||
double_xor_lines.append(f'{node_id} xor 1 {randint(14, 29)} {randint(14, 29)}') | ||
|
||
concat_lines = [] | ||
for node_id in range(46, 54): | ||
first = 30 + 2 * (node_id - 46) | ||
second = first + 1 | ||
concat_lines.append(f'{node_id} concat 2 {first} {second}') | ||
|
||
for node_id in range(54, 58): | ||
first = 46 + 2 * (node_id - 54) | ||
second = first + 1 | ||
concat_lines.append(f'{node_id} concat 3 {first} {second}') | ||
|
||
for node_id in range(58, 60): | ||
first = 54 + 2 * (node_id - 58) | ||
second = first + 1 | ||
concat_lines.append(f'{node_id} concat 4 {first} {second}') | ||
|
||
concat_lines.append('60 concat 5 58 59') | ||
|
||
output_lines = [] | ||
curr_node_id = 61 | ||
curr_pos = 0 | ||
for i in range(2 ** 3): | ||
output_lines.append(f'{curr_node_id} slice 1 60 {curr_pos + 31} {curr_pos}') | ||
curr_pos += 32 | ||
curr_node_id += 1 | ||
|
||
for i in range(2 ** 3): | ||
output_lines.append(f'{curr_node_id} output {curr_node_id - 8} output{i}') | ||
curr_node_id += 1 | ||
|
||
print("\n".join(starting_lines)) | ||
print("\n".join(arg_lines)) | ||
print("\n".join(xor_lines)) | ||
print("\n".join(double_xor_lines)) | ||
print("\n".join(concat_lines)) | ||
print("\n".join(output_lines)) |