Skip to content

Commit 0ec5f1b

Browse files
committedJan 31, 2025··
pmgen: Move passes out of pmgen folder
- Techlib pmgens are now in relevant techlibs/*. - `peepopt` pmgens are now in passes/opt. - `test_pmgen` is still in passes/pmgen. - Update `Makefile.inc` and `.gitignore` file(s) to match new `*_pm.h` location, as well as the `#include`s. - Change default `%_pm.h` make target to `techlibs/%_pm.h` and move it to the top level Makefile. - Update pmgen target to use `$(notdir $*)` (where `$*` is the part of the file name that matched the '%' in the target) instead of `$(subst _pm.h,,$(notdir $@))`.
1 parent 18a7c00 commit 0ec5f1b

31 files changed

+71
-77
lines changed
 

‎Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,9 @@ OBJS += libs/fst/fastlz.o
651651
OBJS += libs/fst/lz4.o
652652
endif
653653

654+
techlibs/%_pm.h: passes/pmgen/pmgen.py techlibs/%.pmg
655+
$(P) mkdir -p $(dir $@) && $(PYTHON_EXECUTABLE) $< -o $@ -p $(notdir $*) $(filter-out $<,$^)
656+
654657
ifneq ($(SMALL),1)
655658

656659
OBJS += libs/subcircuit/subcircuit.o

‎passes/opt/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/peepopt*_pm.h

‎passes/opt/Makefile.inc

+14
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,18 @@ OBJS += passes/opt/opt_lut_ins.o
2222
OBJS += passes/opt/opt_ffinv.o
2323
OBJS += passes/opt/pmux2shiftx.o
2424
OBJS += passes/opt/muxpack.o
25+
26+
OBJS += passes/opt/peepopt.o
27+
GENFILES += passes/opt/peepopt_pm.h
28+
passes/opt/peepopt.o: passes/opt/peepopt_pm.h
29+
$(eval $(call add_extra_objs,passes/opt/peepopt_pm.h))
30+
31+
PEEPOPT_PATTERN = passes/opt/peepopt_shiftmul_right.pmg
32+
PEEPOPT_PATTERN += passes/opt/peepopt_shiftmul_left.pmg
33+
PEEPOPT_PATTERN += passes/opt/peepopt_shiftadd.pmg
34+
PEEPOPT_PATTERN += passes/opt/peepopt_muldiv.pmg
35+
PEEPOPT_PATTERN += passes/opt/peepopt_formal_clockgateff.pmg
36+
37+
passes/opt/peepopt_pm.h: passes/pmgen/pmgen.py $(PEEPOPT_PATTERN)
38+
$(P) mkdir -p $(dir $@) && $(PYTHON_EXECUTABLE) $< -o $@ -p peepopt $(filter-out $<,$^)
2539
endif

‎passes/pmgen/peepopt.cc ‎passes/opt/peepopt.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool did_something;
2828
// scratchpad configurations for pmgen
2929
int shiftadd_max_ratio;
3030

31-
#include "passes/pmgen/peepopt_pm.h"
31+
#include "passes/opt/peepopt_pm.h"
3232

3333
struct PeepoptPass : public Pass {
3434
PeepoptPass() : Pass("peepopt", "collection of peephole optimizers") { }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎passes/pmgen/Makefile.inc

+3-63
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,10 @@
1-
%_pm.h: passes/pmgen/pmgen.py %.pmg
2-
$(P) mkdir -p $(dir $@) && $(PYTHON_EXECUTABLE) $< -o $@ -p $(subst _pm.h,,$(notdir $@)) $(filter-out $<,$^)
1+
passes/pmgen/%_pm.h: passes/pmgen/pmgen.py passes/pmgen/%.pmg
2+
$(P) mkdir -p $(dir $@) && $(PYTHON_EXECUTABLE) $< -o $@ -p $(notdir $*) $(filter-out $<,$^)
33

44
# --------------------------------------
55

66
OBJS += passes/pmgen/test_pmgen.o
77
GENFILES += passes/pmgen/test_pmgen_pm.h
8-
passes/pmgen/test_pmgen.o: passes/pmgen/test_pmgen_pm.h passes/pmgen/ice40_dsp_pm.h passes/pmgen/peepopt_pm.h passes/pmgen/xilinx_srl_pm.h
8+
passes/pmgen/test_pmgen.o: passes/pmgen/test_pmgen_pm.h techlibs/ice40/ice40_dsp_pm.h techlibs/xilinx/xilinx_srl_pm.h
99
$(eval $(call add_extra_objs,passes/pmgen/test_pmgen_pm.h))
1010

11-
# --------------------------------------
12-
13-
OBJS += passes/pmgen/ice40_dsp.o
14-
GENFILES += passes/pmgen/ice40_dsp_pm.h
15-
passes/pmgen/ice40_dsp.o: passes/pmgen/ice40_dsp_pm.h
16-
$(eval $(call add_extra_objs,passes/pmgen/ice40_dsp_pm.h))
17-
18-
# --------------------------------------
19-
20-
OBJS += passes/pmgen/ice40_wrapcarry.o
21-
GENFILES += passes/pmgen/ice40_wrapcarry_pm.h
22-
passes/pmgen/ice40_wrapcarry.o: passes/pmgen/ice40_wrapcarry_pm.h
23-
$(eval $(call add_extra_objs,passes/pmgen/ice40_wrapcarry_pm.h))
24-
25-
# --------------------------------------
26-
27-
OBJS += passes/pmgen/xilinx_dsp.o
28-
GENFILES += passes/pmgen/xilinx_dsp_pm.h
29-
GENFILES += passes/pmgen/xilinx_dsp48a_pm.h
30-
GENFILES += passes/pmgen/xilinx_dsp_CREG_pm.h
31-
GENFILES += passes/pmgen/xilinx_dsp_cascade_pm.h
32-
passes/pmgen/xilinx_dsp.o: passes/pmgen/xilinx_dsp_pm.h passes/pmgen/xilinx_dsp48a_pm.h passes/pmgen/xilinx_dsp_CREG_pm.h passes/pmgen/xilinx_dsp_cascade_pm.h
33-
$(eval $(call add_extra_objs,passes/pmgen/xilinx_dsp_pm.h))
34-
$(eval $(call add_extra_objs,passes/pmgen/xilinx_dsp48a_pm.h))
35-
$(eval $(call add_extra_objs,passes/pmgen/xilinx_dsp_CREG_pm.h))
36-
$(eval $(call add_extra_objs,passes/pmgen/xilinx_dsp_cascade_pm.h))
37-
38-
# --------------------------------------
39-
40-
OBJS += passes/pmgen/microchip_dsp.o
41-
GENFILES += passes/pmgen/microchip_dsp_pm.h
42-
GENFILES += passes/pmgen/microchip_dsp_CREG_pm.h
43-
GENFILES += passes/pmgen/microchip_dsp_cascade_pm.h
44-
passes/pmgen/microchip_dsp.o: passes/pmgen/microchip_dsp_pm.h passes/pmgen/microchip_dsp_CREG_pm.h passes/pmgen/microchip_dsp_cascade_pm.h
45-
$(eval $(call add_extra_objs,passes/pmgen/microchip_dsp_pm.h))
46-
$(eval $(call add_extra_objs,passes/pmgen/microchip_dsp_CREG_pm.h))
47-
$(eval $(call add_extra_objs,passes/pmgen/microchip_dsp_cascade_pm.h))
48-
49-
# --------------------------------------
50-
51-
OBJS += passes/pmgen/peepopt.o
52-
GENFILES += passes/pmgen/peepopt_pm.h
53-
passes/pmgen/peepopt.o: passes/pmgen/peepopt_pm.h
54-
$(eval $(call add_extra_objs,passes/pmgen/peepopt_pm.h))
55-
56-
PEEPOPT_PATTERN = passes/pmgen/peepopt_shiftmul_right.pmg
57-
PEEPOPT_PATTERN += passes/pmgen/peepopt_shiftmul_left.pmg
58-
PEEPOPT_PATTERN += passes/pmgen/peepopt_shiftadd.pmg
59-
PEEPOPT_PATTERN += passes/pmgen/peepopt_muldiv.pmg
60-
PEEPOPT_PATTERN += passes/pmgen/peepopt_formal_clockgateff.pmg
61-
62-
passes/pmgen/peepopt_pm.h: passes/pmgen/pmgen.py $(PEEPOPT_PATTERN)
63-
$(P) mkdir -p passes/pmgen && $(PYTHON_EXECUTABLE) $< -o $@ -p peepopt $(filter-out $<,$^)
64-
65-
# --------------------------------------
66-
67-
OBJS += passes/pmgen/xilinx_srl.o
68-
GENFILES += passes/pmgen/xilinx_srl_pm.h
69-
passes/pmgen/xilinx_srl.o: passes/pmgen/xilinx_srl_pm.h
70-
$(eval $(call add_extra_objs,passes/pmgen/xilinx_srl_pm.h))

‎passes/pmgen/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ list of cells from that module:
2222
foobar_pm pm(module, module->selected_cells());
2323

2424
The caller must make sure that none of the cells in the 2nd argument are
25-
deleted for as long as the patter matcher instance is used.
25+
deleted for as long as the pattern matcher instance is used.
2626

2727
At any time it is possible to disable cells, preventing them from showing
2828
up in any future matches:

‎passes/pmgen/test_pmgen.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ USING_YOSYS_NAMESPACE
2424
PRIVATE_NAMESPACE_BEGIN
2525

2626
#include "passes/pmgen/test_pmgen_pm.h"
27-
#include "passes/pmgen/ice40_dsp_pm.h"
28-
#include "passes/pmgen/xilinx_srl_pm.h"
27+
#include "techlibs/ice40/ice40_dsp_pm.h"
28+
#include "techlibs/xilinx/xilinx_srl_pm.h"
2929

3030
#include "generate.h"
3131

‎techlibs/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
blackbox.v
2+
*_pm.h

‎techlibs/ice40/Makefile.inc

+10
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ $(eval $(call add_share_file,share/ice40,techlibs/ice40/spram.txt))
1414
$(eval $(call add_share_file,share/ice40,techlibs/ice40/spram_map.v))
1515
$(eval $(call add_share_file,share/ice40,techlibs/ice40/dsp_map.v))
1616
$(eval $(call add_share_file,share/ice40,techlibs/ice40/abc9_model.v))
17+
18+
OBJS += techlibs/ice40/ice40_dsp.o
19+
GENFILES += techlibs/ice40/ice40_dsp_pm.h
20+
techlibs/ice40/ice40_dsp.o: techlibs/ice40/ice40_dsp_pm.h
21+
$(eval $(call add_extra_objs,techlibs/ice40/ice40_dsp_pm.h))
22+
23+
OBJS += techlibs/ice40/ice40_wrapcarry.o
24+
GENFILES += techlibs/ice40/ice40_wrapcarry_pm.h
25+
techlibs/ice40/ice40_wrapcarry.o: techlibs/ice40/ice40_wrapcarry_pm.h
26+
$(eval $(call add_extra_objs,techlibs/ice40/ice40_wrapcarry_pm.h))

‎passes/pmgen/ice40_dsp.cc ‎techlibs/ice40/ice40_dsp.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
USING_YOSYS_NAMESPACE
2424
PRIVATE_NAMESPACE_BEGIN
2525

26-
#include "passes/pmgen/ice40_dsp_pm.h"
26+
#include "techlibs/ice40/ice40_dsp_pm.h"
2727

2828
void create_ice40_dsp(ice40_dsp_pm &pm)
2929
{
File renamed without changes.

‎passes/pmgen/ice40_wrapcarry.cc ‎techlibs/ice40/ice40_wrapcarry.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
USING_YOSYS_NAMESPACE
2424
PRIVATE_NAMESPACE_BEGIN
2525

26-
#include "passes/pmgen/ice40_wrapcarry_pm.h"
26+
#include "techlibs/ice40/ice40_wrapcarry_pm.h"
2727

2828
void create_ice40_wrapcarry(ice40_wrapcarry_pm &pm)
2929
{
File renamed without changes.

‎techlibs/microchip/Makefile.inc

+9
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,12 @@ $(eval $(call add_share_file,share/microchip,techlibs/microchip/LSRAM_map.v))
2929
$(eval $(call add_share_file,share/microchip,techlibs/microchip/LSRAM.txt))
3030
$(eval $(call add_share_file,share/microchip,techlibs/microchip/uSRAM_map.v))
3131
$(eval $(call add_share_file,share/microchip,techlibs/microchip/uSRAM.txt))
32+
33+
OBJS += techlibs/microchip/microchip_dsp.o
34+
GENFILES += techlibs/microchip/microchip_dsp_pm.h
35+
GENFILES += techlibs/microchip/microchip_dsp_CREG_pm.h
36+
GENFILES += techlibs/microchip/microchip_dsp_cascade_pm.h
37+
techlibs/microchip/microchip_dsp.o: techlibs/microchip/microchip_dsp_pm.h techlibs/microchip/microchip_dsp_CREG_pm.h techlibs/microchip/microchip_dsp_cascade_pm.h
38+
$(eval $(call add_extra_objs,techlibs/microchip/microchip_dsp_pm.h))
39+
$(eval $(call add_extra_objs,techlibs/microchip/microchip_dsp_CREG_pm.h))
40+
$(eval $(call add_extra_objs,techlibs/microchip/microchip_dsp_cascade_pm.h))

‎passes/pmgen/microchip_dsp.cc ‎techlibs/microchip/microchip_dsp.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2323
USING_YOSYS_NAMESPACE
2424
PRIVATE_NAMESPACE_BEGIN
2525

26-
#include "passes/pmgen/microchip_dsp_CREG_pm.h"
27-
#include "passes/pmgen/microchip_dsp_cascade_pm.h"
28-
#include "passes/pmgen/microchip_dsp_pm.h"
26+
#include "techlibs/microchip/microchip_dsp_CREG_pm.h"
27+
#include "techlibs/microchip/microchip_dsp_cascade_pm.h"
28+
#include "techlibs/microchip/microchip_dsp_pm.h"
2929

3030
void microchip_dsp_pack(microchip_dsp_pm &pm)
3131
{
File renamed without changes.
File renamed without changes.

‎techlibs/xilinx/Makefile.inc

+16
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,19 @@ $(eval $(call add_share_file,share/xilinx,techlibs/xilinx/xc7_dsp_map.v))
4646
$(eval $(call add_share_file,share/xilinx,techlibs/xilinx/xcu_dsp_map.v))
4747

4848
$(eval $(call add_share_file,share/xilinx,techlibs/xilinx/abc9_model.v))
49+
50+
OBJS += techlibs/xilinx/xilinx_dsp.o
51+
GENFILES += techlibs/xilinx/xilinx_dsp_pm.h
52+
GENFILES += techlibs/xilinx/xilinx_dsp48a_pm.h
53+
GENFILES += techlibs/xilinx/xilinx_dsp_CREG_pm.h
54+
GENFILES += techlibs/xilinx/xilinx_dsp_cascade_pm.h
55+
techlibs/xilinx/xilinx_dsp.o: techlibs/xilinx/xilinx_dsp_pm.h techlibs/xilinx/xilinx_dsp48a_pm.h techlibs/xilinx/xilinx_dsp_CREG_pm.h techlibs/xilinx/xilinx_dsp_cascade_pm.h
56+
$(eval $(call add_extra_objs,techlibs/xilinx/xilinx_dsp_pm.h))
57+
$(eval $(call add_extra_objs,techlibs/xilinx/xilinx_dsp48a_pm.h))
58+
$(eval $(call add_extra_objs,techlibs/xilinx/xilinx_dsp_CREG_pm.h))
59+
$(eval $(call add_extra_objs,techlibs/xilinx/xilinx_dsp_cascade_pm.h))
60+
61+
OBJS += techlibs/xilinx/xilinx_srl.o
62+
GENFILES += techlibs/xilinx/xilinx_srl_pm.h
63+
techlibs/xilinx/xilinx_srl.o: techlibs/xilinx/xilinx_srl_pm.h
64+
$(eval $(call add_extra_objs,techlibs/xilinx/xilinx_srl_pm.h))

‎passes/pmgen/xilinx_dsp.cc ‎techlibs/xilinx/xilinx_dsp.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
USING_YOSYS_NAMESPACE
2626
PRIVATE_NAMESPACE_BEGIN
2727

28-
#include "passes/pmgen/xilinx_dsp_pm.h"
29-
#include "passes/pmgen/xilinx_dsp48a_pm.h"
30-
#include "passes/pmgen/xilinx_dsp_CREG_pm.h"
31-
#include "passes/pmgen/xilinx_dsp_cascade_pm.h"
28+
#include "techlibs/xilinx/xilinx_dsp_pm.h"
29+
#include "techlibs/xilinx/xilinx_dsp48a_pm.h"
30+
#include "techlibs/xilinx/xilinx_dsp_CREG_pm.h"
31+
#include "techlibs/xilinx/xilinx_dsp_cascade_pm.h"
3232

3333
static Cell* addDsp(Module *module) {
3434
Cell *cell = module->addCell(NEW_ID, ID(DSP48E1));
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎passes/pmgen/xilinx_srl.cc ‎techlibs/xilinx/xilinx_srl.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
USING_YOSYS_NAMESPACE
2525
PRIVATE_NAMESPACE_BEGIN
2626

27-
#include "passes/pmgen/xilinx_srl_pm.h"
27+
#include "techlibs/xilinx/xilinx_srl_pm.h"
2828

2929
void run_fixed(xilinx_srl_pm &pm)
3030
{
File renamed without changes.

0 commit comments

Comments
 (0)
Please sign in to comment.