-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
alexchen
committed
Jan 17, 2023
1 parent
6a23a6f
commit 6004a49
Showing
237 changed files
with
34,876 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
|
||
# Setup | ||
``` | ||
$ export PSS_HOME=$PWD | ||
``` | ||
|
||
# Build pssgen.jar | ||
``` | ||
$ cd $PSS_HOME/src | ||
$ make | ||
``` | ||
The **$PSS_HOME/src/pssgen.jar** should generated. | ||
|
||
|
||
# Run Example | ||
``` | ||
$ cd $PSS_HOME/samples | ||
$ source run.bash | ||
``` | ||
|
||
You should see the following logs. | ||
|
||
``` | ||
----------------------------------------- | ||
TOTAL=25, PASS=25, FAIL=0 | ||
----------------------------------------- | ||
grep "[PASS|FAIL]" test_*/result.log | ||
test_action_inference/result.log:PASS | ||
test_buffer_constraint/result.log:PASS | ||
test_collection_array/result.log:PASS | ||
test_collections/result.log:PASS | ||
test_comp_init/result.log:PASS | ||
test_constraint_by_cfg/result.log:PASS | ||
test_demo/result.log:PASS | ||
test_domain_open_range_list/result.log:PASS | ||
test_enum/result.log:PASS | ||
test_filelist/result.log:PASS | ||
test_hello_world/result.log:PASS | ||
test_if_constraint_item/result.log:PASS | ||
test_if_in_constraint/result.log:PASS | ||
test_init_up/result.log:PASS | ||
test_multi_constraint/result.log:PASS | ||
test_repeat_action_inst/result.log:PASS | ||
test_repeat_count/result.log:PASS | ||
test_repeat_with_array/result.log:PASS | ||
test_square_array/result.log:PASS | ||
test_target_code/result.log:PASS | ||
test_this/result.log:PASS | ||
test_unique/result.log:PASS | ||
test_unique_with_array/result.log:PASS | ||
test_with_constraint_ops/result.log:PASS | ||
test_with_multi_constraint/result.log:PASS | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright (c) 2012-2022 The ANTLR Project. All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither name of copyright holders nor the names of its contributors | ||
may be used to endorse or promote products derived from this software | ||
without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
See | ||
https://www.antlr.org/download.html | ||
https://github.com/antlr/website-antlr4/tree/gh-pages/download | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
PSS_HOME=/home/users1/alexchen/bin/pss-gen | ||
ANTLR4_JAR_PATH = $(PSS_HOME)/antlr4/antlr-4.9.3-complete.jar | ||
PSSGEN_JAR_PATH = $(PSS_HOME)/src/pssgen.jar | ||
PSSGEN = java -classpath $(PSSGEN_JAR_PATH):$(ANTLR4_JAR_PATH) PSSGenMain | ||
|
||
|
||
test: gentarget | ||
diff test.s test.s.golden; \ | ||
diff=$$?; \ | ||
if [ $$diff -eq 0 ]; then \ | ||
echo PASS >| result.log; \ | ||
else \ | ||
echo FAIL >| result.log; \ | ||
fi | ||
|
||
clean: | ||
rm -f test.s result.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.PHONY: test clean | ||
|
||
SUBDIRS = | ||
TEST_SUBDIRS = $(wildcard test_*) | ||
ALL_SUBDIRS = $(SUBDIRS) $(TEST_SUBDIRS) | ||
ARG = | ||
|
||
test: | ||
for i in $(TEST_SUBDIRS); do \ | ||
$(MAKE) -C $$i $@; \ | ||
done | ||
make result | ||
|
||
result: | ||
$(eval total := $(shell ls |grep test_ |wc -l)) | ||
$(eval pass := $(shell grep PASS test_*/result.log |wc -l)) | ||
$(eval fail := $(shell let "fail = $(total) - $(pass)" ; echo $$fail)) | ||
|
||
@echo ----------------------------------------- | ||
@echo TOTAL=$(total), PASS=$(pass), FAIL=$(fail) | ||
@echo ----------------------------------------- | ||
|
||
grep "[PASS|FAIL]" test_*/result.log | ||
|
||
clean: | ||
for i in $(ALL_SUBDIRS); do $(MAKE) -C $$i $@; done | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include ../Make.vars | ||
|
||
gentarget: | ||
$(PSSGEN) test.pss -o test.s -root pss_top::root_a || true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
component pss_top { | ||
buffer msg_buf { | ||
rand string s; | ||
} | ||
action display_a { | ||
input msg_buf msg; | ||
exec body SV = """$display("{{msg.s}}");"""; | ||
} | ||
action send_a { | ||
output msg_buf msg; | ||
exec body SV = """$send("{{msg.s}}");"""; | ||
} | ||
action root_a { | ||
activity { | ||
do display_a with {msg.s == "Hello ";}; | ||
do display_a with {msg.s == "World ";}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
$send("World "); | ||
$send("Hello "); | ||
$display("Hello "); | ||
$display("World "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include ../Make.vars | ||
|
||
gentarget: | ||
$(PSSGEN) -f pss.f || true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Output File | ||
-o test.s | ||
|
||
# Root Action | ||
-root pss_top::root_a | ||
|
||
|
||
# main | ||
test.pss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
component pss_top { | ||
buffer msg_buf { | ||
rand string s; | ||
constraint s == "Hello"; | ||
} | ||
action display_a { | ||
input msg_buf msg; | ||
exec body SV = """disp={{msg.s}}"""; | ||
} | ||
action send_a { | ||
output msg_buf msg; | ||
exec body SV = """send={{msg.s}}"""; | ||
} | ||
action root_a { | ||
send_a send; | ||
display_a disp; | ||
activity { | ||
send; | ||
disp; | ||
|
||
bind send.msg disp.msg; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
send=Hello | ||
disp=Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include ../Make.vars | ||
|
||
|
||
gentarget: | ||
$(PSSGEN) test.pss -o test.s -root pss_top::root_a || true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
component pss_top { | ||
action root_a { | ||
array <int, 3> a = {4, 5, 6}; | ||
array <int, 3> b; | ||
array <int, 3> c; | ||
|
||
exec pre_solve { | ||
b[0] = 7; | ||
b[1] = 8; | ||
b[2] = 9; | ||
c = {10, 11, 12}; | ||
} | ||
|
||
activity { | ||
do sub_a with { | ||
a[0] == this.a[0]; | ||
a[1] == this.a[1]; | ||
a[2] == this.a[2]; | ||
}; | ||
do sub_a with { | ||
a[0] == b[0]; | ||
a[1] == b[1]; | ||
a[2] == b[2]; | ||
}; | ||
do sub_a with { | ||
a[0] == c[0]; | ||
a[1] == c[1]; | ||
a[2] == c[2]; | ||
}; | ||
} | ||
} | ||
|
||
action sub_a { | ||
rand int a[3]; | ||
exec body ASM = """a[0]={{a[0]}}, a[1]={{a[1]}}, a[2]={{a[2]}}"""; | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a[0]=4, a[1]=5, a[2]=6 | ||
a[0]=7, a[1]=8, a[2]=9 | ||
a[0]=10, a[1]=11, a[2]=12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
PSS_HOME=/home/users1/alexchen/bin/pss-gen | ||
ANTLR4_JAR_PATH = $(PSS_HOME)/antlr4/antlr-4.9.3-complete.jar | ||
PSSGEN_JAR_PATH = $(PSS_HOME)/src/pssgen.jar | ||
PSSGEN = java -classpath $(PSSGEN_JAR_PATH):$(ANTLR4_JAR_PATH) PSSGenMain | ||
|
||
gentarget: | ||
$(PSSGEN) test.pss -o test.s -root pss_top::root_a || true | ||
|
||
test: gentarget | ||
diff test.s test.s.golden; \ | ||
diff=$$?; \ | ||
if [ $$diff -eq 0 ]; then \ | ||
echo PASS >| result.log; \ | ||
else \ | ||
echo FAIL >| result.log; \ | ||
fi | ||
|
||
clean: | ||
rm -f test.s result.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/*! | ||
@weakgroup test | ||
@{ | ||
@file | ||
@author Luther Lee | ||
@data 2022/10/11 | ||
@brief Test declaration, assignment, and index of collection. | ||
@version | ||
Portable Test and Stimulus Standard Version 2.0 <br> | ||
> Section 8.8 : Collections <br> | ||
|
||
### Test Command | ||
|
||
make test | ||
|
||
|
||
@bug PSSGenVisitor.visitMap_type(), Ln314: Syntax is not yet supported: 'map<string,int>' | ||
@bug PSSGenVisitor.visitSet_type(), Ln320: Syntax is not yet supported: 'set<int>' | ||
@bug PSS-ERROR: [LISTINDEX] '<pss_top>.<root_a>.<test>.my_list' index '1' is out of range | ||
*/ | ||
component pss_top { | ||
action test { | ||
// Test declaration | ||
int array1[3]; | ||
int array2[3]; | ||
array<int, 3> my_array; | ||
list<int> my_list; | ||
// map<string, int> my_map; // Fixme: PSSGenVisitor.visitMap_type(), Ln314: Syntax is not yet supported: 'map<string,int>' | ||
// set<int> my_set; // Fixme: PSSGenVisitor.visitSet_type(), Ln320: Syntax is not yet supported: 'set<int>' | ||
|
||
// Test assignment | ||
exec post_solve { | ||
array1[0] = 3; | ||
array1[1] = 2; | ||
array1[2] = 1; | ||
array2 = {13,12,11}; | ||
my_array = {23, 22, 21}; | ||
my_list = {33, 32, 31}; | ||
// my_map = {"a":43, "b":42, "c":41}; | ||
// my_set = {53, 52, 51}; | ||
} | ||
|
||
// Test index | ||
activity { | ||
do printf with {val == array1[1];}; | ||
do printf with {val == array2[1];}; | ||
do printf with {val == my_array[1];}; | ||
// do printf with {val == my_list[1];}; // Fixme: PSS-ERROR: [LISTINDEX] '<pss_top>.<root_a>.<test>.my_list' index '1' is out of range | ||
// do printf with {val == my_map["b"];}; | ||
// do printf with {val == my_set[1];}; | ||
} | ||
} | ||
|
||
action printf { | ||
rand int val; | ||
exec body ASM = | ||
"""val = {{val}}"""; | ||
} | ||
|
||
action root_a { | ||
activity { | ||
do test; | ||
} | ||
} | ||
} | ||
|
||
/**@}*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
val = 2 | ||
val = 12 | ||
val = 22 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
include ../Make.vars | ||
|
||
|
||
gentarget: | ||
$(PSSGEN) test.pss -o test.s -root pss_top::root_a || true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
component sub_c { | ||
int v0; | ||
int v1; | ||
int v2; | ||
|
||
exec init_down { | ||
v1 = v0 + 1; | ||
} | ||
exec init_up { | ||
v2 = v1 + 1; | ||
} | ||
} | ||
|
||
component pss_top { | ||
sub_c comp1; | ||
|
||
int v3; | ||
|
||
exec init_down { | ||
comp1.v0 = 0; | ||
} | ||
exec init_up { | ||
v3 = comp1.v2 + 1; | ||
} | ||
|
||
action root_a { | ||
exec body ASM = """v0={{comp1.v0}}, v1={{comp1.v1}}, v2={{comp1.v2}}, v3={{v3}}"""; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0=0, v1=1, v2=2, v3=3 |
Oops, something went wrong.