fix 1364-2001 and 1364-2001-noconfig keywords mixup

- swap 1364-2001 and 1364-2001-noconfig
- fix existing begin_keywords test
- add keyword test suite for all keywords
This commit is contained in:
Zachary Snow 2023-05-15 22:21:22 -04:00
parent 2aff725ea2
commit 0a7b0250e7
12 changed files with 328 additions and 7 deletions

View File

@ -11,7 +11,8 @@
* Fixed unneeded scoping of constant function calls used in type lookups
* `/*/` is no longer interpreted as a self-closing block comment, e.g.,
`$display("a"/*/,"b"/* */);` previously printed "ab", but now prints "a"
* Fixed keywords included in the "1364-2001" and "1364-2001-noconfig"
`begin_keywords` version specifiers
### New Features

View File

@ -33,13 +33,13 @@ newKeywords = [
KW_trireg, KW_vectored, KW_wait, KW_wand, KW_weak0, KW_weak1, KW_while,
KW_wire, KW_wor, KW_xnor, KW_xor]),
("1364-2001-noconfig", [KW_cell, KW_config, KW_design, KW_endconfig,
KW_incdir, KW_include, KW_instance, KW_liblist, KW_library, KW_use]),
("1364-2001", [KW_automatic, KW_endgenerate, KW_generate, KW_genvar,
KW_localparam, KW_noshowcancelled, KW_pulsestyle_ondetect,
("1364-2001-noconfig", [KW_automatic, KW_endgenerate, KW_generate,
KW_genvar, KW_localparam, KW_noshowcancelled, KW_pulsestyle_ondetect,
KW_pulsestyle_onevent, KW_showcancelled, KW_signed, KW_unsigned]),
("1364-2001", [KW_cell, KW_config, KW_design, KW_endconfig, KW_incdir,
KW_include, KW_instance, KW_liblist, KW_library, KW_use]),
("1364-2005", [KW_uwire]),
("1800-2005", [KW_alias, KW_always_comb, KW_always_ff, KW_always_latch,

102
test/keyword/1364-1995.txt Normal file
View File

@ -0,0 +1,102 @@
always
and
assign
begin
buf
bufif0
bufif1
case
casex
casez
cmos
deassign
default
defparam
disable
edge
else
end
endcase
endfunction
endmodule
endprimitive
endspecify
endtable
endtask
event
for
force
forever
fork
function
highz0
highz1
if
ifnone
initial
inout
input
integer
join
large
macromodule
medium
module
nand
negedge
nmos
nor
not
notif0
notif1
or
output
parameter
pmos
posedge
primitive
pull0
pull1
pulldown
pullup
rcmos
real
realtime
reg
release
repeat
rnmos
rpmos
rtran
rtranif0
rtranif1
scalared
small
specify
specparam
strong0
strong1
supply0
supply1
table
task
time
tran
tranif0
tranif1
tri
tri0
tri1
triand
trior
trireg
vectored
wait
wand
weak0
weak1
while
wire
wor
xnor
xor

View File

@ -0,0 +1,11 @@
automatic
endgenerate
generate
genvar
localparam
noshowcancelled
pulsestyle_ondetect
pulsestyle_onevent
showcancelled
signed
unsigned

View File

@ -0,0 +1,10 @@
cell
config
design
endconfig
incdir
include
instance
liblist
library
use

View File

@ -0,0 +1 @@
uwire

View File

@ -0,0 +1,97 @@
alias
always_comb
always_ff
always_latch
assert
assume
before
bind
bins
binsof
bit
break
byte
chandle
class
clocking
const
constraint
context
continue
cover
covergroup
coverpoint
cross
dist
do
endclass
endclocking
endgroup
endinterface
endpackage
endprogram
endproperty
endsequence
enum
expect
export
extends
extern
final
first_match
foreach
forkjoin
iff
ignore_bins
illegal_bins
import
inside
int
interface
intersect
join_any
join_none
local
logic
longint
matches
modport
new
null
package
packed
priority
program
property
protected
pure
rand
randc
randcase
randsequence
ref
return
sequence
shortint
shortreal
solve
static
string
struct
super
tagged
this
throughout
timeprecision
timeunit
type
typedef
union
unique
var
virtual
void
wait_order
wildcard
with
within

View File

@ -0,0 +1,23 @@
accept_on
checker
endchecker
eventually
global
implies
let
nexttime
reject_on
restrict
s_always
s_eventually
s_nexttime
s_until
s_until_with
strong
sync_accept_on
sync_reject_on
unique0
until
until_with
untyped
weak

View File

@ -0,0 +1,4 @@
implements
interconnect
nettype
soft

57
test/keyword/run.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
VERSIONS=(
1364-1995
1364-2001-noconfig
1364-2001
1364-2005
1800-2005
1800-2009
1800-2012
)
testKeyword() {
sv2v_exit_code=$1
ivl_exit_code=$(($1*2))
version=$2
keyword=$3
source="\`begin_keywords \"$version\"\nmodule $keyword;endmodule\n\`end_keywords"
$SV2V <(echo -e "$source") >/dev/null 2>/dev/null
assertTrue "unexpected sv2v exit code $?" "[ $sv2v_exit_code -eq $? ]"
iverilog -g2012 -o/dev/null <(echo -e "$source") >/dev/null 2>/dev/null
assertTrue "unexpected ivl exit code $?" "[ $ivl_exit_code -eq $? ]"
}
addTest() {
test="$1_$2_$3"
eval "$test() { testKeyword $1 $2 $3; }"
suite_addTest $test
}
addTests() {
prev=
for curr in "${VERSIONS[@]}"; do
# This isn't a keyword in prior version.
[ -n "$prev" -a $curr = $version ] && \
addTest 0 $prev $keyword && \
break
prev=$curr
done
# This is a keyword in the specified version.
addTest 1 $version $keyword
}
suite() {
for version in "${VERSIONS[@]}"; do
while read keyword; do
addTests
done < $version.txt
done
}
source ../lib/functions.sh
. shunit2

View File

@ -1,4 +1,4 @@
`begin_keywords "1364-2001-noconfig"
`begin_keywords "1364-1995"
task foo;
integer automatic = 2;
$display(automatic * automatic);
@ -10,7 +10,14 @@ task automatic bar;
endtask
`end_keywords
`end_keywords
`begin_keywords "1364-2001-noconfig"
task baz;
integer cell = 3;
$display(cell ** cell);
endtask
`end_keywords
module top;
initial foo;
initial bar;
initial baz;
endmodule

View File

@ -13,6 +13,14 @@ module top;
$display(y * y);
end
endtask
task baz;
integer w;
begin
w = 3;
$display(w ** w);
end
endtask
initial foo;
initial bar;
initial baz;
endmodule