aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast/ast.h
diff options
context:
space:
mode:
authorRupert Swarbrick <rswarbrick@gmail.com>2020-04-20 16:06:53 +0100
committerZachary Snow <zachary.j.snow@gmail.com>2021-08-13 17:11:35 -0600
commitee2b5b7ed186414897a8a570a9e503c438803ad8 (patch)
tree649b8773ac8f332439b1071086e55512bf356697 /frontends/ast/ast.h
parentf7913285067ed30bf5087f265db7e0bd523af2b6 (diff)
downloadyosys-ee2b5b7ed186414897a8a570a9e503c438803ad8.tar.gz
yosys-ee2b5b7ed186414897a8a570a9e503c438803ad8.tar.bz2
yosys-ee2b5b7ed186414897a8a570a9e503c438803ad8.zip
Generate an RTLIL representation of bind constructs
This code now takes the AST nodes of type AST_BIND and generates a representation in the RTLIL for them. This is a little tricky, because a binding of the form: bind baz foo_t foo_i (.arg (1 + bar)); means "make an instance of foo_t called foo_i, instantiate it inside baz and connect the port arg to the result of the expression 1+bar". Of course, 1+bar needs a cell for the addition. Where should that cell live? With this patch, the Binding structure that represents the construct is itself an AST::AstModule module. This lets us put the adder cell inside it. We'll pull the contents out and plonk them into 'baz' when we actually do the binding operation as part of the hierarchy pass. Of course, we don't want RTLIL::Binding to contain an AST::AstModule (since kernel code shouldn't depend on a frontend), so we define RTLIL::Binding as an abstract base class and put the AST-specific code into an AST::Binding subclass. This is analogous to the AST::AstModule class.
Diffstat (limited to 'frontends/ast/ast.h')
-rw-r--r--frontends/ast/ast.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/frontends/ast/ast.h b/frontends/ast/ast.h
index ba5a11b96..63104bca4 100644
--- a/frontends/ast/ast.h
+++ b/frontends/ast/ast.h
@@ -284,6 +284,9 @@ namespace AST
void dumpAst(FILE *f, std::string indent) const;
void dumpVlog(FILE *f, std::string indent) const;
+ // Generate RTLIL for a bind construct
+ std::vector<RTLIL::Binding *> genBindings() const;
+
// used by genRTLIL() for detecting expression width and sign
void detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *found_real = NULL);
void detectSignWidth(int &width_hint, bool &sign_hint, bool *found_real = NULL);