Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 513b07d

Browse files
committedDec 19, 2023
Call registers.py during build to convert XML to adoc.
Only used for JTAG registers right now since they're missing from adoc altogether. This is mostly a proof of concept of the workflow. There is definitely some formatting issues with the generated adoc, which should be trivial to adjust once I know what correct adoc looks like.
1 parent d052140 commit 513b07d

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed
 

‎build/Makefile

+16-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ riscvintl/riscv-docs-base-container-image:latest
1818

1919
HEADER_SOURCE := riscv-debug-header.adoc
2020
PDF_RESULT := ./build/riscv-debug-specification.pdf
21+
REGISTERS_ADOC = jtag_registers.adoc
22+
REGISTERS_ADOC += core_registers.adoc
23+
REGISTERS_ADOC += hwbp_registers.adoc
24+
REGISTERS_ADOC += dm_registers.adoc
25+
REGISTERS_ADOC += sample_registers.adoc
26+
REGISTERS_ADOC += abstract_commands.adoc
27+
REGISTERS_ADOC += sw_registers.adoc
28+
REGISTERS_PY = ../registers.py
2129

2230
ASCIIDOCTOR_PDF := asciidoctor-pdf
2331
OPTIONS := --trace \
@@ -43,17 +51,22 @@ build:
4351
$(MAKE) build-no-container; \
4452
fi
4553

46-
build-container:
54+
build-container: build-registers
4755
@echo "Starting build inside Docker container..."
4856
$(DOCKER_RUN) /bin/sh -c "$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)"
4957
@echo "Build completed successfully inside Docker container."
5058

51-
build-no-container:
59+
build-no-container: build-registers
5260
@echo "Starting build..."
5361
$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)
5462
@echo "Build completed successfully."
5563

64+
build-registers: $(REGISTERS_ADOC)
65+
66+
%.adoc: ../xml/%.xml $(REGISTERS_PY)
67+
../registers.py --adoc $< > $@
68+
5669
clean:
5770
@echo "Cleaning up generated files..."
5871
rm -f $(PDF_RESULT)
59-
@echo "Cleanup completed."
72+
@echo "Cleanup completed."

‎jtagdtm.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ are BYPASS and IDCODE, but this specification leaves IR space for many
3232
other standard JTAG instructions. Unimplemented instructions must select
3333
the BYPASS register.
3434

35+
include::build/jtag_registers.adoc[]
36+
3537
=== JTAG Connector
3638

3739
==== Recommended JTAG Connector

‎registers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -809,15 +809,15 @@ def print_adoc( registers ):
809809
if r.short:
810810
# TODO: Check that (((foo))) renders as ((foo)) inside parens
811811
if r.address:
812-
print(f"={sub} {r.name} ((({r.short})), at {r.address})")
812+
print(f"==={sub} {r.name} ((({r.short})), at {r.address})")
813813
else:
814-
print(f"={sub} {r.name} ((({r.short})))")
814+
print(f"==={sub} {r.name} ((({r.short})))")
815815
# TODO: confirm that index works
816816
else:
817817
if r.address:
818-
print("={sub} ((`{r.name}`)) (at {r.address})")
818+
print(f"==={sub} ((`{r.name}`)) (at {r.address})")
819819
else:
820-
print("={sub} ((`{r.name}`))")
820+
print(f"==={sub} ((`{r.name}`))")
821821
print()
822822
if r.label and r.define:
823823
print("[[%s]]" % toLatexIdentifier(registers.prefix, r.label))

0 commit comments

Comments
 (0)
Please sign in to comment.