From: Luke Kenneth Casson Leighton Date: Mon, 4 Jul 2022 09:54:23 +0000 (+0100) Subject: add pre-parsing inline includer for pdf X-Git-Tag: opf_rfc_ls005_v1~1361 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7e40d01a2c6d47e72f02929833a86540d2cec6b;p=libreriscv.git add pre-parsing inline includer for pdf --- diff --git a/openpower/Makefile b/openpower/Makefile index 29298872f..c7fb3fa39 100755 --- a/openpower/Makefile +++ b/openpower/Makefile @@ -47,9 +47,10 @@ tex: pandoc -f markdown -t latex --top-level-division=section \ --filter pandoc_img.py \ -N -o tex_out/svstep.tex sv/svstep.mdwn + ./mdwn_inline.py sv/remap.mdwn tex_out/remap.mdwn pandoc -f markdown -t latex --top-level-division=section \ --filter pandoc_img.py \ - -N -o tex_out/remap.tex sv/remap.mdwn + -N -o tex_out/remap.tex tex_out/remap.mdwn pandoc -f markdown -t latex --top-level-division=section \ --filter pandoc_img.py \ -N -o tex_out/mv_swizzle.tex sv/mv.swizzle.mdwn @@ -66,9 +67,10 @@ tex: pandoc -f markdown -t latex --top-level-division=section \ --filter pandoc_img.py \ -N -o tex_out/cr_int_predication.tex sv/cr_int_predication.mdwn + ./mdwn_inline.py sv/bitmanip.mdwn tex_out/bitmanip.mdwn pandoc -f markdown -t latex --top-level-division=section \ --filter pandoc_img.py \ - -N -o tex_out/bitmanip.tex sv/bitmanip.mdwn + -N -o tex_out/bitmanip.tex tex_out/bitmanip.mdwn pandoc -f markdown -t latex --top-level-division=section \ --filter pandoc_img.py \ -N -o tex_out/fcvt.tex sv/fcvt.mdwn diff --git a/openpower/mdwn_inline.py b/openpower/mdwn_inline.py new file mode 100755 index 000000000..6d8a7b460 --- /dev/null +++ b/openpower/mdwn_inline.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +import sys + +with open(sys.argv[2], "w") as o: + with open(sys.argv[1], "r") as f: + for line in f.readlines(): + if not line.startswith("[[!inline"): + o.write(line) + continue + print (line.strip()) + # assume first thing is pagename + line = line.split('"') + fname = line[1] + print ("\t", fname) + if fname.endswith(".py"): + if fname.startswith("gf_reference"): + with open("../../nmigen-gf/"+fname) as inc: + o.write(inc.read()) + else: + with open("../%s.mdwn" % fname) as inc: + o.write(inc.read()) diff --git a/openpower/sv/bitmanip.mdwn b/openpower/sv/bitmanip.mdwn index 88ef46df8..8ad8f23a4 100644 --- a/openpower/sv/bitmanip.mdwn +++ b/openpower/sv/bitmanip.mdwn @@ -52,7 +52,7 @@ Useful resource: * * -[[!inline quick="yes" raw="yes" pages="openpower/sv/draft_opcode_tables"]] +[[!inline pages="openpower/sv/draft_opcode_tables" quick="yes" raw="yes" ]] # binary and ternary bitops diff --git a/openpower/sv/remap.mdwn b/openpower/sv/remap.mdwn index d76593a25..5219d9885 100644 --- a/openpower/sv/remap.mdwn +++ b/openpower/sv/remap.mdwn @@ -177,7 +177,7 @@ instruction which matches the above SPR: There are four "shape" SPRs, SHAPE0-3, 32-bits in each, which have the same format. -[[!inline raw="yes" pages="openpower/sv/shape_table_format" ]] +[[!inline pages="openpower/sv/shape_table_format" raw="yes" ]] # svshape instruction @@ -321,13 +321,13 @@ The algorithm below shows how REMAP works more clearly, and may be executed as a python program: ``` -[[!inline quick="yes" raw="yes" pages="openpower/sv/remap.py" ]] +[[!inline pages="openpower/sv/remap.py" quick="yes" raw="yes" ]] ``` An easier-to-read version (using python iterators) shows the loop nesting: ``` -[[!inline quick="yes" raw="yes" pages="openpower/sv/remapyield.py" ]] +[[!inline pages="openpower/sv/remapyield.py" quick="yes" raw="yes" ]] ``` Each element index from the for-loop `0..VL-1`