Skip to content

Commit e8ad820

Browse files
author
Mariusz Glebocki
committed
Add test for translate_off...translate_on sections.
1 parent a34fb48 commit e8ad820

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

systemverilog-plugin/tests/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ TESTS = counter \
2121
report-flag \
2222
defines \
2323
defaults \
24-
formal
24+
formal \
25+
translate_off
2526

2627
include $(shell pwd)/../../Makefile_test.common
2728

@@ -33,3 +34,4 @@ report-flag_verify = true
3334
defaults_verify = true
3435
defines_verify = true
3536
formal_verify = true
37+
translate_off_verify = true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
yosys -import
2+
if { [info procs read_uhdm] == {} } { plugin -i systemverilog }
3+
yosys -import ;# ingest plugin commands
4+
5+
set TMP_DIR /tmp
6+
if { [info exists ::env(TMPDIR) ] } {
7+
set TMP_DIR $::env(TMPDIR)
8+
}
9+
10+
read_systemverilog -o $TMP_DIR/translate_off-test $::env(DESIGN_TOP).v
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2020-2023 F4PGA Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
// SPDX-License-Identifier: Apache-2.0
16+
17+
module top(input i, output o);
18+
// synopsys translate_off
19+
initial $stop("Code between translate_off...translate_on should be ignored.");
20+
// synopsys translate_on
21+
assign o = i;
22+
endmodule

0 commit comments

Comments
 (0)