From e8c5afcb84a2f52c26759952cb9288e42821a49f Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 3 May 2019 08:25:30 +0200 Subject: Fix typo Signed-off-by: Clifford Wolf --- passes/pmgen/peepopt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'passes/pmgen') diff --git a/passes/pmgen/peepopt.cc b/passes/pmgen/peepopt.cc index 78eb68c7a..e7f95cf85 100644 --- a/passes/pmgen/peepopt.cc +++ b/passes/pmgen/peepopt.cc @@ -40,7 +40,7 @@ struct PeepoptPass : public Pass { } void execute(std::vector args, RTLIL::Design *design) YS_OVERRIDE { - log_header(design, "Executing PEEOPOPT pass (run peephole optimizers).\n"); + log_header(design, "Executing PEEPOPT pass (run peephole optimizers).\n"); size_t argidx; for (argidx = 1; argidx < args.size(); argidx++) -- cgit v1.2.3 From 2b29aa5c86021eb79c461975a0281b6d7635bb67 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 3 May 2019 08:35:45 +0200 Subject: Update pmgen documentation Signed-off-by: Clifford Wolf --- passes/pmgen/README.md | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'passes/pmgen') diff --git a/passes/pmgen/README.md b/passes/pmgen/README.md index 320e95a77..2f0b1fd5a 100644 --- a/passes/pmgen/README.md +++ b/passes/pmgen/README.md @@ -29,19 +29,25 @@ up in any future matches: pm.blacklist(some_cell); -The `.run(callback_function)` method searches for all matches and calls the -callback function for each found match: +The `.run_(callback_function)` method searches for all matches +for the pattern`` and calls the callback function for each found +match: - pm.run([&](){ + pm.run_foobar([&](){ log("found matching 'foo' cell: %s\n", log_id(pm.st.foo)); log(" with 'bar' cell: %s\n", log_id(pm.st.bar)); }); The `.pmg` file declares matcher state variables that are accessible via the -`.st.` members. (The `.st` member is of type `foobar_pm::state_t`.) +`.st_.` members. (The `.st_` member is +of type `foobar_pm::state__t`.) Similarly the `.pmg` file declares user data variables that become members of -`.ud`, a struct of type `foobar_pm::udata_t`. +`.ud_`, a struct of type `foobar_pm::udata__t`. + +There are four versions of the `run_()` method: Without callback, +callback without arguments, callback with reference to `pm`, and callback with +reference to `pm.st_`. The .pmg File Format @@ -52,6 +58,12 @@ lines consist of whitespace-separated tokens. Lines in `.pmg` files starting with `//` are comments. +Declaring a pattern +------------------- + +A `.pmg` file contains one or more patterns. Each pattern starts with a line +with the `pattern` keyword followed by the name of the pattern. + Declaring state variables ------------------------- @@ -66,7 +78,7 @@ State variables are automatically managed by the generated backtracking algorith and saved and restored as needed. They are automatically initialized to the default constructed value of their type -when `.run(callback_function)` is called. +when `.run_(callback_function)` is called. Declaring udata variables ------------------------- -- cgit v1.2.3 From b37c31e2cb82343e363d39e4b35ebdb82f4f69a3 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 6 May 2019 15:34:19 +0200 Subject: Bugfix in peepopt_shiftmul.pmg Signed-off-by: Clifford Wolf --- passes/pmgen/peepopt_shiftmul.pmg | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'passes/pmgen') diff --git a/passes/pmgen/peepopt_shiftmul.pmg b/passes/pmgen/peepopt_shiftmul.pmg index 1f9b3c2b9..fe861b728 100644 --- a/passes/pmgen/peepopt_shiftmul.pmg +++ b/passes/pmgen/peepopt_shiftmul.pmg @@ -8,9 +8,13 @@ endmatch code shamt shamt = port(shift, \B); + if (shamt.empty()) + reject; if (shamt[GetSize(shamt)-1] == State::S0) { do { shamt.remove(GetSize(shamt)-1); + if (shamt.empty()) + reject; } while (shamt[GetSize(shamt)-1] == State::S0); } else if (shift->type.in($shift, $shiftx) && param(shift, \B_SIGNED).as_bool()) { -- cgit v1.2.3