From 1f9ed2c5ec28ff3ea5d1d2b3d80a142e2d9bdce0 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 17 Jul 2008 17:23:21 +0100 Subject: [PATCH] VHDL AST element for `wait on' statement --- tgt-vhdl/stmt.cc | 2 +- tgt-vhdl/vhdl_syntax.cc | 10 ++++++++++ tgt-vhdl/vhdl_syntax.hh | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index c6e4deb44..e95ea65ef 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -435,8 +435,8 @@ static int draw_wait(vhdl_procedural *_proc, stmt_container *container, } } - draw_stmt(proc, container, ivl_stmt_sub_stmt(stmt)); container->add_stmt(new vhdl_wait_stmt(VHDL_WAIT_UNTIL, test)); + draw_stmt(proc, container, ivl_stmt_sub_stmt(stmt)); return 0; } diff --git a/tgt-vhdl/vhdl_syntax.cc b/tgt-vhdl/vhdl_syntax.cc index 8047baa9c..e1e1684d9 100644 --- a/tgt-vhdl/vhdl_syntax.cc +++ b/tgt-vhdl/vhdl_syntax.cc @@ -305,6 +305,16 @@ void vhdl_wait_stmt::emit(std::ostream &of, int level) const of << " until "; expr_->emit(of, level); break; + case VHDL_WAIT_ON: + { + string_list_t::const_iterator it = sensitivity_.begin(); + while (it != sensitivity_.end()) { + of << *it; + if (++it != sensitivity_.end()) + of << ", "; + } + } + break; } of << ";"; diff --git a/tgt-vhdl/vhdl_syntax.hh b/tgt-vhdl/vhdl_syntax.hh index 9f9fdcfcb..a920e8bfb 100644 --- a/tgt-vhdl/vhdl_syntax.hh +++ b/tgt-vhdl/vhdl_syntax.hh @@ -307,7 +307,8 @@ public: enum vhdl_wait_type_t { VHDL_WAIT_INDEF, // Suspend indefinitely VHDL_WAIT_FOR, // Wait for a constant amount of time - VHDL_WAIT_UNTIL, // Wait on a sensitivity list + VHDL_WAIT_UNTIL, // Wait on an expression + VHDL_WAIT_ON, // Wait on a sensitivity list }; /* @@ -325,6 +326,7 @@ public: private: vhdl_wait_type_t type_; vhdl_expr *expr_; + string_list_t sensitivity_; };