diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-08-15 18:34:36 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2019-08-15 18:35:56 +0200 |
commit | 73bf4539298fdc9f11302582f5e5aff57214cd28 (patch) | |
tree | 8613733959da3f596112684cd8ae4bc9c93217d1 /passes/pmgen/README.md | |
parent | 704686774e28b9b602874264df2c0f96841be05e (diff) | |
download | yosys-73bf4539298fdc9f11302582f5e5aff57214cd28.tar.gz yosys-73bf4539298fdc9f11302582f5e5aff57214cd28.tar.bz2 yosys-73bf4539298fdc9f11302582f5e5aff57214cd28.zip |
Improvements in pmgen for recursive patterns
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'passes/pmgen/README.md')
-rw-r--r-- | passes/pmgen/README.md | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/passes/pmgen/README.md b/passes/pmgen/README.md index 2f0b1fd5a..db722c818 100644 --- a/passes/pmgen/README.md +++ b/passes/pmgen/README.md @@ -232,5 +232,28 @@ But in some cases it is more natural to utilize the implicit branch statement: portAB = \B; endcode -There is an implicit `code..endcode` block at the end of each `.pmg` file +There is an implicit `code..endcode` block at the end of each (sub)pattern that just accepts everything that gets all the way there. + +A `code..finally..endcode` block executes the code after `finally` during +back-tracking. This is useful for maintaining user data state or printing +debug messages. For example: + + udata <vector<Cell*>> stack + + code + stack.push_back(addAB); + finally + stack.pop_back(); + endcode + +Declaring a subpattern +---------------------- + +A subpattern starts with a line containing the `subpattern` keyword followed +by the name of the subpattern. Subpatterns can be called from a `code` block +using a `subpattern(<subpattern_name>);` C statement. + +Arguments may be passed to subpattern via state variables. The `subpattern` +line must be followed by a `arg <arg1> <arg2> ...` line that lists the +state variables used to pass arguments. Subpatterns allow recursion. |