From 23922faecc3d061e9cb66e7cf58d75e427600c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Povi=C5=A1er?= Date: Mon, 4 Nov 2024 16:18:50 +0100 Subject: [PATCH] Test new Tcl methods --- tests/various/tcl_apis.tcl | 16 ++++++++++++++++ tests/various/tcl_apis.v | 11 +++++++++++ tests/various/tcl_apis.ys | 1 + 3 files changed, 28 insertions(+) create mode 100644 tests/various/tcl_apis.tcl create mode 100644 tests/various/tcl_apis.v create mode 100644 tests/various/tcl_apis.ys diff --git a/tests/various/tcl_apis.tcl b/tests/various/tcl_apis.tcl new file mode 100644 index 000000000..74f1aaa52 --- /dev/null +++ b/tests/various/tcl_apis.tcl @@ -0,0 +1,16 @@ +yosys read_verilog tcl_apis.v + +if {[rtlil::get_attr -string -mod top foo] != "bar"} { + error "bad top module attribute" +} + +if {[rtlil::get_attr -bool top w dont_touch] != 1} { + error "bad w wire attribute" +} + +if {[rtlil::get_param -int top inst PARAM] != 4} { + error "bad parameter" +} + +rtlil::set_attr -true -mod top marked +yosys select -assert-any A:marked diff --git a/tests/various/tcl_apis.v b/tests/various/tcl_apis.v new file mode 100644 index 000000000..cc379c20a --- /dev/null +++ b/tests/various/tcl_apis.v @@ -0,0 +1,11 @@ +module m; +parameter PARAM = 0; +endmodule + +(* foo="bar" *) +module top; + (* dont_touch *) + wire w; + + m #(.PARAM(4)) inst(); +endmodule diff --git a/tests/various/tcl_apis.ys b/tests/various/tcl_apis.ys new file mode 100644 index 000000000..141f08a3b --- /dev/null +++ b/tests/various/tcl_apis.ys @@ -0,0 +1 @@ +yosys tcl tcl_apis.tcl