aboutsummaryrefslogtreecommitdiffstats
path: root/tests/verilog
diff options
context:
space:
mode:
authorThomas Sailer <sailer@tsailer.ch>2021-08-25 21:34:26 +0200
committerZachary Snow <zachary.j.snow@gmail.com>2021-12-15 18:06:02 -0700
commit4cd2f03e36d09f936d39f8499e26fb0a2bc897f9 (patch)
tree9a18d32ec0ab99f5e197fd3fc00b152b7867b66c /tests/verilog
parent477eeefd9b6c1c98ee5d41cdf407011cf40794a7 (diff)
downloadyosys-4cd2f03e36d09f936d39f8499e26fb0a2bc897f9.tar.gz
yosys-4cd2f03e36d09f936d39f8499e26fb0a2bc897f9.tar.bz2
yosys-4cd2f03e36d09f936d39f8499e26fb0a2bc897f9.zip
preprocessor: do not destroy double slash escaped identifiers
The preprocessor currently destroys double slash containing escaped identifiers (for example \a//b ). This is due to next_token trying to convert single line comments (//) into /* */ comments. This then leads to an unintuitive error message like this: ERROR: syntax error, unexpected '*' This patch fixes the error by recognizing escaped identifiers and returning them as single token. It also adds a testcase.
Diffstat (limited to 'tests/verilog')
-rw-r--r--tests/verilog/doubleslash.ys19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/verilog/doubleslash.ys b/tests/verilog/doubleslash.ys
new file mode 100644
index 000000000..8a51f12c2
--- /dev/null
+++ b/tests/verilog/doubleslash.ys
@@ -0,0 +1,19 @@
+read_verilog -sv <<EOT
+module doubleslash
+ (input logic a,
+ input logic b,
+ output logic z);
+
+ logic \a//b ;
+
+ assign \a//b = a & b;
+ assign z = ~\a//b ;
+
+endmodule : doubleslash
+EOT
+
+hierarchy
+proc
+opt -full
+
+write_verilog doubleslash.v