Skip to content

Commit

Permalink
Merge 55fc6a1 into 8578a85
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardt committed Dec 20, 2019
2 parents 8578a85 + 55fc6a1 commit 4a46b2d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/verilogAST.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,19 @@ class BlockComment : public StructuralStatement, public BehavioralStatement {
~BlockComment(){};
};

class InlineVerilog : public StructuralStatement {
// Serializes into `value`, so allows the inclusion of arbitrary verilog
// statement(s) in the body of a module definition. The contents of
// `value` must be a valid verilog statement inside a module body. The
// contents are not validated.
public:
std::string value;

InlineVerilog(std::string value) : value(value){};
std::string toString() { return value; };
~InlineVerilog(){};
};

typedef std::vector<
std::pair<std::unique_ptr<Identifier>, std::unique_ptr<Expression>>>
Parameters;
Expand Down
8 changes: 8 additions & 0 deletions tests/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,14 @@ TEST(BasicTests, Comment) {
EXPECT_EQ(block_comment.toString(),
"/*\nTest comment\non multiple lines\n*/");
}
TEST(BasicTests, InlineVerilog) {
vAST::InlineVerilog inline_verilog(
"logic [1:0] x;\n"
"assign x = 2'b10;\n");
EXPECT_EQ(inline_verilog.toString(),
"logic [1:0] x;\n"
"assign x = 2'b10;\n");
}

} // namespace

Expand Down

0 comments on commit 4a46b2d

Please sign in to comment.