3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-28 08:19:50 +00:00

documenting.rst: literalinclude cell doc examples

Add a sed command to the (top level) makefile for extract comment block for the specified cell.  Works with both simlib.v and simcells.v (by abusing `%` pattern matching slightly to disambiguate which to search).
This commit is contained in:
Krystine Sherwin 2025-11-18 12:20:33 +13:00
parent f2a80e4d7f
commit 657b0bd92b
No known key found for this signature in database
2 changed files with 45 additions and 34 deletions

View file

@ -1082,7 +1082,7 @@ docs/source/generated/functional/rosette.diff: backends/functional/smtlib.cc bac
$(Q) mkdir -p $(@D)
$(Q) diff -U 20 $^ > $@ || exit 0
PHONY: docs/gen/functional_ir
.PHONY: docs/gen/functional_ir
docs/gen/functional_ir: docs/source/generated/functional/smtlib.cc docs/source/generated/functional/rosette.diff
docs/source/generated/%.log: docs/source/generated $(TARGETS) $(EXTRA_TARGETS)
@ -1091,10 +1091,24 @@ docs/source/generated/%.log: docs/source/generated $(TARGETS) $(EXTRA_TARGETS)
docs/source/generated/chformal.cc: passes/cmds/chformal.cc docs/source/generated
$(Q) cp $< $@
PHONY: docs/gen/chformal
.PHONY: docs/gen/chformal
docs/gen/chformal: docs/source/generated/chformal.log docs/source/generated/chformal.cc
PHONY: docs/gen docs/usage docs/reqs
# e.g. simlib.nex.v -> extract $nex from simlib.v
# sed command adds all non-empty lines to the hold space
# when an empty line is reached, the hold space is moved to the pattern space
# if it includes the desired module, print it
# this gives us the raw comment block immediately before the cell
docs/source/generated/%.v: $(addprefix techlibs/common/,simlib.v simcells.v)
$(Q) mkdir -p $(@D)
$(Q) sed --posix -n -e '/./{H;d} ; x' \
-e "/module .\$$$(lastword $(subst ., ,$*))/p" \
techlibs/common/$(basename $*).v >> $@
.PHONY: docs/gen/raw_cells
docs/gen/raw_cells: $(addprefix docs/source/generated/,simlib.nex.v simcells._NOT_.v)
.PHONY: docs/gen docs/usage docs/reqs
docs/gen: $(TARGETS)
$(Q) $(MAKE) -C docs gen
@ -1129,7 +1143,7 @@ docs/reqs:
$(Q) $(MAKE) -C docs reqs
.PHONY: docs/prep
docs/prep: docs/source/generated/cells.json docs/source/generated/cmds.json docs/gen docs/usage docs/gen/functional_ir docs/gen/chformal
docs/prep: docs/source/generated/cells.json docs/source/generated/cmds.json docs/gen docs/usage docs/gen/functional_ir docs/gen/chformal docs/gen/raw_cells
DOC_TARGET ?= html
docs: docs/prep