Skip to content

Commit

Permalink
changed Always to inheret from StructuralStatement
Browse files Browse the repository at this point in the history
  • Loading branch information
rdaly525 committed Jun 18, 2019
1 parent d7b2957 commit 2b22aeb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
7 changes: 3 additions & 4 deletions include/verilogAST.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class Star : Node {
std::string toString() { return "*"; };
};

class Always : public Statement {
class Always : public StructuralStatement {
std::vector<std::variant<Identifier *, PosEdge *, NegEdge *, Star *>>
sensitivity_list;
std::vector<std::variant<BehavioralStatement *, Declaration *>> body;
Expand All @@ -316,14 +316,13 @@ class Always : public Statement {
class Module : public Node {
std::string name;
std::vector<Port *> ports;
std::vector<std::variant<Always *, StructuralStatement *, Declaration *>>
body;
std::vector<std::variant<StructuralStatement *, Declaration *>> body;
std::map<std::string, NumericLiteral *> parameters;

public:
Module(
std::string name, std::vector<Port *> ports,
std::vector<std::variant<Always *, StructuralStatement *, Declaration *>>
std::vector<std::variant<StructuralStatement *, Declaration *>>
body,
std::map<std::string, NumericLiteral *> parameters)
: name(name), ports(ports), body(body), parameters(parameters){};
Expand Down
3 changes: 1 addition & 2 deletions src/verilogAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ std::string Module::toString() {
// emit body
for (auto statement : body) {
module_str +=
variant_to_string<Always *, StructuralStatement *, Declaration *>(
statement) +
variant_to_string<StructuralStatement *, Declaration *>(statement) +
";\n";
}

Expand Down
6 changes: 2 additions & 4 deletions tests/basic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ TEST(BasicTests, TestModule) {

std::vector<vAST::Port *> ports = {&i_port, &o_port};

std::vector<std::variant<vAST::Always *, vAST::StructuralStatement *,
vAST::Declaration *>>
std::vector<std::variant<vAST::StructuralStatement *,vAST::Declaration *>>
body;

std::string module_name = "other_module";
Expand Down Expand Up @@ -319,8 +318,7 @@ TEST(BasicTests, File) {

std::vector<vAST::Port *> ports = {&i_port, &o_port};

std::vector<std::variant<vAST::Always *, vAST::StructuralStatement *,
vAST::Declaration *>>
std::vector<std::variant<vAST::StructuralStatement *, vAST::Declaration *>>
body;

std::string module_name = "other_module";
Expand Down

0 comments on commit 2b22aeb

Please sign in to comment.