Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/word level structures #571

Draft
wants to merge 264 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
264 commits
Select commit Hold shift + click to select a range
3de3a33
cleanup cmake
SJulianS Jul 3, 2023
90c4e10
new get_net_gates API and pybind support
SJulianS Jul 3, 2023
cb57895
pybind and doc fixes
SJulianS Jul 4, 2023
a8603f1
small changes to resynthesis and added basic hal gate libraries
SimonKlx Jul 4, 2023
9efb659
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jul 4, 2023
2998d30
cmake god
nils1603 Jul 4, 2023
295e3f3
cmake god
nils1603 Jul 4, 2023
5980f54
added mux preprocessing as well as some more smaller hal gate libs
SimonKlx Jul 4, 2023
ba50cb1
added genlib writer plugins and some more gate libs
SimonKlx Jul 5, 2023
dd797d0
added missing include
nils1603 Jul 5, 2023
d95736e
added constant propagation in netlist preprocessing.
SimonKlx Jul 5, 2023
c878dae
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jul 5, 2023
7be2ffd
small fix to the removal of unused lut endpoints
SimonKlx Jul 5, 2023
b2edc34
added yosys for resynth
nils1603 Jul 5, 2023
101d764
added yosys for resynth
nils1603 Jul 5, 2023
7615b6b
added better error handling
nils1603 Jul 6, 2023
04108df
potential verilog writer fix (untested, Nils will find out)
SJulianS Jul 6, 2023
858225d
Nils found out (fix untested of course)
SJulianS Jul 6, 2023
75a3797
probably fixed GND and VCC nets
SJulianS Jul 6, 2023
4cf13de
only assign value to gcc/vcc nets if they have no source
SJulianS Jul 6, 2023
4f03be5
prettify indentation
SJulianS Jul 6, 2023
47f8a80
small changes to the netlist resysnthesis
SimonKlx Jul 6, 2023
af4a3ab
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jul 6, 2023
068e500
preprocessing for known net groups
SJulianS Jul 6, 2023
4f86877
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Jul 6, 2023
cdf4f87
known structures from gate types
SJulianS Jul 6, 2023
1fadfba
new passes being executed only if known structures are provided (unte…
SJulianS Jul 6, 2023
1870b15
small bug fix to netlist preprocessing
SimonKlx Jul 7, 2023
2b8fac7
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jul 7, 2023
b6c8d5a
improved performance for remove_redundant_logic
SJulianS Jul 7, 2023
83f2c26
added EDIF parser (non-functional)
SJulianS Jul 10, 2023
2edbdab
hacked support for EDIF parsing in GUI
SJulianS Jul 10, 2023
8d74e39
still no working EDIF parser
SJulianS Jul 10, 2023
e833d88
state
SJulianS Jul 11, 2023
bcd4009
fixed build error
SJulianS Jul 11, 2023
0e1728a
updated lattice gate lib
nils1603 Jul 11, 2023
47726b0
lattice gate lib
nils1603 Jul 11, 2023
35eb1c4
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jul 11, 2023
f52bfc4
added and to lib for yosys to work
nils1603 Jul 11, 2023
a4ddaa7
fixed bug in mux select unify
nils1603 Jul 11, 2023
ff29a1c
bug fix in mux simplify
nils1603 Jul 11, 2023
9072119
renamed gate lib
SJulianS Jul 11, 2023
5370d13
remove redundant loops (currently only removes the FFs of these loops)
SJulianS Jul 11, 2023
04ba53f
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Jul 11, 2023
ba70fa1
Merge branch 'master' into feature/word_level_structures
SJulianS Jul 11, 2023
b38fc85
Merge branch 'master' into feature/word_level_structures
SJulianS Jul 11, 2023
344d7f2
netlist pre
nils1603 Jul 11, 2023
512dc81
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jul 11, 2023
2292c42
only propagate through combinational logic
SJulianS Jul 12, 2023
289494e
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jul 12, 2023
ef56a0e
state
SJulianS Jul 12, 2023
8512807
state
SJulianS Jul 13, 2023
e74f337
disabled multithreading
nils1603 Jul 13, 2023
4809daf
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jul 13, 2023
84a0c58
check netlist and gate lib for nullpointer
SJulianS Jul 14, 2023
ac9536d
fixed
SJulianS Jul 14, 2023
9c709e3
new bitwuzla version
nils1603 Jul 15, 2023
f5cb7e6
bitwuzla
nils1603 Jul 15, 2023
5b8bf6a
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jul 15, 2023
9403656
changed module pin group deduction to be based on gate pin name and n…
SJulianS Jul 16, 2023
a0f73ed
some documentation fixes
SJulianS Jul 16, 2023
50ccb85
fixed container overflows
SJulianS Jul 16, 2023
95a8efe
small fix to tmp path in boolean influence
SimonKlx Jul 17, 2023
77037fd
fix for the manual mux optimizations and the resynthesis only deletin…
SimonKlx Jul 17, 2023
7432a2a
added better return number for mux optimizations that reflect whether…
SimonKlx Jul 17, 2023
e8888a2
parse nets
SJulianS Jul 18, 2023
3ea200d
fix error message
SJulianS Jul 18, 2023
fe6298e
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Jul 18, 2023
63a5197
added gate to gate libs
nils1603 Jul 18, 2023
7e41af5
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jul 18, 2023
2968142
added remove_consecutive_inverters
SJulianS Jul 18, 2023
9ed18d9
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Jul 18, 2023
7ad9b6a
bug fix for mux optimizations
SimonKlx Jul 18, 2023
14dcd73
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jul 18, 2023
cc0eb42
start implementing instantiation
SJulianS Jul 21, 2023
2d73321
Merge branch 'master' into feature/word_level_structures
SJulianS Jul 26, 2023
fe29bf4
updated HAL gate libs
SJulianS Jul 26, 2023
85fdabb
edif parser sadness
SJulianS Jul 31, 2023
32251d1
added yosys verilog lib for helper libs
nils1603 Aug 1, 2023
cb28401
added subgraph preprocessing
nils1603 Aug 2, 2023
0406ddd
fixes
SJulianS Aug 3, 2023
06739e1
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Aug 3, 2023
dc90504
Merge branch 'master' into feature/word_level_structures
SJulianS Aug 3, 2023
8176127
Merge branch 'master' into feature/word_level_structures
SJulianS Aug 3, 2023
1a961af
added helper lib for netlist preprocessing
nils1603 Aug 3, 2023
34acfd4
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Aug 3, 2023
a568e8a
fixed pin group order, pins should be fine now
SJulianS Aug 3, 2023
7f67458
added HAL_MUX5,6,7,8
nils1603 Aug 4, 2023
ab8b09f
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Aug 4, 2023
a299acb
updated boolean influence
nils1603 Aug 18, 2023
9186d3c
added qprocess to boolean influnce
nils1603 Aug 21, 2023
0fa929d
updated booleadn influence
nils1603 Aug 22, 2023
c2f298f
WIP - added annotations for replaced gates and adjusted compare netli…
SimonKlx Aug 23, 2023
a17e1c6
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Aug 23, 2023
f7e25f2
work on netlist comparison as well as small changes to SMT solver
SimonKlx Aug 25, 2023
d7ef73f
added ff dependency graph to igraph
nils1603 Aug 26, 2023
4dd0953
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Aug 26, 2023
30a514b
current working state of netlist comparison.
SimonKlx Aug 28, 2023
2fc0143
ajusted some log levels and added back color to stdout log to make co…
SimonKlx Aug 30, 2023
1b52944
working netlist/net comparison and netlist resynthesis
SimonKlx Aug 31, 2023
45e3302
small fix to python bindings
SimonKlx Aug 31, 2023
4f34fe1
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Aug 31, 2023
c5b3719
added error case to the pin to pin group assignment
SimonKlx Sep 4, 2023
d02e15c
small change to the temp directory generation utils function and adde…
Sep 6, 2023
129b8cd
speed up to simplification by omitting construction of negated parame…
SimonKlx Sep 6, 2023
f49a4bc
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Sep 6, 2023
86edd9d
speed up to simplification by omitting construction of negated parame…
SimonKlx Sep 6, 2023
1567dc6
speed up to simplification by omitting construction of negated parame…
SimonKlx Sep 6, 2023
bf0ed10
updated bitwuzla
nils1603 Sep 8, 2023
4229228
updated bitwuzla
nils1603 Sep 8, 2023
c586bda
fixed bitwuzla library request
nils1603 Sep 11, 2023
68ac9d2
fixed linker inlcude for bitwuzla
nils1603 Sep 11, 2023
fb68a73
added allowed pin types to get_next_sequential_gates
nils1603 Sep 12, 2023
ff71bda
merged master
nils1603 Sep 15, 2023
4b3fccf
revert bitwuzla
nils1603 Sep 18, 2023
ec58209
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Sep 18, 2023
a79bb14
proposed fix to the known group passes.
SimonKlx Sep 18, 2023
d350ce1
made folder creation unique in boolean influence
nils1603 Sep 19, 2023
e1add11
fix linker warning
SJulianS Sep 25, 2023
34bb8e7
fix ABC weirdness
SJulianS Sep 25, 2023
dd2530e
some EDIF progress
SJulianS Sep 25, 2023
a16cb51
added netlist preprocessing interface for gate resynth
SimonKlx Sep 25, 2023
890bc6e
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Sep 25, 2023
4dd9609
commented out faulty edif parser and changed process generation in bo…
Sep 28, 2023
f9da1a3
new bf influence with hal types
nils1603 Sep 29, 2023
e1e6a4c
Merge branch 'master' into feature/word_level_structures
SJulianS Oct 5, 2023
729721e
Merge branch 'master' into feature/word_level_structures
SimonKlx Oct 9, 2023
acd7faa
added netlist preprocessing info, small change to dana pass and other…
Oct 11, 2023
72a08aa
fixed clang bug
nils1603 Oct 11, 2023
73ed109
potential bug fix to constant propagation of slice operator.
SimonKlx Oct 16, 2023
c0b3cb3
fixed testcase for slice constant propagation.
SimonKlx Oct 16, 2023
58a1b0c
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Oct 16, 2023
8179044
Merge branch 'master' into feature/word_level_structures
SimonKlx Oct 18, 2023
a520109
added fancier (untested) next_gates functions
SJulianS Oct 19, 2023
06948bc
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Oct 19, 2023
71599ee
modified gate lib
nils1603 Oct 19, 2023
bfdf9d5
smnall performance optimization in the verilog parser.
SimonKlx Oct 20, 2023
fc660a7
changed subgrapgh decorator to generate boolean function of net witho…
SimonKlx Oct 20, 2023
005e012
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Oct 20, 2023
3c79ebf
fixed error i introduced to the verilog parser.
SimonKlx Oct 21, 2023
6256482
update to the bitorder propagation
SimonKlx Oct 23, 2023
8e1c4c0
fixed parser bug
SJulianS Oct 23, 2023
51c5254
removed VCC/GND from lattice lib
nils1603 Oct 23, 2023
bca4615
fix to SMT slice translation and small bitorder tweaks.
SimonKlx Oct 23, 2023
adcca15
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Oct 23, 2023
55bfe06
Merge branch 'master' into feature/word_level_structures
SJulianS Oct 24, 2023
8d45068
updated gate lib
nils1603 Oct 31, 2023
7194edd
small fix to the bitorder propagation
Nov 6, 2023
d2c4aad
WIP fast finite set implementation
SJulianS Nov 13, 2023
4189e58
Merge branch 'master' into feature/word_level_structures
SJulianS Nov 13, 2023
1445f28
finished finite set and added tests
SJulianS Nov 13, 2023
2d68e3f
Merge branch 'master' into feature/word_level_structures
SJulianS Nov 13, 2023
a1257ed
improve memory usage
SJulianS Nov 13, 2023
ef5c436
added Error checks for multi bit gate module creation
Nov 14, 2023
32e86ec
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
Nov 14, 2023
14f585b
added optional filter to get_num_of_sources/destinations
SJulianS Nov 14, 2023
e6dbf6f
added insertion by iterator to FiniteSet
SJulianS Nov 14, 2023
a087153
added and, invert, xor gate lib
SJulianS Nov 14, 2023
9e2ea39
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Nov 14, 2023
bbcacd0
latest and greatest version of the bitorder propagation
SimonKlx Nov 15, 2023
41d0c74
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Nov 15, 2023
104a76c
Merge branch 'master' into feature/word_level_structures
SJulianS Nov 20, 2023
e958a5e
Merge branch 'master' into feature/word_level_structures
SJulianS Nov 22, 2023
fc699ed
Merge branch 'master' into feature/word_level_structures
nils1603 Nov 29, 2023
b70b9ef
Merge branch 'master' into feature/word_level_structures
nils1603 Nov 29, 2023
02f1246
Merge branch 'master' into feature/word_level_structures
nils1603 Nov 29, 2023
0e816ca
Merge branch 'master' into feature/word_level_structures
nils1603 Nov 29, 2023
7481603
state
Dec 21, 2023
662b181
merge
Dec 21, 2023
bade968
partial python support for gate type creation
SJulianS Jan 4, 2024
3e1cced
first clean up of bit order propagation
Jan 11, 2024
8df574b
Feature/bitwuzla word level (#553)
nils1603 Jan 19, 2024
9c7d215
merged master
nils1603 Jan 19, 2024
63d6011
added z3 library call
SimonKlx Jan 19, 2024
95ce5f3
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jan 19, 2024
1112b05
added caching to bitorder propagation connectivity search.
Jan 23, 2024
b3c8ad4
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
Jan 23, 2024
0c8611f
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jan 23, 2024
73ed4da
merged master
nils1603 Jan 24, 2024
e826dfe
added bitwuzla utils
nils1603 Jan 24, 2024
9872630
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jan 24, 2024
e45e64e
changes to bitwuzla utils
SimonKlx Jan 24, 2024
49a5b3a
bitwuzla subgraph generation
SimonKlx Jan 24, 2024
4b864f3
added from_bf to bitwuzla_utils
nils1603 Jan 24, 2024
8a87b8d
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jan 24, 2024
197aba7
state
SimonKlx Jan 24, 2024
a579f39
added tests
nils1603 Jan 24, 2024
8e4989b
added to_bf
nils1603 Jan 24, 2024
803668d
added tests for bw utils
nils1603 Jan 24, 2024
7816c8b
added test function for subgrapg function generation
SimonKlx Jan 24, 2024
e788dd5
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jan 24, 2024
8418fd4
added bitwuzla utils to git ignore exemption
SimonKlx Jan 24, 2024
e23a260
fixed bitwuzla cmake include, fixed python bindings
nils1603 Jan 24, 2024
f3ed3c5
fixed bitwuzla kind in from_bf function
nils1603 Jan 24, 2024
d48b201
state
SimonKlx Jan 24, 2024
0d387c9
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jan 24, 2024
19dc8a8
state
nils1603 Jan 24, 2024
f852cc2
compelete to_bf
SimonKlx Jan 24, 2024
aef7ed4
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Jan 24, 2024
93ac2ef
added to_smt2 and get_variable_names for bw utils
nils1603 Jan 24, 2024
0e92f67
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jan 24, 2024
956b583
all bitwuzla and z3 test green
SimonKlx Jan 25, 2024
bf38b2c
bitorder propagation fixes
SimonKlx Jan 25, 2024
eb993de
added function to move QN outputs of FFs to Q outputs
SJulianS Jan 27, 2024
e68b202
documentation and formatting cleanup
SJulianS Jan 27, 2024
cb6f82d
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Jan 27, 2024
1b1b2d9
added bitwuzla_found to utils
nils1603 Jan 27, 2024
444a471
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
nils1603 Jan 27, 2024
6e47fff
fixed unify_ff_outputs
SJulianS Jan 27, 2024
d11b38f
extended unify_ff_outputs by optionally providing inverter type
SJulianS Jan 27, 2024
277978c
changed gui auto save prints to debug priority
SimonKlx Jan 29, 2024
566022d
benchmarking bitwuzla utils
SimonKlx Feb 1, 2024
43b2bb5
added filter parameter to remove_redundant_logic
SJulianS Feb 3, 2024
3c047db
added function to get input nets of a subgraph
SJulianS Feb 5, 2024
cde8ad4
additional iGraph functions (will cleanup entire plugin later)
SJulianS Feb 6, 2024
2f2d435
fixed compile issues on the server
Feb 6, 2024
7f1e775
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
Feb 6, 2024
02dfcc3
mark URAM as ram
SJulianS Feb 11, 2024
1a57114
Merge branch 'master' into feature/word_level_structures
SJulianS Feb 11, 2024
4edcf90
intermedaite state for backup
Mar 7, 2024
fc353af
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
Mar 15, 2024
063ef8d
bug fixes to make tests run
Mar 15, 2024
0c3af9b
small change to boolean influence script
SimonKlx Mar 15, 2024
c7d8df2
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Mar 15, 2024
2ecf2a0
Merge with master
SimonKlx Mar 15, 2024
03d1af8
created symbolic execution for simplifies
Mar 5, 2024
6147ef5
added initial bitwuzla simplification
Mar 18, 2024
15692cf
finished adding simplify for bitwuzla
Mar 18, 2024
5345634
work for white box case study
SimonKlx Apr 23, 2024
b7e1ee6
small bug fix to the known groups preprocessing in the dataflow plugi…
SimonKlx Apr 24, 2024
c3dceb1
make clang build again
SJulianS Apr 26, 2024
c46d7b2
fixed fingerprint calculation
SJulianS Apr 26, 2024
205773a
added new find carry chain function to netlist utils
nils1603 Apr 26, 2024
ef8bc49
removed double const
nils1603 Apr 26, 2024
286ffc8
updated documentation
SJulianS Apr 26, 2024
49ec95f
current state
Apr 29, 2024
ea63638
remove misplaced z3_utils.cpp
SJulianS Apr 29, 2024
5f59f81
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Apr 29, 2024
5234927
current state
SimonKlx Apr 29, 2024
2420d3d
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Apr 29, 2024
8041b76
fixed multiple DANA runs with different configs
SJulianS Apr 29, 2024
540d744
Merge branch 'feature/word_level_structures' of https://github.com/em…
SJulianS Apr 29, 2024
9a0f200
disable NEG z3 operation for the moment.
SimonKlx Apr 29, 2024
137c38a
Merge branch 'feature/word_level_structures' of github.com:emsec/hal …
SimonKlx Apr 29, 2024
6b86790
remove old get_next_gates
SJulianS May 8, 2024
567dee6
fixed final bugs and finished up bitwuzla simplification
Alice-Verstege May 29, 2024
5dcbebf
Merge branch 'feature/word_level_structures' of https://github.com/em…
Alice-Verstege May 29, 2024
69fcf55
add evaluate and subsitute utilizing preexisting functions
Alice-Verstege May 29, 2024
d4c7971
formatting
SJulianS Jul 11, 2024
16ef0c8
use c++17 and activate insertion of braces
SJulianS Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ BraceWrapping:
BeforeCatch: true
BeforeElse: true
IndentBraces: false
InsertBraces: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
# BreakBeforeInheritanceComma: false
Expand Down Expand Up @@ -90,7 +91,7 @@ SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
Standard: Cpp17
TabWidth: 4
UseTab: Never
...
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ All notable changes to this project will be documented in this file.
* added extended gate library picker when importing a netlist
* added keyboard shortcut for delete-item action from toolbar
* added parameter `force_name` to enforce pin (group) renaming to `Module::set_pin_name`, `Module::set_pin_group_name`, `Module::create_pin`, and `Module::create_pin_group`
* added Python bindings for `GateLibrary::create_gate_type` (cannot handle `GateTypeComponent` parameter as pybind cannot accept `std::unique_ptr` as parameter)
* changed supported input file formats for import from hard coded list to list provided by loadable parser plugins
* changed behavior of import netlist dialog, suggest only non-existing directory names and loop until an acceptable name was entered
* changed appearance and behavior of import project dialog, make sure existing hal projects don't get overwritten
Expand Down
21 changes: 5 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ option(BUILD_TESTS "Enable test builds" OFF)
option(BUILD_COVERAGE "Enable code coverage build" OFF)
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation")
option(ENABLE_INSTALL_LDCONFIG "When installing via make/ninja install, also install and run the LDCONFIG post_install scripts" ON)
option(UPLOAD_PPA "Upload package to ppa" OFF)
option(PACKAGE_DEB "Package DEB Package" OFF)
option(ENABLE_PPA "Prepare PPA" ON)
option(PACKAGE_TGZ "Package TGZ archive" OFF)
option(PACKAGE_ZIP "Package ZIP archive" OFF)
option(PACKAGE_RPM "Package RPM package" OFF)
option(PACKAGE_MACOS "Package for macOS" OFF)

# Include Helper Modules
include(hal_cmake_tools) # Version helper
Expand Down Expand Up @@ -112,13 +105,9 @@ project(hal
set(PROJECT_VENDOR "hal")
set(PROJECT_WEBSITE "https://github.com/emsec/hal")
set(PROJECT_MAINTAINER "Sebastian Wallat <[email protected]>")
set(PROJECT_DESCRIPTION_SUMMARY "Hardware Reverse engineering framework")
set(PROJECT_DESCRIPTION_SUMMARY "Hardware reverse engineering framework")
set(PROJECT_DESCRIPTION "hal - Hardware Analyzer")

# set(CHANGELOG_MESSAGE ${CHANGELOG_LAST_MESSAGE})
set(PROJECT_PPA "ppa:sebastian-wallat/hal")
set(PROJECT_PPA_USER "sebastian-wallat")

# Use C11 and C++17 as minimum standard
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED on)
Expand Down Expand Up @@ -192,10 +181,11 @@ if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")

# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=thread -fsanitize=undefined")

# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fsanitize=undefined")
# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread -fsanitize=undefined")

# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
# SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
if(USE_LIBCXX)
enable_cxx_compile_option_if_supported("-stdlib=libc++" "" "PUBLIC")
enable_c_compile_option_if_supported("-stdlib=libc++" "" "PUBLIC")
Expand Down Expand Up @@ -329,7 +319,6 @@ install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/pybind11 DESTINATION ${HAL_CMAKECONFI
install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/spdlog-${spdlog_VERSION} DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/deps/subprocess DESTINATION ${HAL_CMAKECONFIG_INSTALL_DIR})


if(NOT(CMAKE_VERSION VERSION_LESS 3.0))
install(EXPORT hal
FILE halTargets.cmake
Expand Down
7 changes: 7 additions & 0 deletions documentation/sphinx_doc/netlist_traversal_decorator.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Netlist Traversal Decorator
==================================

.. autoclass:: hal_py.NetlistTraversalDecorator
:members:

.. automethod:: __init__
7 changes: 6 additions & 1 deletion include/hal_core/doxy_groups.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@
*/

/**
* @defgroup pins Pins
* @defgroup decorators Decorators
* @ingroup core
*/

/**
* @defgroup pins Pins
* @ingroup netlist
*/

/**
* @defgroup netlist_parser Netlist Parser
* @ingroup netlist
Expand Down
9 changes: 9 additions & 0 deletions include/hal_core/netlist/boolean_function/solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ namespace hal
*/
Result<SolverResult> query_local(const QueryConfig& config) const;

/**
* Queries a local SMT solver with the specified query configuration and the provided smt2 representation of the query.
*
* @param[in] config - The SMT solver query configuration.
* @param[in] smt2 - The SMT solver query as smt2 string.
* @returns OK() and the result on success, Err() otherwise.
*/
static Result<SolverResult> query_local(const QueryConfig& config, std::string& smt2);

/**
* Queries a remote SMT solver with the specified query configuration.
*
Expand Down
2 changes: 1 addition & 1 deletion include/hal_core/netlist/boolean_function/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace hal
/// Controls whether the SMT query is performed on a local or a remote machine.
bool local = true;
/// Controls whether the SMT solver should generate a model in case formula is satisfiable.
bool generate_model = true;
bool generate_model = false;
/// The timeout after which the SMT solver is killed in seconds.
u64 timeout_in_seconds = 10;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@

namespace hal
{
/**
* A Boolean function decorator that provides functionality to operate on the associated Boolean function.
*
* @ingroup decorators
*/
class NETLIST_API BooleanFunctionDecorator
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@

namespace hal
{
/**
* A net decorator that provides functionality to translate between nets and Boolean function variables.
*
* @ingroup decorators
*/
class NETLIST_API BooleanFunctionNetDecorator
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@

namespace hal
{
/**
* A netlist decorator that provides functionality to modify the associated netlist.
*
* @ingroup decorators
*/
class NETLIST_API NetlistModificationDecorator
{
public:
Expand Down Expand Up @@ -86,6 +91,22 @@ namespace hal
*/
Result<Net*> connect_nets(Net* master_net, Net* slave_net);

/**
* Searches for a GND net in the netlist.
* If there are no existing ones then the function will try to search for a GND gate type in the gate library and create a GND net with corresponding gate source.
*
* @returns A vector containing the either newly created or all already existing GND nets.
*/
Result<std::vector<Net*>> create_gnd_net();

/**
* Searches for a VCC net in the netlist.
* If there are no existing ones then the function will try to search for a VCC gate type in the gate library and create a VCC net with corresponding gate source.
*
* @returns A vector containing the either newly created or all already existing VCC nets.
*/
Result<std::vector<Net*>> create_vcc_net();

private:
Netlist& m_netlist;
};
Expand Down
144 changes: 144 additions & 0 deletions include/hal_core/netlist/decorators/netlist_traversal_decorator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
// MIT License
//
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

#include "hal_core/defines.h"
#include "hal_core/netlist/netlist.h"
#include "hal_core/utilities/result.h"

namespace hal
{
/**
* A netlist decorator that provides functionality to traverse the associated netlist without making any modifications.
*
* @ingroup decorators
*/
class NETLIST_API NetlistTraversalDecorator
{
public:
/**
* Construct new NetlistTraversalDecorator object.
*
* @param[in] netlist - The netlist to operate on.
*/
NetlistTraversalDecorator(const Netlist& netlist);

/**
* Starting from the given net, traverse the netlist and return only the successor/predecessor gates for which the `target_gate_filter` evaluates to `true`.
* Stop traversal if (1) the `target_gate_filter` evaluates to `true`, (2) the `exit_endpoint_filter` evaluates to `false` on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (3) the `entry_endpoint_filter` evaluates to `false` on a successor/predecessor endpoint (i.e., when entering the next gate during traversal).
* Both the `entry_endpoint_filter` and the `exit_endpoint_filter` may be omitted.
*
* @param[in] net - Start net.
* @param[in] successors - Set `true` to get successors, set `false` to get predecessors.
* @param[in] target_gate_filter - Filter condition that must be met for the target gates.
* @param[in] exit_endpoint_filter - Filter condition that determines whether to stop traversal on a fan-in/out endpoint.
* @param[in] entry_endpoint_filter - Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.
* @returns The next gates fulfilling the target gate filter condition.
*/
Result<std::set<Gate*>> get_next_gates(const Net* net,
bool successors,
const std::function<bool(const Gate*)>& target_gate_filter,
const std::function<bool(const Endpoint*, const u32 current_depth)>& exit_endpoint_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& entry_endpoint_filter = nullptr) const;

/**
* Starting from the given gate, traverse the netlist and return only the successor/predecessor gates for which the `target_gate_filter` evaluates to `true`.
* Stop traversal if (1) the `target_gate_filter` evaluates to `true`, (2) the `exit_endpoint_filter` evaluates to `false` on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (3) the `entry_endpoint_filter` evaluates to `false` on a successor/predecessor endpoint (i.e., when entering the next gate during traversal).
* Both the `entry_endpoint_filter` and the `exit_endpoint_filter` may be omitted.
*
* @param[in] gate - Start gate.
* @param[in] successors - Set `true` to get successors, set `false` to get predecessors.
* @param[in] target_gate_filter - Filter condition that must be met for the target gates.
* @param[in] exit_endpoint_filter - Filter condition that determines whether to stop traversal on a fan-in/out endpoint.
* @param[in] entry_endpoint_filter - Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.
* @returns The next gates fulfilling the target gate filter condition.
*/
Result<std::set<Gate*>> get_next_gates(const Gate* gate,
bool successors,
const std::function<bool(const Gate*)>& target_gate_filter,
const std::function<bool(const Endpoint*, const u32 current_depth)>& exit_endpoint_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& entry_endpoint_filter = nullptr) const;

/**
* Starting from the given net, traverse the netlist and return only the successor/predecessor gates for which the `target_gate_filter` evaluates to `true`.
* Stop traversal if (1) the `exit_endpoint_filter` evaluates to `false` on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (2) the `entry_endpoint_filter` evaluates to `false` on a successor/predecessor endpoint (i.e., when entering the next gate during traversal).
* The target_gate_filter may be ommitted in which case all traversed gates will be returned.
* Both `entry_endpoint_filter` and the `exit_endpoint_filter` may be omitted as well.
*
* @param[in] net - Start net.
* @param[in] successors - Set `true` to get successors, set `false` to get predecessors.
* @param[in] target_gate_filter - Filter condition that must be met for the target gates.
* @param[in] exit_endpoint_filter - Filter condition that determines whether to stop traversal on a fan-in/out endpoint.
* @param[in] entry_endpoint_filter - Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.
* @returns The next gates fulfilling the target gate filter condition.
*/
Result<std::set<Gate*>> get_subgraph_gates(const Net* net,
bool successors,
const std::function<bool(const Gate*)>& target_gate_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& exit_endpoint_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& entry_endpoint_filter = nullptr) const;

/**
* Starting from the given gate, traverse the netlist and return only the successor/predecessor gates for which the `target_gate_filter` evaluates to `true`.
* Stop traversal if (1) the `exit_endpoint_filter` evaluates to `false` on a fan-in/out endpoint (i.e., when exiting the current gate during traversal), or (2) the `entry_endpoint_filter` evaluates to `false` on a successor/predecessor endpoint (i.e., when entering the next gate during traversal).
* The target_gate_filter may be ommitted in which case all traversed gates will be returned.
* Both `entry_endpoint_filter` and the `exit_endpoint_filter` may be omitted as well.
*
* @param[in] gate - Start gate.
* @param[in] successors - Set `true` to get successors, set `false` to get predecessors.
* @param[in] target_gate_filter - Filter condition that must be met for the target gates.
* @param[in] exit_endpoint_filter - Filter condition that determines whether to stop traversal on a fan-in/out endpoint.
* @param[in] entry_endpoint_filter - Filter condition that determines whether to stop traversal on a successor/predecessor endpoint.
* @returns The next gates fulfilling the target gate filter condition.
*/
Result<std::set<Gate*>> get_subgraph_gates(const Gate* gate,
bool successors,
const std::function<bool(const Gate*)>& target_gate_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& exit_endpoint_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& entry_endpoint_filter = nullptr) const;

/**
* TODO document
*/
Result<std::set<Net*>> get_subgraph_input_nets(const Net* net,
bool successors,
const std::function<bool(const Net*)>& target_net_filter,
const std::function<bool(const Endpoint*, const u32 current_depth)>& exit_endpoint_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& entry_endpoint_filter = nullptr) const;

/**
* TODO document
*/
Result<std::set<Net*>> get_subgraph_input_nets(const Gate* gate,
bool successors,
const std::function<bool(const Net*)>& target_net_filter,
const std::function<bool(const Endpoint*, const u32 current_depth)>& exit_endpoint_filter = nullptr,
const std::function<bool(const Endpoint*, const u32 current_depth)>& entry_endpoint_filter = nullptr) const;

private:
const Netlist& m_netlist;
};
} // namespace hal
Loading
Loading