Download chips/yosys/tests/unit/techmap/libparseTest.cc from STAR-future/Trinity-SciData: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/datasets/STAR-future/Trinity-SciData/resolve/main/chips/yosys/tests/unit/techmap/libparseTest.cc
- Command line
-
hf download hf://datasets/STAR-future/Trinity-SciData/chips/yosys/tests/unit/techmap/libparseTest.cc
-
curl -L -o libparseTest.cc https://huggingface.co/datasets/STAR-future/Trinity-SciData/resolve/main/chips/yosys/tests/unit/techmap/libparseTest.cc
1.5 kB
| YOSYS_NAMESPACE_BEGIN | |
| namespace RTLIL { | |
| class TechmapLibparseTest : public testing::Test { | |
| protected: | |
| TechmapLibparseTest() { | |
| if (logger().empty()) logger().add_sink<ConsoleLogSink>(); | |
| } | |
| void checkAll(std::initializer_list<std::string> expressions, std::string expected) { | |
| for (const auto& e : expressions) { | |
| auto helper = LibertyExpression::Lexer(e); | |
| auto tree_s = LibertyExpression::parse(helper).sexpr_str(); | |
| EXPECT_EQ(tree_s, expected); | |
| } | |
| } | |
| }; | |
| TEST_F(TechmapLibparseTest, LibertyExpressionSpace) | |
| { | |
| checkAll({ | |
| "x", | |
| "x ", | |
| " x", | |
| " x ", | |
| " x ", | |
| }, "(pin \"x\")"); | |
| checkAll({ | |
| "x y", | |
| " x y ", | |
| "x (y)", | |
| " x (y) ", | |
| "(x) y", | |
| " (x) y ", | |
| "x & y", | |
| "x&y", | |
| "x &y", | |
| "x& y", | |
| " x&y ", | |
| "x & (y)", | |
| "x&(y)", | |
| "x &(y)", | |
| "x& (y)", | |
| " x&(y) ", | |
| "(x) & y", | |
| "(x)&y", | |
| "(x) &y", | |
| "(x)& y", | |
| " (x)&y ", | |
| }, "(and (pin \"x\")\n" | |
| " (pin \"y\"))" | |
| ); | |
| checkAll({ | |
| "x ^ y", | |
| "x^y", | |
| "x ^y", | |
| "x^ y", | |
| " x^y ", | |
| }, "(xor (pin \"x\")\n" | |
| " (pin \"y\"))" | |
| ); | |
| checkAll({ | |
| "x !y", | |
| " x !y ", | |
| "x & !y", | |
| "x&!y", | |
| "x &!y", | |
| "x& !y", | |
| " x&!y ", | |
| "x y'", | |
| " x y' ", | |
| "x & y'", | |
| "x&y'", | |
| "x &y'", | |
| "x& y'", | |
| " x&y' ", | |
| }, "(and (pin \"x\")\n" | |
| " (not (pin \"y\")))" | |
| ); | |
| checkAll({ | |
| "( D & EN )", | |
| }, "(and (pin \"D\")\n" | |
| " (pin \"EN\"))" | |
| ); | |
| } | |
| } | |
| YOSYS_NAMESPACE_END | |