From 3e019d57fab57afe7aad373385f32a23bd178941 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Mon, 17 Jul 2017 10:13:31 +0200 Subject: Initial commit. --- data/ast/best_chronometer_ever.xml | 11069 +++++++++++++++++++++++++++++++ data/instructions/example_1.sl | 1857 ++++++ data/level/structural_level.data | 112 + instr-scripts/Makefile | 33 + instr-scripts/__init__.py | 0 instr-scripts/id_manager.py | 82 + instr-scripts/process_internals.py | 517 ++ instr-scripts/structural_level.py | 1332 ++++ instr-scripts/waveform_manager.py | 34 + instr-to-kodkod/Makefile | 25 + instr-to-kodkod/src/Main.java | 82 + instr-to-kodkod/src/QuickParser.java | 58 + instr-to-kodkod/src/VHDLLevel.java | 157 + instr-to-kodkod/src/VHDLModel.java | 336 + instr-to-kodkod/src/VHDLPredicate.java | 94 + instr-to-kodkod/src/VHDLType.java | 76 + 16 files changed, 15864 insertions(+) create mode 100644 data/ast/best_chronometer_ever.xml create mode 100644 data/instructions/example_1.sl create mode 100644 data/level/structural_level.data create mode 100644 instr-scripts/Makefile create mode 100644 instr-scripts/__init__.py create mode 100644 instr-scripts/id_manager.py create mode 100644 instr-scripts/process_internals.py create mode 100755 instr-scripts/structural_level.py create mode 100644 instr-scripts/waveform_manager.py create mode 100644 instr-to-kodkod/Makefile create mode 100644 instr-to-kodkod/src/Main.java create mode 100644 instr-to-kodkod/src/QuickParser.java create mode 100644 instr-to-kodkod/src/VHDLLevel.java create mode 100644 instr-to-kodkod/src/VHDLModel.java create mode 100644 instr-to-kodkod/src/VHDLPredicate.java create mode 100644 instr-to-kodkod/src/VHDLType.java diff --git a/data/ast/best_chronometer_ever.xml b/data/ast/best_chronometer_ever.xml new file mode 100644 index 0000000..8b9bb77 --- /dev/null +++ b/data/ast/best_chronometer_ever.xml @@ -0,0 +1,11069 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/instructions/example_1.sl b/data/instructions/example_1.sl new file mode 100644 index 0000000..1adbd4b --- /dev/null +++ b/data/instructions/example_1.sl @@ -0,0 +1,1857 @@ +(add_element file 0) +(add_element string 1) +(set_function filename 0 1) +(add_element entity 2) +(add_element string 3) +(set_function line 2 3) +(add_element string 4) +(set_function column 2 4) +(add_element string 5) +(set_function identifier 2 5) +(has_visible_flag 2) +(end_has_identifier 2) +(is_in_file 2 0) + +(add_element port 6) +(add_element string 4) +(set_function line 6 4) +(add_element string 7) +(set_function column 6 7) +(add_element string 8) +(set_function identifier 6 8) +(has_visible_flag 6) +(add_element string 9) +(is_of_mode 6 9) + +(add_element waveform 10) +(is_waveform_of 10 6) + +(is_port_of 6 2) +(add_element port 11) +(add_element string 12) +(set_function line 11 12) +(add_element string 7) +(set_function column 11 7) +(add_element string 13) +(set_function identifier 11 13) +(has_visible_flag 11) +(add_element string 9) +(is_of_mode 11 9) + +(add_element waveform 14) +(is_waveform_of 14 11) + +(is_port_of 11 2) +(add_element port 15) +(add_element string 16) +(set_function line 15 16) +(add_element string 7) +(set_function column 15 7) +(add_element string 17) +(set_function identifier 15 17) +(has_visible_flag 15) +(add_element string 9) +(is_of_mode 15 9) + +(add_element waveform 18) +(is_waveform_of 18 15) + +(is_port_of 15 2) +(add_element port 19) +(add_element string 20) +(set_function line 19 20) +(add_element string 7) +(set_function column 19 7) +(add_element string 21) +(set_function identifier 19 21) +(has_visible_flag 19) +(add_element string 9) +(is_of_mode 19 9) + +(add_element waveform 22) +(is_waveform_of 22 19) + +(is_port_of 19 2) +(add_element port 23) +(add_element string 24) +(set_function line 23 24) +(add_element string 7) +(set_function column 23 7) +(add_element string 25) +(set_function identifier 23 25) +(has_visible_flag 23) +(add_element string 9) +(is_of_mode 23 9) + +(add_element waveform 26) +(is_waveform_of 26 23) + +(is_port_of 23 2) +(add_element port 27) +(add_element string 28) +(set_function line 27 28) +(add_element string 7) +(set_function column 27 7) +(add_element string 29) +(set_function identifier 27 29) +(has_visible_flag 27) +(add_element string 30) +(is_of_mode 27 30) + +(add_element waveform 31) +(is_waveform_of 31 27) + +(is_port_of 27 2) +(add_element port 32) +(add_element string 33) +(set_function line 32 33) +(add_element string 7) +(set_function column 32 7) +(add_element string 34) +(set_function identifier 32 34) +(has_visible_flag 32) +(add_element string 30) +(is_of_mode 32 30) + +(add_element waveform 35) +(is_waveform_of 35 32) + +(is_port_of 32 2) +(add_element architecture 36) +(add_element string 37) +(set_function line 36 37) +(add_element string 33) +(set_function column 36 33) +(add_element string 38) +(set_function identifier 36 38) +(has_visible_flag 36) +(is_in_file 36 0) + +(add_element signal 39) +(add_element string 40) +(set_function line 39 40) +(add_element string 20) +(set_function column 39 20) +(add_element string 41) +(set_function identifier 39 41) +(has_visible_flag 39) +(add_element string 42) +(is_of_kind 39 42) + +(add_element waveform 43) +(is_waveform_of 43 39) + +(belongs_to_architecture 39 36) +(add_element signal 44) +(add_element string 45) +(set_function line 44 45) +(add_element string 20) +(set_function column 44 20) +(add_element string 46) +(set_function identifier 44 46) +(has_visible_flag 44) +(add_element string 42) +(is_of_kind 44 42) + +(add_element waveform 47) +(is_waveform_of 47 44) + +(belongs_to_architecture 44 36) +(add_element process 48) +(add_element string 49) +(set_function line 48 49) +(add_element string 50) +(set_function column 48 50) +(add_element string 51) +(set_function label 48 51) +(is_explicit_process 48) +(has_visible_flag 48) +(has_label 48) +(end_has_reserved_id 48) +(is_in_sensitivity_list 10 48) +(is_in_sensitivity_list 14 48) +(is_accessed_by 14 48) +(is_accessed_by 47 48) + +(is_accessed_by 10 48) +(is_accessed_by 43 48) +(is_accessed_by 18 48) +(is_accessed_by 47 48) +(is_accessed_by 47 48) +(is_accessed_by 10 48) +(is_accessed_by 14 48) + +(belongs_to_architecture 48 36) +(add_element process 66) +(add_element string 67) +(set_function line 66 67) +(add_element string 50) +(set_function column 66 50) +(add_element string 68) +(set_function label 66 68) +(is_explicit_process 66) +(has_visible_flag 66) +(has_label 66) +(end_has_reserved_id 66) +(is_in_sensitivity_list 10 66) +(is_in_sensitivity_list 14 66) +(is_accessed_by 14 66) +(is_accessed_by 43 66) + +(is_accessed_by 10 66) +(is_accessed_by 43 66) +(is_accessed_by 18 66) +(is_accessed_by 10 66) +(is_accessed_by 14 66) + +(belongs_to_architecture 66 36) +(add_element process 73) +(add_element string 74) +(set_function line 73 74) +(add_element string 50) +(set_function column 73 50) +(add_element string 56) +(set_function label 73 56) +(is_ref 73) +(is_in_sensitivity_list 22 73) +(is_in_sensitivity_list 47 73) +(is_accessed_by 35 73) +(is_accessed_by 22 73) +(is_accessed_by 47 73) + +(belongs_to_architecture 73 36) +(add_element process 76) +(add_element string 77) +(set_function line 76 77) +(add_element string 50) +(set_function column 76 50) +(add_element string 56) +(set_function label 76 56) +(is_ref 76) +(is_in_sensitivity_list 47 76) +(is_accessed_by 31 76) +(is_accessed_by 47 76) + +(belongs_to_architecture 76 36) +(is_architecture_of 36 2) +(add_element file 79) +(add_element string 80) +(set_function filename 79 80) +(add_element entity 81) +(add_element string 3) +(set_function line 81 3) +(add_element string 4) +(set_function column 81 4) +(add_element string 82) +(set_function identifier 81 82) +(has_visible_flag 81) +(end_has_identifier 81) +(is_in_file 81 79) + +(add_element port 83) +(add_element string 4) +(set_function line 83 4) +(add_element string 7) +(set_function column 83 7) +(add_element string 8) +(set_function identifier 83 8) +(has_visible_flag 83) +(add_element string 9) +(is_of_mode 83 9) + +(add_element waveform 84) +(is_waveform_of 84 83) + +(is_port_of 83 81) +(add_element port 85) +(add_element string 12) +(set_function line 85 12) +(add_element string 7) +(set_function column 85 7) +(add_element string 13) +(set_function identifier 85 13) +(has_visible_flag 85) +(add_element string 9) +(is_of_mode 85 9) + +(add_element waveform 86) +(is_waveform_of 86 85) + +(is_port_of 85 81) +(add_element port 87) +(add_element string 16) +(set_function line 87 16) +(add_element string 7) +(set_function column 87 7) +(add_element string 88) +(set_function identifier 87 88) +(has_visible_flag 87) +(add_element string 9) +(is_of_mode 87 9) + +(add_element waveform 89) +(is_waveform_of 89 87) + +(is_port_of 87 81) +(add_element port 90) +(add_element string 20) +(set_function line 90 20) +(add_element string 7) +(set_function column 90 7) +(add_element string 91) +(set_function identifier 90 91) +(has_visible_flag 90) +(add_element string 9) +(is_of_mode 90 9) + +(add_element waveform 92) +(is_waveform_of 92 90) + +(is_port_of 90 81) +(add_element port 93) +(add_element string 24) +(set_function line 93 24) +(add_element string 7) +(set_function column 93 7) +(add_element string 94) +(set_function identifier 93 94) +(has_visible_flag 93) +(add_element string 30) +(is_of_mode 93 30) + +(add_element waveform 95) +(is_waveform_of 95 93) + +(is_port_of 93 81) +(add_element port 96) +(add_element string 28) +(set_function line 96 28) +(add_element string 7) +(set_function column 96 7) +(add_element string 97) +(set_function identifier 96 97) +(has_visible_flag 96) +(add_element string 30) +(is_of_mode 96 30) + +(add_element waveform 98) +(is_waveform_of 98 96) + +(is_port_of 96 81) +(add_element port 99) +(add_element string 33) +(set_function line 99 33) +(add_element string 7) +(set_function column 99 7) +(add_element string 100) +(set_function identifier 99 100) +(has_visible_flag 99) +(add_element string 30) +(is_of_mode 99 30) + +(add_element waveform 101) +(is_waveform_of 101 99) + +(is_port_of 99 81) +(add_element port 102) +(add_element string 103) +(set_function line 102 103) +(add_element string 7) +(set_function column 102 7) +(add_element string 104) +(set_function identifier 102 104) +(has_visible_flag 102) +(add_element string 30) +(is_of_mode 102 30) + +(add_element waveform 105) +(is_waveform_of 105 102) + +(is_port_of 102 81) +(add_element port 106) +(add_element string 107) +(set_function line 106 107) +(add_element string 7) +(set_function column 106 7) +(add_element string 108) +(set_function identifier 106 108) +(has_visible_flag 106) +(add_element string 30) +(is_of_mode 106 30) + +(add_element waveform 109) +(is_waveform_of 109 106) + +(is_port_of 106 81) +(add_element architecture 110) +(add_element string 40) +(set_function line 110 40) +(add_element string 33) +(set_function column 110 33) +(add_element string 38) +(set_function identifier 110 38) +(has_visible_flag 110) +(is_in_file 110 79) + +(add_element signal 111) +(add_element string 112) +(set_function line 111 112) +(add_element string 20) +(set_function column 111 20) +(add_element string 113) +(set_function identifier 111 113) +(has_visible_flag 111) +(add_element string 42) +(is_of_kind 111 42) + +(add_element waveform 114) +(is_waveform_of 114 111) + +(belongs_to_architecture 111 110) +(add_element signal 115) +(add_element string 45) +(set_function line 115 45) +(add_element string 20) +(set_function column 115 20) +(add_element string 116) +(set_function identifier 115 116) +(has_visible_flag 115) +(add_element string 42) +(is_of_kind 115 42) + +(add_element waveform 117) +(is_waveform_of 117 115) + +(belongs_to_architecture 115 110) +(add_element signal 118) +(add_element string 119) +(set_function line 118 119) +(add_element string 20) +(set_function column 118 20) +(add_element string 120) +(set_function identifier 118 120) +(has_visible_flag 118) +(add_element string 42) +(is_of_kind 118 42) + +(add_element waveform 121) +(is_waveform_of 121 118) + +(belongs_to_architecture 118 110) +(add_element signal 122) +(add_element string 49) +(set_function line 122 49) +(add_element string 20) +(set_function column 122 20) +(add_element string 123) +(set_function identifier 122 123) +(has_visible_flag 122) +(add_element string 42) +(is_of_kind 122 42) + +(add_element waveform 124) +(is_waveform_of 124 122) + +(belongs_to_architecture 122 110) +(add_element signal 125) +(add_element string 126) +(set_function line 125 126) +(add_element string 20) +(set_function column 125 20) +(add_element string 127) +(set_function identifier 125 127) +(has_visible_flag 125) +(add_element string 42) +(is_of_kind 125 42) + +(add_element waveform 128) +(is_waveform_of 128 125) + +(belongs_to_architecture 125 110) +(add_element process 129) +(add_element string 130) +(set_function line 129 130) +(add_element string 50) +(set_function column 129 50) +(add_element string 131) +(set_function label 129 131) +(is_explicit_process 129) +(has_visible_flag 129) +(has_label 129) +(end_has_reserved_id 129) +(is_in_sensitivity_list 84 129) +(is_in_sensitivity_list 89 129) +(is_accessed_by 89 129) +(is_accessed_by 117 129) + +(is_accessed_by 84 129) +(is_accessed_by 92 129) +(is_accessed_by 114 129) +(is_accessed_by 117 129) +(is_accessed_by 117 129) +(is_accessed_by 117 129) +(is_accessed_by 117 129) +(is_accessed_by 84 129) +(is_accessed_by 89 129) + +(belongs_to_architecture 129 110) +(add_element process 139) +(add_element string 140) +(set_function line 139 140) +(add_element string 50) +(set_function column 139 50) +(add_element string 141) +(set_function label 139 141) +(is_explicit_process 139) +(has_visible_flag 139) +(has_label 139) +(end_has_reserved_id 139) +(is_in_sensitivity_list 84 139) +(is_in_sensitivity_list 89 139) +(is_accessed_by 89 139) +(is_accessed_by 121 139) + +(is_accessed_by 84 139) +(is_accessed_by 92 139) +(is_accessed_by 114 139) +(is_accessed_by 117 139) +(is_accessed_by 121 139) +(is_accessed_by 121 139) +(is_accessed_by 121 139) +(is_accessed_by 121 139) +(is_accessed_by 84 139) +(is_accessed_by 89 139) + +(belongs_to_architecture 139 110) +(add_element process 149) +(add_element string 150) +(set_function line 149 150) +(add_element string 50) +(set_function column 149 50) +(add_element string 151) +(set_function label 149 151) +(is_explicit_process 149) +(has_visible_flag 149) +(has_label 149) +(end_has_reserved_id 149) +(is_in_sensitivity_list 84 149) +(is_in_sensitivity_list 89 149) +(is_accessed_by 89 149) +(is_accessed_by 124 149) + +(is_accessed_by 84 149) +(is_accessed_by 92 149) +(is_accessed_by 114 149) +(is_accessed_by 121 149) +(is_accessed_by 117 149) +(is_accessed_by 124 149) +(is_accessed_by 124 149) +(is_accessed_by 124 149) +(is_accessed_by 124 149) +(is_accessed_by 84 149) +(is_accessed_by 89 149) + +(belongs_to_architecture 149 110) +(add_element process 159) +(add_element string 160) +(set_function line 159 160) +(add_element string 50) +(set_function column 159 50) +(add_element string 161) +(set_function label 159 161) +(is_explicit_process 159) +(has_visible_flag 159) +(has_label 159) +(end_has_reserved_id 159) +(is_in_sensitivity_list 84 159) +(is_in_sensitivity_list 89 159) +(is_accessed_by 89 159) +(is_accessed_by 128 159) + +(is_accessed_by 84 159) +(is_accessed_by 92 159) +(is_accessed_by 114 159) +(is_accessed_by 124 159) +(is_accessed_by 121 159) +(is_accessed_by 117 159) +(is_accessed_by 128 159) +(is_accessed_by 128 159) +(is_accessed_by 84 159) +(is_accessed_by 89 159) + +(belongs_to_architecture 159 110) +(add_element process 167) +(add_element string 168) +(set_function line 167 168) +(add_element string 50) +(set_function column 167 50) +(add_element string 56) +(set_function label 167 56) +(is_ref 167) +(is_in_sensitivity_list 128 167) +(is_in_sensitivity_list 124 167) +(is_in_sensitivity_list 121 167) +(is_in_sensitivity_list 117 167) +(is_accessed_by 128 167) +(is_accessed_by 124 167) +(is_accessed_by 121 167) +(is_accessed_by 117 167) +(is_accessed_by 114 167) + +(belongs_to_architecture 167 110) +(add_element process 173) +(add_element string 174) +(set_function line 173 174) +(add_element string 50) +(set_function column 173 50) +(add_element string 56) +(set_function label 173 56) +(is_ref 173) +(is_in_sensitivity_list 117 173) +(is_accessed_by 98 173) +(is_accessed_by 117 173) + +(belongs_to_architecture 173 110) +(add_element process 176) +(add_element string 177) +(set_function line 176 177) +(add_element string 50) +(set_function column 176 50) +(add_element string 56) +(set_function label 176 56) +(is_ref 176) +(is_in_sensitivity_list 121 176) +(is_accessed_by 101 176) +(is_accessed_by 121 176) + +(belongs_to_architecture 176 110) +(add_element process 179) +(add_element string 180) +(set_function line 179 180) +(add_element string 50) +(set_function column 179 50) +(add_element string 56) +(set_function label 179 56) +(is_ref 179) +(is_in_sensitivity_list 124 179) +(is_accessed_by 105 179) +(is_accessed_by 124 179) + +(belongs_to_architecture 179 110) +(add_element process 182) +(add_element string 183) +(set_function line 182 183) +(add_element string 50) +(set_function column 182 50) +(add_element string 56) +(set_function label 182 56) +(is_ref 182) +(is_in_sensitivity_list 128 182) +(is_accessed_by 109 182) +(is_accessed_by 128 182) + +(belongs_to_architecture 182 110) +(add_element process 185) +(add_element string 186) +(set_function line 185 186) +(add_element string 50) +(set_function column 185 50) +(add_element string 56) +(set_function label 185 56) +(is_ref 185) +(is_in_sensitivity_list 114 185) +(is_accessed_by 95 185) +(is_accessed_by 114 185) + +(belongs_to_architecture 185 110) +(is_architecture_of 110 81) +(add_element file 188) +(add_element string 189) +(set_function filename 188 189) +(add_element entity 190) +(add_element string 3) +(set_function line 190 3) +(add_element string 4) +(set_function column 190 4) +(add_element string 191) +(set_function identifier 190 191) +(has_visible_flag 190) +(end_has_identifier 190) +(is_in_file 190 188) + +(add_element port 192) +(add_element string 119) +(set_function line 192 119) +(add_element string 7) +(set_function column 192 7) +(add_element string 193) +(set_function identifier 192 193) +(has_visible_flag 192) +(add_element string 9) +(is_of_mode 192 9) + +(add_element waveform 194) +(is_waveform_of 194 192) + +(is_port_of 192 190) +(add_element port 195) +(add_element string 49) +(set_function line 195 49) +(add_element string 7) +(set_function column 195 7) +(add_element string 196) +(set_function identifier 195 196) +(has_visible_flag 195) +(add_element string 30) +(is_of_mode 195 30) + +(add_element waveform 197) +(is_waveform_of 197 195) + +(is_port_of 195 190) +(add_element generic 198) +(add_element string 12) +(set_function line 198 12) +(add_element string 7) +(set_function column 198 7) +(add_element string 199) +(set_function identifier 198 199) +(has_visible_flag 198) + +(is_generic_of 198 190) +(add_element generic 200) +(add_element string 16) +(set_function line 200 16) +(add_element string 7) +(set_function column 200 7) +(add_element string 201) +(set_function identifier 200 201) +(has_visible_flag 200) + +(is_generic_of 200 190) +(add_element generic 202) +(add_element string 20) +(set_function line 202 20) +(add_element string 7) +(set_function column 202 7) +(add_element string 203) +(set_function identifier 202 203) +(has_visible_flag 202) + +(is_generic_of 202 190) +(add_element generic 204) +(add_element string 24) +(set_function line 204 24) +(add_element string 7) +(set_function column 204 7) +(add_element string 205) +(set_function identifier 204 205) +(has_visible_flag 204) + +(is_generic_of 204 190) +(add_element generic 206) +(add_element string 28) +(set_function line 206 28) +(add_element string 7) +(set_function column 206 7) +(add_element string 207) +(set_function identifier 206 207) +(has_visible_flag 206) + +(is_generic_of 206 190) +(add_element generic 208) +(add_element string 33) +(set_function line 208 33) +(add_element string 7) +(set_function column 208 7) +(add_element string 209) +(set_function identifier 208 209) +(has_visible_flag 208) + +(is_generic_of 208 190) +(add_element generic 210) +(add_element string 103) +(set_function line 210 103) +(add_element string 7) +(set_function column 210 7) +(add_element string 211) +(set_function identifier 210 211) +(has_visible_flag 210) + +(is_generic_of 210 190) +(add_element generic 212) +(add_element string 107) +(set_function line 212 107) +(add_element string 7) +(set_function column 212 7) +(add_element string 213) +(set_function identifier 212 213) +(has_visible_flag 212) + +(is_generic_of 212 190) +(add_element generic 214) +(add_element string 215) +(set_function line 214 215) +(add_element string 7) +(set_function column 214 7) +(add_element string 216) +(set_function identifier 214 216) +(has_visible_flag 214) + +(is_generic_of 214 190) +(add_element generic 217) +(add_element string 37) +(set_function line 217 37) +(add_element string 7) +(set_function column 217 7) +(add_element string 218) +(set_function identifier 217 218) +(has_visible_flag 217) + +(is_generic_of 217 190) +(add_element generic 219) +(add_element string 220) +(set_function line 219 220) +(add_element string 7) +(set_function column 219 7) +(add_element string 221) +(set_function identifier 219 221) +(has_visible_flag 219) + +(is_generic_of 219 190) +(add_element architecture 222) +(add_element string 223) +(set_function line 222 223) +(add_element string 33) +(set_function column 222 33) +(add_element string 38) +(set_function identifier 222 38) +(has_visible_flag 222) +(is_in_file 222 188) + +(add_element process 224) +(add_element string 225) +(set_function line 224 225) +(add_element string 50) +(set_function column 224 50) +(add_element string 56) +(set_function label 224 56) +(is_ref 224) +(is_in_sensitivity_list 194 224) +(is_accessed_by 197 224) +(is_accessed_by 194 224) + +(belongs_to_architecture 224 222) +(is_architecture_of 222 190) +(add_element file 264) +(add_element string 265) +(set_function filename 264 265) +(add_element entity 266) +(add_element string 3) +(set_function line 266 3) +(add_element string 4) +(set_function column 266 4) +(add_element string 267) +(set_function identifier 266 267) +(has_visible_flag 266) +(end_has_identifier 266) +(is_in_file 266 264) + +(add_element port 268) +(add_element string 103) +(set_function line 268 103) +(add_element string 7) +(set_function column 268 7) +(add_element string 8) +(set_function identifier 268 8) +(has_visible_flag 268) +(add_element string 9) +(is_of_mode 268 9) + +(add_element waveform 269) +(is_waveform_of 269 268) + +(is_port_of 268 266) +(add_element port 270) +(add_element string 107) +(set_function line 270 107) +(add_element string 7) +(set_function column 270 7) +(add_element string 13) +(set_function identifier 270 13) +(has_visible_flag 270) +(add_element string 9) +(is_of_mode 270 9) + +(add_element waveform 271) +(is_waveform_of 271 270) + +(is_port_of 270 266) +(add_element port 272) +(add_element string 215) +(set_function line 272 215) +(add_element string 7) +(set_function column 272 7) +(add_element string 273) +(set_function identifier 272 273) +(has_visible_flag 272) +(add_element string 9) +(is_of_mode 272 9) + +(add_element waveform 274) +(is_waveform_of 274 272) + +(is_port_of 272 266) +(add_element port 275) +(add_element string 37) +(set_function line 275 37) +(add_element string 7) +(set_function column 275 7) +(add_element string 276) +(set_function identifier 275 276) +(has_visible_flag 275) +(add_element string 9) +(is_of_mode 275 9) + +(add_element waveform 277) +(is_waveform_of 277 275) + +(is_port_of 275 266) +(add_element port 278) +(add_element string 220) +(set_function line 278 220) +(add_element string 7) +(set_function column 278 7) +(add_element string 279) +(set_function identifier 278 279) +(has_visible_flag 278) +(add_element string 9) +(is_of_mode 278 9) + +(add_element waveform 280) +(is_waveform_of 280 278) + +(is_port_of 278 266) +(add_element port 281) +(add_element string 40) +(set_function line 281 40) +(add_element string 7) +(set_function column 281 7) +(add_element string 282) +(set_function identifier 281 282) +(has_visible_flag 281) +(add_element string 9) +(is_of_mode 281 9) + +(add_element waveform 283) +(is_waveform_of 283 281) + +(is_port_of 281 266) +(add_element port 284) +(add_element string 112) +(set_function line 284 112) +(add_element string 7) +(set_function column 284 7) +(add_element string 196) +(set_function identifier 284 196) +(has_visible_flag 284) +(add_element string 30) +(is_of_mode 284 30) + +(add_element waveform 285) +(is_waveform_of 285 284) + +(is_port_of 284 266) +(add_element port 286) +(add_element string 45) +(set_function line 286 45) +(add_element string 7) +(set_function column 286 7) +(add_element string 287) +(set_function identifier 286 287) +(has_visible_flag 286) +(add_element string 30) +(is_of_mode 286 30) + +(add_element waveform 288) +(is_waveform_of 288 286) + +(is_port_of 286 266) +(add_element generic 289) +(add_element string 20) +(set_function line 289 20) +(add_element string 7) +(set_function column 289 7) +(add_element string 290) +(set_function identifier 289 290) +(has_visible_flag 289) + +(is_generic_of 289 266) +(add_element architecture 291) +(add_element string 292) +(set_function line 291 292) +(add_element string 33) +(set_function column 291 33) +(add_element string 38) +(set_function identifier 291 38) +(has_visible_flag 291) +(is_in_file 291 264) + +(add_element signal 293) +(add_element string 294) +(set_function line 293 294) +(add_element string 20) +(set_function column 293 20) +(add_element string 295) +(set_function identifier 293 295) +(has_visible_flag 293) +(add_element string 42) +(is_of_kind 293 42) + +(add_element waveform 296) +(is_waveform_of 296 293) + +(belongs_to_architecture 293 291) +(add_element signal 297) +(add_element string 298) +(set_function line 297 298) +(add_element string 20) +(set_function column 297 20) +(add_element string 299) +(set_function identifier 297 299) +(has_visible_flag 297) +(add_element string 42) +(is_of_kind 297 42) + +(add_element waveform 300) +(is_waveform_of 300 297) + +(belongs_to_architecture 297 291) +(add_element signal 301) +(add_element string 302) +(set_function line 301 302) +(add_element string 20) +(set_function column 301 20) +(add_element string 303) +(set_function identifier 301 303) +(has_visible_flag 301) +(add_element string 42) +(is_of_kind 301 42) + +(add_element waveform 304) +(is_waveform_of 304 301) + +(belongs_to_architecture 301 291) +(add_element process 305) +(add_element string 306) +(set_function line 305 306) +(add_element string 50) +(set_function column 305 50) +(add_element string 307) +(set_function label 305 307) +(is_explicit_process 305) +(has_visible_flag 305) +(has_label 305) +(end_has_reserved_id 305) +(is_in_sensitivity_list 300 305) +(is_in_sensitivity_list 274 305) +(is_in_sensitivity_list 277 305) +(is_in_sensitivity_list 280 305) +(is_in_sensitivity_list 283 305) +(is_accessed_by 288 305) +(is_accessed_by 288 305) +(is_accessed_by 296 305) +(is_accessed_by 285 305) +(is_accessed_by 274 305) +(is_accessed_by 288 305) +(is_accessed_by 296 305) +(is_accessed_by 285 305) +(is_accessed_by 277 305) +(is_accessed_by 288 305) +(is_accessed_by 296 305) +(is_accessed_by 285 305) +(is_accessed_by 280 305) +(is_accessed_by 288 305) +(is_accessed_by 296 305) +(is_accessed_by 285 305) +(is_accessed_by 283 305) +(is_accessed_by 300 305) +(is_accessed_by 300 305) +(is_accessed_by 274 305) +(is_accessed_by 277 305) +(is_accessed_by 280 305) +(is_accessed_by 283 305) + +(belongs_to_architecture 305 291) +(add_element process 334) +(add_element string 335) +(set_function line 334 335) +(add_element string 50) +(set_function column 334 50) +(add_element string 336) +(set_function label 334 336) +(is_explicit_process 334) +(has_visible_flag 334) +(has_label 334) +(end_has_reserved_id 334) +(is_in_sensitivity_list 269 334) +(is_in_sensitivity_list 271 334) +(is_accessed_by 271 334) +(is_accessed_by 304 334) +(is_accessed_by 269 334) +(is_accessed_by 304 334) +(is_accessed_by 304 334) +(is_accessed_by 304 334) +(is_accessed_by 304 334) +(is_accessed_by 269 334) +(is_accessed_by 271 334) + +(belongs_to_architecture 334 291) +(add_element process 344) +(add_element string 345) +(set_function line 344 345) +(add_element string 50) +(set_function column 344 50) +(add_element string 346) +(set_function label 344 346) +(is_explicit_process 344) +(has_visible_flag 344) +(has_label 344) +(end_has_reserved_id 344) +(is_in_sensitivity_list 269 344) +(is_in_sensitivity_list 271 344) +(is_accessed_by 271 344) +(is_accessed_by 300 344) +(is_accessed_by 269 344) +(is_accessed_by 304 344) +(is_accessed_by 300 344) +(is_accessed_by 296 344) +(is_accessed_by 269 344) +(is_accessed_by 271 344) + +(belongs_to_architecture 344 291) +(is_architecture_of 291 266) +(add_element file 352) +(add_element string 353) +(set_function filename 352 353) +(add_element entity 354) +(add_element string 3) +(set_function line 354 3) +(add_element string 4) +(set_function column 354 4) +(add_element string 355) +(set_function identifier 354 355) +(has_visible_flag 354) +(end_has_identifier 354) +(is_in_file 354 352) + +(add_element port 356) +(add_element string 4) +(set_function line 356 4) +(add_element string 7) +(set_function column 356 7) +(add_element string 8) +(set_function identifier 356 8) +(has_visible_flag 356) +(add_element string 9) +(is_of_mode 356 9) + +(add_element waveform 357) +(is_waveform_of 357 356) + +(is_port_of 356 354) +(add_element port 358) +(add_element string 12) +(set_function line 358 12) +(add_element string 7) +(set_function column 358 7) +(add_element string 13) +(set_function identifier 358 13) +(has_visible_flag 358) +(add_element string 9) +(is_of_mode 358 9) + +(add_element waveform 359) +(is_waveform_of 359 358) + +(is_port_of 358 354) +(add_element port 360) +(add_element string 16) +(set_function line 360 16) +(add_element string 7) +(set_function column 360 7) +(add_element string 361) +(set_function identifier 360 361) +(has_visible_flag 360) +(add_element string 9) +(is_of_mode 360 9) + +(add_element waveform 362) +(is_waveform_of 362 360) + +(is_port_of 360 354) +(add_element port 363) +(add_element string 20) +(set_function line 363 20) +(add_element string 7) +(set_function column 363 7) +(add_element string 364) +(set_function identifier 363 364) +(has_visible_flag 363) +(add_element string 30) +(is_of_mode 363 30) + +(add_element waveform 365) +(is_waveform_of 365 363) + +(is_port_of 363 354) +(add_element architecture 366) +(add_element string 103) +(set_function line 366 103) +(add_element string 33) +(set_function column 366 33) +(add_element string 38) +(set_function identifier 366 38) +(has_visible_flag 366) +(is_in_file 366 352) + +(add_element signal 367) +(add_element string 107) +(set_function line 367 107) +(add_element string 20) +(set_function column 367 20) +(add_element string 368) +(set_function identifier 367 368) +(has_visible_flag 367) +(add_element string 42) +(is_of_kind 367 42) + +(add_element waveform 369) +(is_waveform_of 369 367) + +(belongs_to_architecture 367 366) +(add_element signal 370) +(add_element string 215) +(set_function line 370 215) +(add_element string 20) +(set_function column 370 20) +(add_element string 371) +(set_function identifier 370 371) +(has_visible_flag 370) +(add_element string 42) +(is_of_kind 370 42) + +(add_element waveform 372) +(is_waveform_of 372 370) + +(belongs_to_architecture 370 366) +(add_element process 373) +(add_element string 220) +(set_function line 373 220) +(add_element string 50) +(set_function column 373 50) +(add_element string 374) +(set_function label 373 374) +(is_explicit_process 373) +(has_visible_flag 373) +(has_label 373) +(end_has_reserved_id 373) +(is_in_sensitivity_list 357 373) +(is_in_sensitivity_list 359 373) +(is_accessed_by 359 373) +(is_accessed_by 369 373) +(is_accessed_by 357 373) +(is_accessed_by 369 373) +(is_accessed_by 362 373) +(is_accessed_by 357 373) +(is_accessed_by 359 373) + +(belongs_to_architecture 373 366) +(add_element process 379) +(add_element string 380) +(set_function line 379 380) +(add_element string 50) +(set_function column 379 50) +(add_element string 381) +(set_function label 379 381) +(is_explicit_process 379) +(has_visible_flag 379) +(has_label 379) +(end_has_reserved_id 379) +(is_in_sensitivity_list 357 379) +(is_in_sensitivity_list 359 379) +(is_accessed_by 359 379) +(is_accessed_by 372 379) + +(is_accessed_by 357 379) +(is_accessed_by 372 379) +(is_accessed_by 362 379) +(is_accessed_by 357 379) +(is_accessed_by 359 379) + +(belongs_to_architecture 379 366) +(add_element process 386) +(add_element string 387) +(set_function line 386 387) +(add_element string 50) +(set_function column 386 50) +(add_element string 56) +(set_function label 386 56) +(is_ref 386) +(is_in_sensitivity_list 372 386) +(is_accessed_by 365 386) +(is_accessed_by 372 386) + +(belongs_to_architecture 386 366) +(is_architecture_of 366 354) +(add_element file 389) +(add_element string 390) +(set_function filename 389 390) +(add_element entity 391) +(add_element string 3) +(set_function line 391 3) +(add_element string 4) +(set_function column 391 4) +(add_element string 392) +(set_function identifier 391 392) +(has_visible_flag 391) +(end_has_identifier 391) +(is_in_file 391 389) + +(add_element port 393) +(add_element string 103) +(set_function line 393 103) +(add_element string 7) +(set_function column 393 7) +(add_element string 8) +(set_function identifier 393 8) +(has_visible_flag 393) +(add_element string 9) +(is_of_mode 393 9) + +(add_element waveform 394) +(is_waveform_of 394 393) + +(is_port_of 393 391) +(add_element port 395) +(add_element string 107) +(set_function line 395 107) +(add_element string 7) +(set_function column 395 7) +(add_element string 13) +(set_function identifier 395 13) +(has_visible_flag 395) +(add_element string 9) +(is_of_mode 395 9) + +(add_element waveform 396) +(is_waveform_of 396 395) + +(is_port_of 395 391) +(add_element port 397) +(add_element string 215) +(set_function line 397 215) +(add_element string 7) +(set_function column 397 7) +(add_element string 88) +(set_function identifier 397 88) +(has_visible_flag 397) +(add_element string 9) +(is_of_mode 397 9) + +(add_element waveform 398) +(is_waveform_of 398 397) + +(is_port_of 397 391) +(add_element port 399) +(add_element string 37) +(set_function line 399 37) +(add_element string 7) +(set_function column 399 7) +(add_element string 400) +(set_function identifier 399 400) +(has_visible_flag 399) +(add_element string 9) +(is_of_mode 399 9) + +(add_element waveform 401) +(is_waveform_of 401 399) + +(is_port_of 399 391) +(add_element port 402) +(add_element string 220) +(set_function line 402 220) +(add_element string 7) +(set_function column 402 7) +(add_element string 403) +(set_function identifier 402 403) +(has_visible_flag 402) +(add_element string 30) +(is_of_mode 402 30) + +(add_element waveform 404) +(is_waveform_of 404 402) + +(is_port_of 402 391) +(add_element generic 405) +(add_element string 20) +(set_function line 405 20) +(add_element string 7) +(set_function column 405 7) +(add_element string 406) +(set_function identifier 405 406) +(has_visible_flag 405) + +(is_generic_of 405 391) +(add_element architecture 407) +(add_element string 119) +(set_function line 407 119) +(add_element string 33) +(set_function column 407 33) +(add_element string 38) +(set_function identifier 407 38) +(has_visible_flag 407) +(is_in_file 407 389) + +(add_element signal 408) +(add_element string 292) +(set_function line 408 292) +(add_element string 20) +(set_function column 408 20) +(add_element string 409) +(set_function identifier 408 409) +(has_visible_flag 408) +(add_element string 42) +(is_of_kind 408 42) + +(add_element waveform 410) +(is_waveform_of 410 408) + +(belongs_to_architecture 408 407) +(add_element process 411) +(add_element string 223) +(set_function line 411 223) +(add_element string 50) +(set_function column 411 50) +(add_element string 336) +(set_function label 411 336) +(is_explicit_process 411) +(has_visible_flag 411) +(has_label 411) +(end_has_reserved_id 411) +(is_in_sensitivity_list 394 411) +(is_in_sensitivity_list 396 411) +(is_accessed_by 396 411) +(is_accessed_by 410 411) + +(is_accessed_by 394 411) +(is_accessed_by 398 411) +(is_accessed_by 410 411) +(is_accessed_by 401 411) +(is_accessed_by 410 411) +(is_accessed_by 410 411) +(is_accessed_by 401 411) +(is_accessed_by 410 411) +(is_accessed_by 410 411) +(is_accessed_by 394 411) +(is_accessed_by 396 411) + +(belongs_to_architecture 411 407) +(add_element process 421) +(add_element string 422) +(set_function line 421 422) +(add_element string 50) +(set_function column 421 50) +(add_element string 56) +(set_function label 421 56) +(is_ref 421) +(is_in_sensitivity_list 401 421) +(is_in_sensitivity_list 410 421) +(is_accessed_by 410 421) +(is_accessed_by 404 421) +(is_accessed_by 401 421) + +(belongs_to_architecture 421 407) +(is_architecture_of 407 391) +(add_element file 427) +(add_element string 428) +(set_function filename 427 428) +(add_element entity 429) +(add_element string 12) +(set_function line 429 12) +(add_element string 4) +(set_function column 429 4) +(add_element string 430) +(set_function identifier 429 430) +(has_visible_flag 429) +(end_has_identifier 429) +(is_in_file 429 427) + +(add_element port 431) +(add_element string 24) +(set_function line 431 24) +(add_element string 7) +(set_function column 431 7) +(add_element string 8) +(set_function identifier 431 8) +(has_visible_flag 431) +(add_element string 9) +(is_of_mode 431 9) + +(add_element waveform 432) +(is_waveform_of 432 431) + +(is_port_of 431 429) +(add_element port 433) +(add_element string 28) +(set_function line 433 28) +(add_element string 7) +(set_function column 433 7) +(add_element string 13) +(set_function identifier 433 13) +(has_visible_flag 433) +(add_element string 9) +(is_of_mode 433 9) + +(add_element waveform 434) +(is_waveform_of 434 433) + +(is_port_of 433 429) +(add_element port 435) +(add_element string 33) +(set_function line 435 33) +(add_element string 7) +(set_function column 435 7) +(add_element string 436) +(set_function identifier 435 436) +(has_visible_flag 435) +(add_element string 9) +(is_of_mode 435 9) + +(add_element waveform 437) +(is_waveform_of 437 435) + +(is_port_of 435 429) +(add_element port 438) +(add_element string 103) +(set_function line 438 103) +(add_element string 7) +(set_function column 438 7) +(add_element string 439) +(set_function identifier 438 439) +(has_visible_flag 438) +(add_element string 9) +(is_of_mode 438 9) + +(add_element waveform 440) +(is_waveform_of 440 438) + +(is_port_of 438 429) +(add_element port 441) +(add_element string 107) +(set_function line 441 107) +(add_element string 7) +(set_function column 441 7) +(add_element string 196) +(set_function identifier 441 196) +(has_visible_flag 441) +(add_element string 30) +(is_of_mode 441 30) + +(add_element waveform 442) +(is_waveform_of 442 441) + +(is_port_of 441 429) +(add_element port 443) +(add_element string 215) +(set_function line 443 215) +(add_element string 7) +(set_function column 443 7) +(add_element string 287) +(set_function identifier 443 287) +(has_visible_flag 443) +(add_element string 30) +(is_of_mode 443 30) + +(add_element waveform 444) +(is_waveform_of 444 443) + +(is_port_of 443 429) +(add_element architecture 445) +(add_element string 112) +(set_function line 445 112) +(add_element string 33) +(set_function column 445 33) +(add_element string 38) +(set_function identifier 445 38) +(has_visible_flag 445) +(is_in_file 445 427) + +(add_element signal 446) +(add_element string 119) +(set_function line 446 119) +(add_element string 20) +(set_function column 446 20) +(add_element string 447) +(set_function identifier 446 447) +(has_visible_flag 446) +(add_element string 42) +(is_of_kind 446 42) + +(add_element waveform 448) +(is_waveform_of 448 446) + +(belongs_to_architecture 446 445) +(add_element signal 449) +(add_element string 49) +(set_function line 449 49) +(add_element string 20) +(set_function column 449 20) +(add_element string 450) +(set_function identifier 449 450) +(has_visible_flag 449) +(add_element string 42) +(is_of_kind 449 42) + +(add_element waveform 451) +(is_waveform_of 451 449) + +(belongs_to_architecture 449 445) +(add_element signal 452) +(add_element string 126) +(set_function line 452 126) +(add_element string 20) +(set_function column 452 20) +(add_element string 453) +(set_function identifier 452 453) +(has_visible_flag 452) +(add_element string 42) +(is_of_kind 452 42) + +(add_element waveform 454) +(is_waveform_of 454 452) + +(belongs_to_architecture 452 445) +(add_element signal 455) +(add_element string 292) +(set_function line 455 292) +(add_element string 20) +(set_function column 455 20) +(add_element string 113) +(set_function identifier 455 113) +(has_visible_flag 455) +(add_element string 42) +(is_of_kind 455 42) + +(add_element waveform 456) +(is_waveform_of 456 455) + +(belongs_to_architecture 455 445) +(add_element signal 457) +(add_element string 130) +(set_function line 457 130) +(add_element string 20) +(set_function column 457 20) +(add_element string 458) +(set_function identifier 457 458) +(has_visible_flag 457) +(add_element string 42) +(is_of_kind 457 42) + +(add_element waveform 459) +(is_waveform_of 459 457) + +(belongs_to_architecture 457 445) +(add_element signal 460) +(add_element string 223) +(set_function line 460 223) +(add_element string 20) +(set_function column 460 20) +(add_element string 461) +(set_function identifier 460 461) +(has_visible_flag 460) +(add_element string 42) +(is_of_kind 460 42) + +(add_element waveform 462) +(is_waveform_of 462 460) + +(belongs_to_architecture 460 445) +(add_element signal 463) +(add_element string 464) +(set_function line 463 464) +(add_element string 20) +(set_function column 463 20) +(add_element string 465) +(set_function identifier 463 465) +(has_visible_flag 463) +(add_element string 42) +(is_of_kind 463 42) + +(add_element waveform 466) +(is_waveform_of 466 463) + +(belongs_to_architecture 463 445) +(add_element signal 467) +(add_element string 468) +(set_function line 467 468) +(add_element string 20) +(set_function column 467 20) +(add_element string 469) +(set_function identifier 467 469) +(has_visible_flag 467) +(add_element string 42) +(is_of_kind 467 42) + +(add_element waveform 470) +(is_waveform_of 470 467) + +(belongs_to_architecture 467 445) +(add_element signal 471) +(add_element string 225) +(set_function line 471 225) +(add_element string 20) +(set_function column 471 20) +(add_element string 472) +(set_function identifier 471 472) +(has_visible_flag 471) +(add_element string 42) +(is_of_kind 471 42) + +(add_element waveform 473) +(is_waveform_of 473 471) + +(belongs_to_architecture 471 445) +(add_element signal 474) +(add_element string 380) +(set_function line 474 380) +(add_element string 20) +(set_function column 474 20) +(add_element string 475) +(set_function identifier 474 475) +(has_visible_flag 474) +(add_element string 42) +(is_of_kind 474 42) + +(add_element waveform 476) +(is_waveform_of 476 474) + +(belongs_to_architecture 474 445) +(add_element signal 477) +(add_element string 478) +(set_function line 477 478) +(add_element string 20) +(set_function column 477 20) +(add_element string 479) +(set_function identifier 477 479) +(has_visible_flag 477) +(add_element string 42) +(is_of_kind 477 42) + +(add_element waveform 480) +(is_waveform_of 480 477) + +(belongs_to_architecture 477 445) +(add_element component 481) +(add_element string 180) +(set_function line 481 180) +(add_element string 50) +(set_function column 481 50) +(add_element string 482) +(set_function label 481 482) +(is_component_of 481 354) +(port_maps 481 432 356) +(port_maps 481 434 358) +(port_maps 481 437 360) +(port_maps 481 459 363) +(belongs_to_architecture 481 445) +(add_element component 483) +(add_element string 484) +(set_function line 483 484) +(add_element string 50) +(set_function column 483 50) +(add_element string 485) +(set_function label 483 485) +(is_component_of 483 354) +(port_maps 483 432 356) +(port_maps 483 434 358) +(port_maps 483 440 360) +(port_maps 483 462 363) +(belongs_to_architecture 483 445) +(add_element component 486) +(add_element string 487) +(set_function line 486 487) +(add_element string 50) +(set_function column 486 50) +(add_element string 488) +(set_function label 486 488) +(is_component_of 486 391) +(port_maps 486 432 393) +(port_maps 486 434 395) +(port_maps 486 451 397) +(port_maps 486 454 399) +(port_maps 486 448 402) +(belongs_to_architecture 486 445) +(add_element component 489) +(add_element string 490) +(set_function line 489 490) +(add_element string 50) +(set_function column 489 50) +(add_element string 491) +(set_function label 489 491) +(is_component_of 489 266) +(port_maps 489 432 268) +(port_maps 489 434 270) +(port_maps 489 470 272) +(port_maps 489 473 275) +(port_maps 489 476 278) +(port_maps 489 480 281) +(port_maps 489 466 284) +(port_maps 489 444 286) +(belongs_to_architecture 489 445) +(add_element component 492) +(add_element string 493) +(set_function line 492 493) +(add_element string 50) +(set_function column 492 50) +(add_element string 494) +(set_function label 492 494) +(is_component_of 492 190) +(port_maps 492 466 192) +(port_maps 492 442 195) +(belongs_to_architecture 492 445) +(add_element component 495) +(add_element string 496) +(set_function line 495 496) +(add_element string 50) +(set_function column 495 50) +(add_element string 497) +(set_function label 495 497) +(is_component_of 495 81) +(port_maps 495 432 83) +(port_maps 495 434 85) +(port_maps 495 451 87) +(port_maps 495 448 90) +(port_maps 495 456 93) +(port_maps 495 470 96) +(port_maps 495 473 99) +(port_maps 495 476 102) +(port_maps 495 480 106) +(belongs_to_architecture 495 445) +(add_element component 498) +(add_element string 499) +(set_function line 498 499) +(add_element string 50) +(set_function column 498 50) +(add_element string 500) +(set_function label 498 500) +(is_component_of 498 2) +(port_maps 498 432 6) +(port_maps 498 434 11) +(port_maps 498 459 15) +(port_maps 498 462 19) +(port_maps 498 456 23) +(port_maps 498 454 27) +(port_maps 498 451 32) +(belongs_to_architecture 498 445) +(is_architecture_of 445 429) diff --git a/data/level/structural_level.data b/data/level/structural_level.data new file mode 100644 index 0000000..75c4ac9 --- /dev/null +++ b/data/level/structural_level.data @@ -0,0 +1,112 @@ +;; Structural Level + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; TYPES DECLARATION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(add_type entity) +(add_type port) +(add_type port_mode) +(add_type generic) +(add_type architecture) +(add_type signal) +(add_type process) +(add_type file) +(add_type component) +(add_type waveform) +(add_type string) +(add_type type) +(add_type type_kind) +(add_type signal_kind) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; PREDICATES DECLARATION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;;;; Entity ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate is_in_file entity file) +(add_predicate has_begin entity) +(add_predicate has_visible_flag entity) +(add_predicate end_has_reserved_id entity) +(add_predicate end_has_identifier entity) +(add_predicate is_simulation_scenario entity) + +;;;; Port ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate is_port_of port entity) +(add_predicate has_disconnect_flag port) +(add_predicate is_of_mode port string) +(add_predicate has_class port) +(add_predicate is_ref port) +(add_predicate has_active_flag port) +(add_predicate has_identifier_list port) +(add_predicate has_visible_flag port) +(add_predicate has_after_drivers_flag port) +(add_predicate has_use_flag port) +(add_predicate has_open_flag port) +(add_predicate has_guarded_signal_flag port) +(add_predicate is_of_kind port string) + +;;;; Generic ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate is_generic_of generic entity) +(add_predicate has_class generic) +(add_predicate is_ref generic) +(add_predicate has_identifier_list generic) +(add_predicate has_visible_flag generic) +(add_predicate has_after_drivers_flag generic) +(add_predicate is_of_type generic type) + +;;;; File ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate is_in_file architecture file) +(add_predicate is_architecture_of architecture entity) +(add_predicate has_foreign_flag architecture) +(add_predicate has_visible_flag architecture) +(add_predicate is_within_flag architecture) +(add_predicate end_has_reserved_id architecture) +(add_predicate end_has_identifier architecture) + +;;;; Signal ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate belongs_to_architecture signal architecture) +(add_predicate has_disconnect_flag signal) +(add_predicate is_ref signal) +(add_predicate has_active_flag signal) +(add_predicate has_identifier_list signal) +(add_predicate has_visible_flag signal) +(add_predicate has_after_drivers signal) +(add_predicate has_use_flag signal) +(add_predicate has_open_flag signal) +(add_predicate has_guarded_flag signal) +(add_predicate is_of_kind signal string) +(add_predicate is_of_type signal type) + +;;;; Process ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate belongs_to_architecture process architecture) +(add_predicate has_seen_flag process) +(add_predicate end_has_postboned process) +(add_predicate has_postboned_flag process) +(add_predicate is_ref process) +(add_predicate has_passive_flag process) +(add_predicate has_visible_flag process) +(add_predicate is_within_flag process) +(add_predicate has_label process) +(add_predicate has_is process) +(add_predicate end_has_reserved_id process) +(add_predicate end_has_identifier process) +(add_predicate is_explicit_process process) + +;;;; Component ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate is_component_of component entity) +(add_predicate belongs_to_architecture component architecture) +(add_predicate port_maps component waveform port) + +;;;; Waveform ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate is_in_sensitivity_list waveform process) +(add_predicate is_accessed_by waveform process) +(add_predicate is_waveform_of waveform signal) +(add_predicate is_waveform_of waveform port) + +;;;; String ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate string_matches string string) + +;;;; Type ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(add_predicate is_approved_type type) +(add_predicate is_of_kind type string) diff --git a/instr-scripts/Makefile b/instr-scripts/Makefile new file mode 100644 index 0000000..5bdc767 --- /dev/null +++ b/instr-scripts/Makefile @@ -0,0 +1,33 @@ +################################################################################ +## LOCAL CONF ################################################################## +################################################################################ +AST_FILE = ../data/ast/best_chronometer_ever.xml + +PYTHON_EXEC = python3 + +## Structural Level +SL_INST_FILE = system.sl +SL_EXTRA_FILE = system_extra.sl + +################################################################################ +## PROGRAM FILES ############################################################### +################################################################################ +UTIL_LIBS = id_manager.py waveform_manager.py process_internals.py +SL_LEVEL_GEN = structural_level.py + +#EXTRA_SL_PARSER = sl_extra.py +################################################################################ +GLOBAL_DEPS = $(UTIL_LIBS) $(AST_FILE) + +$(SL_INST_FILE): $(SL_LEVEL_GEN) $(GLOBAL_DEPS) + $(PYTHON_EXEC) $(SL_LEVEL_GEN) \ + -i $(AST_FILE) \ + -io $(SL_INST_FILE) \ + -eo $(SL_EXTRA_FILE) + +export: + scp \ + __init__.py Makefile \ + $(UTIL_LIBS) \ + $(SL_LEVEL_GEN) \ + dreamhost:~/noot-noot/onera_2017/scripts/ diff --git a/instr-scripts/__init__.py b/instr-scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/instr-scripts/id_manager.py b/instr-scripts/id_manager.py new file mode 100644 index 0000000..a406cd6 --- /dev/null +++ b/instr-scripts/id_manager.py @@ -0,0 +1,82 @@ +class Id_Manager: + def __init__ (self, output_file, starting_index): + self.output = output_file + self.next_id = starting_index + self.xml_to_id = dict() + self.id_to_xml = dict() + self.string_to_id = dict() + self.id_to_string = dict() + + def generate_new_pure_id (self): + result = str(self.next_id) + self.next_id += 1 + + return result + + def generate_new_id (self, xml_id): + result = str(self.next_id) + self.next_id += 1 + self.xml_to_id[xml_id] = result + self.id_to_xml[result] = xml_id + + self.output.write( + "(map_xml_id " + + xml_id + + " " + + result + + ")\n" + ) + + return result + + def generate_new_id_for_string (self, string): + result = str(self.next_id) + self.next_id += 1 + self.string_to_id[string] = result + self.id_to_string[result] = string + + self.output.write( + "(map_string \"" + + string + + "\" " + + result + + ")\n" + ) + + return result + + def get_id_from_string (self, string): + result = self.string_to_id.get(string) + + if (result == None): + return self.generate_new_id_for_string(string) + else: + return result + + def get_string_from_id (self, tid): + return self.string_from_id[tid] + + def get_id_from_xml (self, xml_id): + result = self.xml_to_id.get(xml_id) + + if (result == None): + return self.generate_new_id(xml_id) + else: + return result + + def get_xml_from_id (self, tid): + return self.id_to_xml.get(tid) + + def force_id_association (self, xml_id, tid): + self.xml_to_id[xml_id] = tid + self.id_to_xml[tid] = xml_id + + def set_next_id (self, next_id): + self.next_id = next_id + + def finalize (self): + self.output.write( + "(is_next_id " + + str(self.next_id) + + ")\n" + ) diff --git a/instr-scripts/process_internals.py b/instr-scripts/process_internals.py new file mode 100644 index 0000000..e323300 --- /dev/null +++ b/instr-scripts/process_internals.py @@ -0,0 +1,517 @@ +def new_element_from_xml ( + inst_list_output, + id_manager, + etype, + xml_id +): + result = id_manager.get_id_from_xml(xml_id) + + inst_list_output.write("(add_element " + etype + " " + result + ")\n") + + return result + +def new_element_from_string ( + inst_list_output, + id_manager, + string +): + result = id_manager.get_id_from_string(string) + + inst_list_output.write("(add_element string " + result + ")\n") + + return result + +def new_element ( + inst_list_output, + id_manager, + etype +): + result = id_manager.generate_new_pure_id() + + inst_list_output.write("(add_element " + etype + " " + result + ")\n") + + return result + +class Process_Internals: + def __init__ (self, xml, id_manager, wfm_manager, output): + self.xml = xml + self.id_manager = id_manager + self.wfm_manager = wfm_manager + self.output = output + + def parse (self): + start = self.xml.find("./sequential_statement_chain") + + self.handle_sequential_statement_chain( + start, + [], + 0, + [] + ) + + def handle_sequential_statement_chain ( + self, + xml, + prev_nodes, + node_depth, + extra_attributes + ): + instructions = xml.findall("./el") + + for el in instructions: + el_kind = el.attrib.get("kind") + + if (el_kind == "if_statement"): + prev_nodes = self.handle_if_node( + el, + prev_nodes, + node_depth, + extra_attributes + ) + elif (el_kind == "simple_signal_assignment_statement"): + prev_nodes = self.handle_signal_assignment_node( + el, + prev_nodes, + node_depth, + extra_attributes + ) + elif (el_kind == "case_statement"): + prev_nodes = self.handle_case_node( + el, + prev_nodes, + node_depth, + extra_attributes + ) + else: + raise Exception ( + "Unimplemented instruction kind \"" + + el_kind + + "\"" + ) + + extra_attributes = [] + + return prev_nodes + + + def handle_if_node (self, xml, prev_nodes, node_depth, extra_attributes): + cond_node_id = new_element(self.output, self.id_manager, "node") + + for pn in prev_nodes: + self.output.write( + "(node_connect " + + pn + + " " + + cond_node_id + + ")\n" + ) + + cond_node_xml = xml.find("./condition") + + sources_xml = cond_node_xml.findall( + ".//named_entity" + ) + + for src_xml in sources_xml: + self.output.write( + "(expr_reads " + + cond_node_id + + " " + + self.id_manager.get_id_from_xml(src_xml.attrib.get("ref")) + + ")\n" + ) + + #### label + string_id = new_element_from_string( + self.output, + self.id_manager, + xml.attrib.get("label") + ) + self.output.write( + "(set_attribute label " + + cond_node_id + + " " + + string_id + + ")\n" + ) + + #### Expression + # TODO + + #### Kind + string_id = new_element_from_string( + self.output, + self.id_manager, + "IF" + ) + self.output.write( + "(set_attribute kind " + + cond_node_id + + " " + + string_id + + ")\n" + ) + + #### Options + for attr in extra_attributes: + string_id = new_element_from_string( + self.output, + self.id_manager, + attr + ) + self.output.write( + "(add_option " + cond_node_id + " " + string_id + ")\n" + ) + + #### Depth + self.output.write( + "(set_attribute depth " + + cond_node_id + + " " + + str(node_depth + 1) + + ")\n" + ) + + #### File / Line / Column + # TODO + + true_branch_xml = xml.find("./sequential_statement_chain") + + exit_points = self.handle_sequential_statement_chain ( + true_branch_xml, + [cond_node_id], + (node_depth + 2), + ["COND_WAS_TRUE"] + ) + + false_branch_xml = xml.find("./else_clause/sequential_statement_chain") + + if (false_branch_xml == None): + exit_points += prev_nodes + else: + exit_points += self.handle_sequential_statement_chain ( + false_branch_xml, + [cond_node_id], + (node_depth + 2), + ["COND_WAS_FALSE"] + ) + + return exit_points + + def handle_signal_assignment_node ( + self, + xml, + prev_nodes, + node_depth, + extra_attributes + ): + node_id = new_element(self.output, self.id_manager, "node") + + for pn in prev_nodes: + self.output.write( + "(node_connect " + + pn + + " " + + node_id + + ")\n" + ) + + #### label + string_id = new_element_from_string( + self.output, + self.id_manager, + xml.attrib.get("label") + ) + self.output.write( + "(set_attribute label " + + node_id + + " " + + string_id + + ")\n" + ) + + #### Expression + # TODO + + #### Kind + string_id = new_element_from_string( + self.output, + self.id_manager, + "INSTRUCTION" + ) + self.output.write( + "(set_attribute kind " + + node_id + + " " + + string_id + + ")\n" + ) + + #### Options + for attr in extra_attributes: + string_id = new_element_from_string( + self.output, + self.id_manager, + attr + ) + self.output.write( + "(add_option " + node_id + " " + string_id + ")\n" + ) + + #### Depth + self.output.write( + "(set_attribute depth " + + node_id + + " " + + str(node_depth) + + ")\n" + ) + + #### File / Line / Column + # TODO + + # Origin" style + #### Find the matching port + true_port = linked_entity.find( + "./port_chain/el[@identifier=\"" + + formal.attrib.get("identifier") + + "\"]" + ) + + if (true_port == None): + # TODO + raise Exception("Could not find true port for ...") + + inst_list_output.write( + "(port_maps " + + id_manager.get_id_from_xml(component.attrib.get("id")) + + " " + + wfm_manager.get_waveform_from_source( + id_manager.get_id_from_xml(actual_wfm.attrib.get("ref")) + ) + + " " + + id_manager.get_id_from_xml(true_port.attrib.get("id")) + + ")\n" + ) + +## Component uses reference from the architecture declaration ################## +def handle_component_internal_ref ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + component, + source +): + # We have to find the associated component declaration + ref_id = source.find("./base_name").attrib.get("ref") + + component_declaration = architecture.find( + "./declaration_chain/el[@kind=\"component_declaration\"][@id=\"" + + ref_id + + "\"]" + ) + + # Then find the actual referenced entity + linked_entity = root.find( + ".//library_unit[@kind=\"entity_declaration\"][@identifier=\"" + + component_declaration.attrib.get("identifier") + + "\"]" + ) + + if (linked_entity == None): + print( + "[W] Could not find entity linked to component " + + id_manager.get_id_from_xml(component.attrib.get("id")) + + " (XML id: \"" + + component.attrib.get("id") + + "\", \"" + + component.attrib.get("label") + + "\" from architecture \"" + + architecture.attrib.get("identifier") + + "\")." + ) + return None + + linked_entity_id = linked_entity.attrib.get("id") + + inst_list_output.write( + "(is_component_of " + + id_manager.get_id_from_xml(component.attrib.get("id")) + + " " + + id_manager.get_id_from_xml(linked_entity_id) + + ")\n" + ) + + return linked_entity + +## Component uses the name of the other entity directly ######################## +def handle_component_external_ref ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + component, + source +): + # FIXME: there's a simpler way: source->./entity_name/named_entity@ref + entity_ref = source.find( + "./entity_name[@kind=\"selected_name\"]" + ) + + library_ref = entity_ref.find( + "./prefix[@kind=\"simple_name\"]" + ) + + # Then find the actual referenced entity + linked_entity = root.find( + "./el[@kind=\"library_declaration\"][@identifier=\"" + + library_ref.attrib.get("identifier") + + "\"]//library_unit[@kind=\"entity_declaration\"][@identifier=\"" + + entity_ref.attrib.get("identifier") + + "\"]" + ) + + if (linked_entity == None): + print( + "[W] Could not find entity linked to component " + + id_manager.get_id_from_xml(component.attrib.get("id")) + + " (XML id: \"" + + component.attrib.get("id") + + "\", \"" + + elem.attrib.get("label") + + "\" from architecture \"" + + architecture.attrib.get("identifier") + + "\"), looked for \"" + + library_ref.attrib.get("identifier") + + "." + + + entity_ref.attrib.get("identifier") + +"\"." + ) + return None + + linked_entity_id = linked_entity.attrib.get("id") + + inst_list_output.write( + "(is_component_of " + + component.attrib.get("id") + + " " + + linked_entity_id + + ")\n" + ) + + return linked_entity + +################################################################################ +def handle_component ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + elem +): + xml_id = elem.attrib.get("id") + + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "component", + xml_id + ) + + ## Set Functions ########################################################### + #### line + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("line") + ) + inst_list_output.write( + "(set_function line " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("col") + ) + inst_list_output.write( + "(set_function column " + + local_id + + " " + + string_id + + ")\n" + ) + + #### label + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("label") + ) + inst_list_output.write( + "(set_function label " + + local_id + + " " + + string_id + + ")\n" + ) + + ## Set Unary Predicates #################################################### + + ## Find Source ############################################################# + source = elem.find("./instantiated_unit") + + linked_entity = None + #### If it is from a "component" declaration ############################### + if (source.attrib.get("kind") == "simple_name"): + linked_entity = handle_component_internal_ref( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + elem, + source + ) + #### If it is a more direct instantiation ################################## + elif (source.attrib.get("kind") == "entity_aspect_entity"): + linked_entity = handle_component_external_ref( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + elem, + source + ) + else: + raise Exception ( + "Unhandled component instantiation type for component " + + local_id + + " (XML id: \"" + + xml_id + + "\", \"" + + elem.attrib.get("label") + + "\" from architecture \"" + + architecture.attrib.get("identifier") + + "\")." + ) + + if (linked_entity != None): + ## Find Mapped Ports ################################################### + port_map = elem.find("./port_map_aspect_chain") + + if (port_map == None): + print( + "[W] Component instantiation " + + local_id + + " (XML id: \"" + + xml_id + + "\", \"" + + elem.attrib.get("label") + + "\" from architecture \"" + + architecture.attrib.get("identifier") + + "\") does not have any associated port map." + ) + else: + handle_port_map( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + elem, + linked_entity, + port_map + ) + + return xml_id + +################################################################################ +## PROCESSES ################################################################### +################################################################################ +def handle_process ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + elem +): + xml_id = elem.attrib.get("id") + + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "process", + xml_id + ) + + ## Set Functions ########################################################### + #### line + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("line") + ) + inst_list_output.write( + "(set_function line " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("col") + ) + inst_list_output.write( + "(set_function column " + + local_id + + " " + + string_id + + ")\n" + ) + + #### label + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("label") + ) + inst_list_output.write( + "(set_function label " + + local_id + + " " + + string_id + + ")\n" + ) + + ## Set Unary Predicates #################################################### + if (elem.attrib.get("seen_flag") == "true"): + inst_list_output.write("(has_seen_flag " + local_id + ")\n") + + if (elem.attrib.get("end_has_postponed") == "true"): + inst_list_output.write("(end_has_postponed " + local_id + ")\n") + + if (elem.attrib.get("is_ref") == "true"): + inst_list_output.write("(is_ref " + local_id + ")\n") + else: + inst_list_output.write("(is_explicit_process " + local_id + ")\n") + + if (elem.attrib.get("passive_flag") == "true"): + inst_list_output.write("(has_passive_flag " + local_id + ")\n") + + if (elem.attrib.get("postponed_flag") == "true"): + inst_list_output.write("(has_postponed_flag " + local_id + ")\n") + + if (elem.attrib.get("visible_flag") == "true"): + inst_list_output.write("(has_visible_flag " + local_id + ")\n") + + if (elem.attrib.get("is_within_flag") == "true"): + inst_list_output.write("(is_within_flag " + local_id + ")\n") + + if (elem.attrib.get("has_label") == "true"): + inst_list_output.write("(has_label " + local_id + ")\n") + + if (elem.attrib.get("has_is") == "true"): + inst_list_output.write("(has_is " + local_id + ")\n") + + if (elem.attrib.get("end_has_reserved_id") == "true"): + inst_list_output.write("(end_has_reserved_id " + local_id + ")\n") + + if (elem.attrib.get("end_has_identifier") == "true"): + inst_list_output.write("(end_has_identifier " + local_id + ")\n") + + ## Link with Waveforms ##################################################### + children = elem.findall( + "./sensitivity_list/el/named_entity" + ) + for c in children: + inst_list_output.write( + "(is_in_sensitivity_list " + + wfm_manager.get_waveform_from_source( + id_manager.get_id_from_xml(c.attrib.get("ref")) + ) + + " " + + local_id + + ")\n" + ) + + children = elem.findall( + "./sensitivity_list/el[@ref]" + ) + for c in children: + inst_list_output.write( + "(is_in_sensitivity_list " + + wfm_manager.get_waveform_from_source( + id_manager.get_id_from_xml(c.attrib.get("ref")) + ) + + " " + + local_id + + ")\n" + ) + + children = elem.findall( + ".//*[@kind=\"simple_name\"]/named_entity" + ) + for c in children: + inst_list_output.write( + "(is_accessed_by " + + wfm_manager.get_waveform_from_source( + id_manager.get_id_from_xml(c.attrib.get("ref")) + ) + + " " + + local_id + + ")\n" + ) + + ############################################################################ + inst_list_output.write("\n") + + # TODO: use 'pfp' parameter. + pf = open(('./pfp_id_' + local_id), 'w') + + internals = process_internals.Process_Internals( + elem, + id_manager, + wfm_manager, + pf + ) + internals.parse() + pf.write("\n") + pf.close() + + return xml_id + +################################################################################ +## Signals ##################################################################### +################################################################################ +def handle_signal ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + architecture, + elem +): + xml_id = elem.attrib.get("id") + + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "signal", + xml_id + ) + + ## Set Functions ########################################################### + #### line + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("line") + ) + inst_list_output.write( + "(set_function line " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("col") + ) + inst_list_output.write( + "(set_function column " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("identifier") + ) + inst_list_output.write( + "(set_function identifier " + + local_id + + " " + + string_id + + ")\n" + ) + + ## Set Unary Predicates #################################################### + if (elem.attrib.get("has_disconnect_flag") == "true"): + inst_llocalist_output.write("(has_disconnect_flag " + local_id + ")\n") + + if (elem.attrib.get("is_ref") == "true"): + inst_list_output.write("(is_ref " + local_id + ")\n") + + if (elem.attrib.get("has_active_flag") == "true"): + inst_list_output.write("(has_active_flag " + local_id + ")\n") + + if (elem.attrib.get("has_identifier_list") == "true"): + inst_list_output.write("(has_identifier_list " + local_id + ")\n") + + if (elem.attrib.get("visible_flag") == "true"): + inst_list_output.write("(has_visible_flag " + local_id + ")\n") + + if (elem.attrib.get("after_drivers_flag") == "true"): + inst_list_output.write("(has_after_drivers_flag " + local_id + ")\n") + + if (elem.attrib.get("use_flag") == "true"): + inst_list_output.write("(has_use_flag " + local_id + ")\n") + + if (elem.attrib.get("guarded_signal_flag") == "true"): + inst_list_output.write("(has_guarded_signal_flag " + local_id + ")\n") + + ## Set Other Predicates #################################################### + #### Link with Signal Kinds ################################################ + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("signal_kind").upper() + ) + inst_list_output.write( + "(is_of_kind " + + local_id + + " " + + string_id + + ")\n" + ) + + inst_list_output.write("\n") + + ## Matching Waveform ####################################################### + #### Add Element ########################################################### + waveform_id = wfm_manager.get_waveform_from_source(local_id) + inst_list_output.write("(add_element waveform " + waveform_id + ")\n") + + #### Link With Signal ###################################################### + inst_list_output.write( + "(is_waveform_of " + + waveform_id + + " " + + local_id + + ")\n" + ) + + ############################################################################ + inst_list_output.write("\n") + + return xml_id + +################################################################################ +## Architectures ############################################################### +################################################################################ +def handle_architecture ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + elem +): + xml_id = elem.attrib.get("id") + + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "architecture", + xml_id + ) + + ## Set Functions ########################################################### + #### line + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("line") + ) + inst_list_output.write( + "(set_function line " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("col") + ) + inst_list_output.write( + "(set_function column " + + local_id + + " " + + string_id + + ")\n" + ) + + #### identifier + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("identifier") + ) + inst_list_output.write( + "(set_function identifier " + + local_id + + " " + + string_id + + ")\n" + ) + + ## Set Unary Predicates #################################################### + if (elem.attrib.get("foreign_flag") == "true"): + inst_list_output.write("(has_foreign_flag " + local_id + ")\n") + + if (elem.attrib.get("visible_flag") == "true"): + inst_list_output.write("(has_visible_flag " + local_id + ")\n") + + if (elem.attrib.get("is_within_flag") == "true"): + inst_list_output.write("(is_within_flag " + local_id + ")\n") + + if (elem.attrib.get("end_has_reserved_id") == "true"): + inst_list_output.write("(end_has_reserved_id " + local_id + ")\n") + + if (elem.attrib.get("end_has_identifier") == "true"): + inst_list_output.write("(end_has_identifier " + local_id + ")\n") + + ## Link to Parent ########################################################## + inst_list_output.write( + "(is_in_file " + + local_id + + " " + + id_manager.get_id_from_xml(design_file.attrib.get("id")) + + ")\n" + ) + + inst_list_output.write("\n") + + ## Handle Children ######################################################### + #### Internal Signals ###################################################### + children = elem.findall( + "./*/el[@kind=\"signal_declaration\"]" + ) + for c in children: + c_id = handle_signal( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + elem, + c + ) + inst_list_output.write( + "(belongs_to_architecture " + + id_manager.get_id_from_xml(c_id) + + " " + + local_id + + ")\n" + ) + + #### Internal Processes #################################################### + children = elem.findall( + "./*/el[@kind=\"sensitized_process_statement\"]" + ) + for c in children: + c_id = handle_process( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + elem, + c + ) + inst_list_output.write( + "(belongs_to_architecture " + + id_manager.get_id_from_xml(c_id) + + " " + + local_id + + ")\n" + ) + + #### Internal Components ################################################### + children = elem.findall( + "./*/el[@kind=\"component_instantiation_statement\"]" + ) + for c in children: + c_id = handle_component( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + elem, + c + ) + inst_list_output.write( + "(belongs_to_architecture " + + id_manager.get_id_from_xml(c_id) + + " " + + local_id + + ")\n" + ) + + ############################################################################ + entity = elem.find("./entity_name/named_entity") + inst_list_output.write( + "(is_architecture_of " + + local_id + + " " + + id_manager.get_id_from_xml(entity.attrib.get("ref")) + + ")\n" + ) + return xml_id + +################################################################################ +## Generic Constants ########################################################### +################################################################################ +def handle_generic ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + entity, + elem +): + xml_id = elem.attrib.get("id") + + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "generic", + xml_id + ) + + ## Set Functions ########################################################### + #### line + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("line") + ) + inst_list_output.write( + "(set_function line " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("col") + ) + inst_list_output.write( + "(set_function column " + + local_id + + " " + + string_id + + ")\n" + ) + + #### identifier + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("identifier") + ) + inst_list_output.write( + "(set_function identifier " + + local_id + + " " + + string_id + + ")\n" + ) + + ## Set Unary Predicates #################################################### + if (elem.attrib.get("has_class") == "true"): + inst_list_output.write("(has_class " + local_id + ")\n") + + if (elem.attrib.get("is_ref") == "true"): + inst_list_output.write("(is_ref " + local_id + ")\n") + + if (elem.attrib.get("has_identifier_list") == "true"): + inst_list_output.write("(has_identifier_list " + local_id + ")\n") + + if (elem.attrib.get("visible_flag") == "true"): + inst_list_output.write("(has_visible_flag " + local_id + ")\n") + + if (elem.attrib.get("after_drivers_flag") == "true"): + inst_list_output.write("(has_after_drivers_flag " + local_id + ")\n") + + if (elem.attrib.get("use_flag") == "true"): + inst_list_output.write("(has_use_flag " + local_id + ")\n") + + if (elem.attrib.get("guarded_signal_flag") == "true"): + inst_list_output.write("(has_guarded_signal_flag " + local_id + ")\n") + + ############################################################################ + inst_list_output.write("\n") + + return xml_id + +################################################################################ +## Ports ####################################################################### +################################################################################ +def handle_port ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + entity, + elem +): + xml_id = elem.attrib.get("id") + + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "port", + xml_id + ) + + ## Set Functions ########################################################### + #### line + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("line") + ) + inst_list_output.write( + "(set_function line " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("col") + ) + inst_list_output.write( + "(set_function column " + + local_id + + " " + + string_id + + ")\n" + ) + + #### identifier + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("identifier") + ) + inst_list_output.write( + "(set_function identifier " + + local_id + + " " + + string_id + + ")\n" + ) + + ## Set Unary Predicates #################################################### + if (elem.attrib.get("has_disconnect_flag") == "true"): + inst_list_output.write("(has_disconnect_flag " + local_id + ")\n") + + if (elem.attrib.get("has_class") == "true"): + inst_list_output.write("(has_class " + local_id + ")\n") + + if (elem.attrib.get("is_ref") == "true"): + inst_list_output.write("(is_ref " + local_id + ")\n") + + if (elem.attrib.get("has_active_flag") == "true"): + inst_list_output.write("(has_active_flag " + local_id + ")\n") + + if (elem.attrib.get("has_identifier_list") == "true"): + inst_list_output.write("(has_identifier_list " + local_id + ")\n") + + if (elem.attrib.get("visible_flag") == "true"): + inst_list_output.write("(has_visible_flag " + local_id + ")\n") + + if (elem.attrib.get("after_drivers_flag") == "true"): + inst_list_output.write("(has_after_drivers_flag " + local_id + ")\n") + + if (elem.attrib.get("use_flag") == "true"): + inst_list_output.write("(has_use_flag " + local_id + ")\n") + + if (elem.attrib.get("open_flag") == "true"): + inst_list_output.write("(has_open_flag " + local_id + ")\n") + + if (elem.attrib.get("guarded_signal_flag") == "true"): + inst_list_output.write("(has_guarded_signal_flag " + local_id + ")\n") + + ## Link With Signal Modes ################################################## + if (elem.attrib.get("has_mode") == "true"): + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("mode").upper() + ) + inst_list_output.write( + "(is_of_mode " + + local_id + + " " + + string_id + + ")\n" + ) + else: + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("NONE").upper() + ) + inst_list_output.write("(is_of_mode " + local_id + " " + string_id + ")\n") + + inst_list_output.write("\n") + + ## Matching Waveform ####################################################### + #### Add Element ########################################################### + wfm_id = wfm_manager.get_waveform_from_source(local_id) + inst_list_output.write( + "(add_element waveform " + + wfm_id + + ")\n" + ) + + #### Link With Port ######################################################## + inst_list_output.write("(is_waveform_of " + wfm_id + " " + local_id + ")\n") + + ############################################################################ + inst_list_output.write("\n") + + return xml_id + +################################################################################ +## Entities #################################################################### +################################################################################ +def handle_entity ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + elem +): + xml_id = elem.attrib.get("id") + + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "entity", + xml_id + ) + + ## Set Functions ########################################################### + #### line + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("line") + ) + inst_list_output.write( + "(set_function line " + + local_id + + " " + + string_id + + ")\n" + ) + + #### column + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("col") + ) + inst_list_output.write( + "(set_function column " + + local_id + + " " + + string_id + + ")\n" + ) + + #### identifier + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("identifier") + ) + inst_list_output.write( + "(set_function identifier " + + local_id + + " " + + string_id + + ")\n" + ) + + ## Set Unary Predicates #################################################### + if (elem.attrib.get("has_begin") == "true"): + inst_list_output.write("(has_begin " + local_id + ")\n") + + if (elem.attrib.get("visible_flag") == "true"): + inst_list_output.write("(has_visible_flag " + local_id + ")\n") + + if (elem.attrib.get("is_within_flag") == "true"): + inst_list_output.write("(is_within_flag " + local_id + ")\n") + + if (elem.attrib.get("end_has_reserved_id") == "true"): + inst_list_output.write("(end_has_reserved_id " + local_id + ")\n") + + if (elem.attrib.get("end_has_identifier") == "true"): + inst_list_output.write("(end_has_identifier " + local_id + ")\n") + + ## Link to Parent ########################################################## + inst_list_output.write( + "(is_in_file " + + local_id + + " " + + id_manager.get_id_from_xml(design_file.attrib.get("id")) + + ")\n" + ) + + inst_list_output.write("\n") + + ## Handle Children ######################################################### + #### Ports ################################################################# + interfaces = elem.findall( + "./port_chain/el[@kind=\"interface_signal_declaration\"]" + ) + for p in interfaces: + p_id = handle_port( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + elem, + p + ) + inst_list_output.write( + "(is_port_of " + + id_manager.get_id_from_xml(p_id) + + " " + + local_id + + ")\n" + ) + + #### Generic Constants ##################################################### + interfaces = elem.findall( + "./generic_chain/el[@kind=\"interface_constant_declaration\"]" + ) + for g in interfaces: + g_id = handle_generic( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + design_file, + elem, + g + ) + inst_list_output.write( + "(is_generic_of " + + id_manager.get_id_from_xml(g_id) + + " " + + local_id + + ")\n" + ) + + return xml_id + +################################################################################ +## Files ####################################################################### +################################################################################ +def handle_design_file ( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + elem +): + xml_id = elem.attrib.get("id") + local_id = new_element_from_xml( + inst_list_output, + id_manager, + "file", + xml_id + ) + + ## Set Functions ########################################################### + #### filename + string_id = new_element_from_string( + inst_list_output, + id_manager, + elem.attrib.get("file") + ) + inst_list_output.write( + "(set_function filename " + + local_id + + " " + + string_id + + ")\n" + ) + local_id = id_manager.get_id_from_xml(xml_id) + + ## Handle Children ######################################################### + #### Entities ############################################################## + children = elem.findall( + "./*/*/library_unit[@kind=\"entity_declaration\"]" + ) + for c in children: + c_id = handle_entity( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + elem, + c + ) + + #### Architectures ######################################################### + children = elem.findall( + "./*/*/library_unit[@kind=\"architecture_body\"]" + ) + for c in children: + c_id = handle_architecture( + inst_list_output, + extra_output, + id_manager, + wfm_manager, + root, + elem, + c + ) + + ############################################################################ + return xml_id + +################################################################################ +### MAIN ####################################################################### +################################################################################ +parser = argparse.ArgumentParser( + description = ( + "Generates a list of instructions to construct the Structural Level." + ) +) + +parser.add_argument( + '-i', + '--input', + type = str, + required = True, + help = 'AST of the system produced by GHDL (XML).' +) + +parser.add_argument( + '-io', '--instructions-output', + type = argparse.FileType(mode = 'w', encoding = 'UTF-8'), + default = 'system.sl', + help = 'Instruction List output file (default: system.sl)', +) + +parser.add_argument( + '-eo', '--extra-output', + type = argparse.FileType(mode = 'w', encoding = 'UTF-8'), + default = 'system_extra.sl', + help = 'Extra Information output file (default: system_extra.sl)', +) + +parser.add_argument( + '-pfp', + '--process-files-prefix', + type = str, + default = "./process_instr_", + help = 'Resulting process description files: this + their ID.' +) + +args = parser.parse_args() + +xmltree = etree.parse(args.input) + +xmlroot = xmltree.getroot() + +id_manager = id_manager.Id_Manager(args.extra_output, 0) +wfm_manager = waveform_manager.Waveform_Manager(args.extra_output, id_manager) +## Handle Libraries ############################################################ +#elements = xmlroot.findall("./*/el[@kind=\"library_declaration\"]") +#[handle_library(e, root) for e in elements] + +## Handle Files ################################################################ +elements = xmlroot.findall("./*/*/el[@kind=\"design_file\"][@file]") +[ + handle_design_file( + args.instructions_output, + args.extra_output, + id_manager, + wfm_manager, + xmlroot, + e + ) for e in elements +] + +id_manager.finalize() diff --git a/instr-scripts/waveform_manager.py b/instr-scripts/waveform_manager.py new file mode 100644 index 0000000..e73ca2b --- /dev/null +++ b/instr-scripts/waveform_manager.py @@ -0,0 +1,34 @@ +class Waveform_Manager: + def __init__ (self, output_file, id_manager): + self.output = output_file + self.from_source = dict() + self.to_source = dict() + self.id_manager = id_manager + + def generate_new_waveform (self, source_id): + result = self.id_manager.generate_new_pure_id() + self.from_source[source_id] = result + self.to_source[result] = source_id + + self.output.write( + "(map_waveform " + + result + + " " + + source_id + + ")\n" + ) + + return result + + def get_waveform_from_source (self, source_id): + result = self.from_source.get(source_id) + + if (result == None): + return self.generate_new_waveform(source_id) + else: + return result + + def get_source_of_waveform (self, wfm_id): + result = self.to_source.get(wfm_id) + + return result diff --git a/instr-to-kodkod/Makefile b/instr-to-kodkod/Makefile new file mode 100644 index 0000000..fb2662a --- /dev/null +++ b/instr-to-kodkod/Makefile @@ -0,0 +1,25 @@ +JAVAC = javac +JAVA = java +SOURCES = $(wildcard src/*.java) +CLASSES = $(SOURCES:.java=.class) +CLASSPATH = "kodkod.jar:./src/:org.sat4j.core.jar" +TEST_FILE = "./system_minus_fun.sl" +DOWNLOADER = wget +JAR_SOURCE = https://noot-noot.org/onera_2017/jar/ +REQUIRED_JARS = kodkod.jar org.sat4j.core.jar + +all: $(CLASSES) + +clean: + rm -f $(CLASSES) + +run: $(CLASSES) $(REQUIRED_JARS) + $(JAVA) -cp $(CLASSPATH) Main $(TEST_FILE) + +%.class: %.java $(REQUIRED_JARS) + $(JAVAC) -cp $(CLASSPATH) $< + +%.jar: + echo "Attempting to download missing jar '$@'" + $(DOWNLOADER) "$(JAR_SOURCE)/$@" + diff --git a/instr-to-kodkod/src/Main.java b/instr-to-kodkod/src/Main.java new file mode 100644 index 0000000..d692ecd --- /dev/null +++ b/instr-to-kodkod/src/Main.java @@ -0,0 +1,82 @@ +/* FIXME: Finer imports */ +import kodkod.ast.*; + +import kodkod.engine.*; +import kodkod.engine.config.*; +import kodkod.engine.satlab.*; + +import kodkod.instance.*; +public class Main +{ + private static Formula get_formula (final VHDLModel model) + { + final Variable w; + + w = Variable.unary("w"); + + return + w.join + ( + model.get_predicate_as_relation("is_accessed_by") + ).no().forSome(w.oneOf(model.get_type_as_relation("waveform"))); + } + + public static void main (final String... args) + { + final VHDLModel model; + + final Universe univ; + final TupleFactory tf; + final Bounds bounds; + + final Solver solver; + final Solution sol; + + if (args.length != 1) + { + System.out.println("Use: java Main "); + + return; + } + + model = new VHDLModel(); + + try + { + VHDLLevel.add_to_model(model, "./structural_level.data"); + } + catch (final Exception e) + { + System.err.println("[E] Could not load structural level:"); + e.printStackTrace(); + + return; + } + + try + { + model.parse_file(args[0]); + } + catch (final Exception e) + { + System.err.println("[E] Could not load instructions:"); + e.printStackTrace(); + + return; + } + + univ = new Universe(model.get_atoms()); + tf = univ.factory(); + bounds = new Bounds(univ); + + model.add_to_bounds(bounds, tf); + + solver = new Solver(); + solver.options().setSolver(SATFactory.DefaultSAT4J); + solver.options().setReporter(new ConsoleReporter()); + + sol = solver.solve(get_formula(model), bounds); + + System.out.println(sol); + } +} diff --git a/instr-to-kodkod/src/QuickParser.java b/instr-to-kodkod/src/QuickParser.java new file mode 100644 index 0000000..47cea27 --- /dev/null +++ b/instr-to-kodkod/src/QuickParser.java @@ -0,0 +1,58 @@ +/* FIXME: Finer imports */ +import java.io.*; +import java.util.regex.*; +import java.util.*; + +public class QuickParser +{ + private static final Pattern instr_pattern; + private final BufferedReader buffered_reader; + + static + { + instr_pattern = Pattern.compile("\\((?[a-z_0-9 \"]+)\\)"); + } + public QuickParser (final String filename) + throws FileNotFoundException + { + buffered_reader = new BufferedReader(new FileReader(filename)); + } + + public void finalize () + throws IOException + { + buffered_reader.close(); + } + + public String[] parse_line () + throws IOException + { + final List result; + final Matcher matcher; + String line; + + do + { + line = buffered_reader.readLine(); + + if (line == null) + { + return new String[0]; + } + + line = line.replaceAll("\\s+"," "); + } + while (line.length() < 3 || line.startsWith(";")); + + matcher = instr_pattern.matcher(line); + + if (!matcher.find()) + { + System.err.println("[E] Invalid instruction \"" + line + "\""); + + return null; + } + + return matcher.group(1).split(" |\t"); + } +} diff --git a/instr-to-kodkod/src/VHDLLevel.java b/instr-to-kodkod/src/VHDLLevel.java new file mode 100644 index 0000000..738adaf --- /dev/null +++ b/instr-to-kodkod/src/VHDLLevel.java @@ -0,0 +1,157 @@ +/* FIXME: Finer imports */ +import java.util.*; + +import java.io.*; + +public class VHDLLevel +{ + /* Utility Class */ + private VHDLLevel () {} + + public static boolean add_to_model + ( + final VHDLModel m, + final String filename + ) + throws FileNotFoundException + { + final QuickParser qp; + String[] input; + boolean success; + + qp = new QuickParser(filename); + + for (;;) + { + try + { + input = qp.parse_line(); + + if (input == null) + { + qp.finalize(); + + return false; + } + else if (input.length == 0) + { + qp.finalize(); + + break; + } + } + catch (final IOException e) + { + System.err.println + ( + "[E] IO error while parsing file \"" + + filename + + "\":" + /* FIXME: can be null */ + + e.getMessage() + ); + + return false; + } + + if (input[0].equals("add_type")) + { + success = handle_add_type(input, m); + } + else if (input[0].equals("add_predicate")) + { + success = handle_add_predicate(input, m); + } + else + { + System.err.println + ( + "[E] Unknown instruction type \"" + + input[0] + + "\" in file \"" + + filename + + "\"." + ); + + return false; + } + + if (!success) + { + System.err.println + ( + "[E] An erroneous instruction was found in file \"" + + filename + + "\"." + ); + + try + { + qp.finalize(); + } + catch (final Exception e) + { + System.err.println("[E] Additionally:"); + e.printStackTrace(); + } + + return false; + } + } + + return true; + } + + private static boolean handle_add_type + ( + final String[] cmd, + final VHDLModel m + ) + { + if (cmd.length != 2) + { + System.err.println + ( + "[E] Badly formed \"add_type\" instruction: \"" + + String.join(" ", cmd) + + "\"." + ); + + return false; + } + + m.add_type(cmd[1]); + + return true; + } + + private static boolean handle_add_predicate + ( + final String[] cmd, + final VHDLModel m + ) + { + final String[] signature; + + if (cmd.length < 2) + { + System.err.println + ( + "[E] Badly formed \"add_predicate\" instruction: \"" + + String.join(" ", cmd) + + "\"." + ); + + return false; + } + + signature = new String[cmd.length - 2]; + + for (int i = 2; i < cmd.length; ++i) + { + signature[i - 2] = cmd[i]; + } + + return m.add_predicate(cmd[1], signature); + } +} diff --git a/instr-to-kodkod/src/VHDLModel.java b/instr-to-kodkod/src/VHDLModel.java new file mode 100644 index 0000000..bdb5e4b --- /dev/null +++ b/instr-to-kodkod/src/VHDLModel.java @@ -0,0 +1,336 @@ +/* FIXME: Finer imports */ +import java.util.*; + +import java.io.*; + +import kodkod.ast.*; +import kodkod.instance.*; + +public class VHDLModel +{ + private final Map types; + private final Map predicates; + + public VHDLModel () + { + types = new HashMap(); + predicates = new HashMap(); + } + + public void add_type (final String name) + { + if (!types.containsKey(name)) + { + types.put(name, new VHDLType(name)); + } + } + + public boolean add_predicate (final String name, final String[] signature) + { + final VHDLPredicate p; + final VHDLType[] true_signature; + + true_signature = new VHDLType[signature.length]; + + for (int i = 0; i < signature.length; ++i) + { + true_signature[i] = types.get(signature[i]); + + if (true_signature[i] == null) + { + System.err.println + ( + "[E] The predicate \"" + + name + + "\" uses an unknown type \"" + + signature[i] + + "\"" + ); + + return false; + } + } + + p = predicates.get(name); + + if (p == null) + { + predicates.put(name, new VHDLPredicate(name, true_signature)); + } + else + { + return p.add_signature(true_signature); + } + + return true; + } + + public boolean parse_file (final String filename) + throws FileNotFoundException + { + final QuickParser qp; + String[] input; + boolean success; + + qp = new QuickParser(filename); + + for (;;) + { + try + { + input = qp.parse_line(); + + if (input == null) + { + qp.finalize(); + + return false; + } + else if (input.length == 0) + { + qp.finalize(); + + break; + } + } + catch (final IOException e) + { + System.err.println + ( + "[E] IO error while parsing file \"" + + filename + + "\":" + /* FIXME: can be null */ + + e.getMessage() + ); + + return false; + } + + if (input[0].equals("add_element")) + { + success = handle_add_element(input); + } + else if (input[0].equals("set_function")) + { + success = handle_set_function(input); + } + else + { + success = handle_predicate(input); + } + + if (!success) + { + System.err.println + ( + "[E] An erroneous instruction was found in file \"" + + filename + + "\"." + ); + + try + { + qp.finalize(); + } + catch (final Exception e) + { + System.err.println("[E] Additionally:"); + e.printStackTrace(); + } + + return false; + } + } + + return true; + } + + private boolean handle_add_element (final String... cmd) + { + final VHDLType t; + + if (cmd.length != 3) + { + System.err.println + ( + "[E] Badly formed \"add_element\" instruction: \"" + + String.join(" ", cmd) + + "\"." + ); + + return false; + } + + t = types.get(cmd[1]); + + if (t == null) + { + System.err.println + ( + "[E] Instruction to add element to unknown type \"" + + cmd[1] + + "\": \"" + + String.join(" ", cmd) + + "\"." + ); + + return false; + } + + t.add_member(cmd[2]); + + return true; + } + + private boolean handle_set_function (final String... cmd) + { + if (cmd.length != 4) + { + System.err.println + ( + "[E] Badly formed \"set_function\" instruction: \"" + + String.join(" ", cmd) + + "\"." + ); + + return false; + } + + /* + System.err.println + ( + "[W] \"set_function\" instructions are ignored." + ); + */ + + return true; + } + + private boolean handle_predicate (final String... cmd) + { + final VHDLPredicate p; + final String[] params; + + params = new String[cmd.length - 1]; + + p = predicates.get(cmd[0]); + + if (p == null) + { + System.err.println + ( + "[E] Instruction with an unknown predicate (\"" + + cmd[0] + + "\"): \"" + + String.join(" ", cmd) + + "\"." + ); + + return false; + } + + if (params.length != p.get_arity()) + { + System.err.println + ( + "[E] Predicate \"" + + cmd[0] + + "\" is of arity " + + p.get_arity() + + ", making the instruction: \"" + + String.join(" ", cmd) + + "\" invalid." + ); + + return false; + } + + for (int i = 0; i < params.length; ++i) + { + /* TODO: check if the IDs are registered in the corresponding type. */ + params[i] = cmd[i + 1]; + + if (!p.accepts_as_nth_param(i, params[i])) + { + System.err.println + ( + "[E] The predicate \"" + + p.get_name() + + "\" has no signature allowing the element \"" + + params[i] + + "\" as " + + i + + "th parameter, making the instruction: \"" + + String.join(" ", cmd) + + "\" invalid." + ); + + return false; + } + } + + p.add_member(params); + + return true; + } + + public Collection get_atoms () + { + final Collection result; + + result = new ArrayList(); + + for (final VHDLType t: types.values()) + { + result.addAll(t.get_all_members_as_atoms()); + } + + return result; + } + + public void add_to_bounds (final Bounds b, final TupleFactory f) + { + for (final VHDLType t: types.values()) + { + t.add_to_bounds(b, f); + } + + for (final VHDLPredicate p: predicates.values()) + { + p.add_to_bounds(b, f); + } + } + + public Relation get_predicate_as_relation (final String name) + { + final VHDLPredicate p; + + p = predicates.get(name); + + if (p == null) + { + return null; + } + else + { + return p.get_as_relation(); + } + } + + public Relation get_type_as_relation (final String name) + { + final VHDLType t; + + t = types.get(name); + + if (t == null) + { + return null; + } + else + { + return t.get_as_relation(); + } + } +} diff --git a/instr-to-kodkod/src/VHDLPredicate.java b/instr-to-kodkod/src/VHDLPredicate.java new file mode 100644 index 0000000..a94e5ec --- /dev/null +++ b/instr-to-kodkod/src/VHDLPredicate.java @@ -0,0 +1,94 @@ +/* FIXME: Finer imports */ +import java.util.*; + +import kodkod.ast.*; +import kodkod.ast.operator.*; + +import kodkod.instance.*; + + +public class VHDLPredicate +{ + private final Collection signatures; + private final Collection members; + private final String name; + private final int arity; + private final Relation as_relation; + + public VHDLPredicate (final String name, final VHDLType[] signature) + { + this.name = name; + arity = signature.length; + + signatures = new ArrayList(); + members = new ArrayList(); + + as_relation = Relation.nary(name, arity); + + signatures.add(signature); + } + + public void add_member (final String[] tuple) + { + members.add(tuple); + } + + public int get_arity () + { + return arity; + } + + public Relation get_as_relation () + { + return as_relation; + } + + /* pre: i < get_arity() */ + public boolean accepts_as_nth_param (final int i, final String id) + { + for (VHDLType[] sig: signatures) + { + if (sig[i].get_member_as_relation(id) != null) + { + return true; + } + } + + return false; + } + + public boolean add_signature (final VHDLType[] signature) + { + if (signature.length != get_arity()) + { + return false; + } + + signatures.add(signature); + + return true; + } + + public String get_name () + { + return name; + } + + public void add_to_bounds (final Bounds b, final TupleFactory f) + { + final TupleSet as_tuples; + + /* Empty tuple set, will contain tuples of the right arity. */ + as_tuples = f.noneOf(get_arity()); + + /* For every member of this predicate ... */ + for (final Object[] ref: members) + { + /* add a new tuple to the tuple set representing the predicate. */ + as_tuples.add(f.tuple(ref)); + } + + /* We now have the exact definition of the predicate as a relation */ + b.boundExactly(as_relation, as_tuples); + } +} diff --git a/instr-to-kodkod/src/VHDLType.java b/instr-to-kodkod/src/VHDLType.java new file mode 100644 index 0000000..c4c1b0f --- /dev/null +++ b/instr-to-kodkod/src/VHDLType.java @@ -0,0 +1,76 @@ +/* FIXME: Finer imports */ +import java.util.*; + +import kodkod.ast.*; +import kodkod.ast.operator.*; + +import kodkod.instance.*; + + +public class VHDLType +{ + private final Map members; + private final String name; + private final Relation as_relation; + + public VHDLType (final String name) + { + members = new HashMap(); + + this.name = name; + as_relation = Relation.unary(name); + } + + public void add_member (final String id) + { + members.put(id, Relation.unary(id)); + } + + public String get_name () + { + return name; + } + + public Relation get_as_relation () + { + return as_relation; + } + + + public Relation get_member_as_relation (final String id) + { + return members.get(id); + } + + public Collection get_all_members_as_atoms () + { + return members.keySet(); + } + + public Formula generate_declarations () + { + Formula result; + + result = Formula.TRUE; + + return result; + } + + public void add_to_bounds (final Bounds b, final TupleFactory f) + { + final Set> members_as_set; + + members_as_set = members.entrySet(); + + for (final Map.Entry member: members_as_set) + { + b.boundExactly(member.getValue(), f.setOf(member.getKey())); + } + + /* + * the toArray() is required to avoid the collection being considered as + * a single atom. + */ + b.boundExactly(as_relation, f.setOf(get_all_members_as_atoms().toArray())); + } +} -- cgit v1.2.3-70-g09d2