Skip to content
Snippets Groups Projects
Commit e083c28e authored by Lukasz Butkowski's avatar Lukasz Butkowski
Browse files

feat(doc): generate registers adoc with desyrdl and add to doc

add: make doc_adoc
run before make doc_pdf or make doc_antora
parent e530becd
Branches
Tags
No related merge requests found
......@@ -291,7 +291,7 @@ desyrdl: config
# ----------------------------------------------------------------------------
# documentation targets
doc: config
$(TCLSH) ./fwk/src/main.tcl init doc -dt "pdf antora" -c ${cfgFile}
$(TCLSH) ./fwk/src/main.tcl init doc -dt "adoc pdf antora" -c ${cfgFile}
doc_antora: config
$(TCLSH) ./fwk/src/main.tcl init doc -dt antora -c ${cfgFile}
......@@ -299,6 +299,9 @@ doc_antora: config
doc_pdf: config
$(TCLSH) ./fwk/src/main.tcl init doc -dt pdf -c ${cfgFile}
doc_adoc: config
$(TCLSH) ./fwk/src/main.tcl init doc -dt adoc -c ${cfgFile}
# asciidoctor-pdf -a ProjectConf=${ProjectConf} \
# -o out/${ProjectName}_${ProjectConf}.pdf \
# doc/main.adoc
......@@ -105,6 +105,9 @@ proc ::fwfwk::addr::genAddrSrc {} {
h {
::fwfwk::addr::runDesyRdl h
}
adoc {
::fwfwk::addr::runDesyRdl adoc
}
default {
puts "Generate only RDL files"
# puts "# WARNING: Not supported option ::fwfwk::addr::main $args"
......@@ -285,6 +288,8 @@ proc ::fwfwk::addr::genAddrDict {} {
dict set AccessChannels $ch 1 Num ""
dict set AccessChannels $ch 1 Parent 0 ; # make it easier to iterate over the dict
dict set AccessChannels $ch 1 Arg ""
dict set AccessChannels $ch 1 Depth ""
dict set AccessChannels $ch 1 Id ""
dict set AccessChannels $ch 1 Variables ""
}
......@@ -421,10 +426,10 @@ proc ::fwfwk::addr::genRdlFromParent {AccessChannel Nodes Idx RdlFile GenHdl} {
set num [dict get $content Num]
set identifier [dict get $content Id]
if { $num == "" } {
puts $RdlFile " [dict get $content Name] $properties $identifier @[dict get $content BaseAddress];"
puts $RdlFile " [dict get $content Name] $properties $identifier @[dict get $content BaseAddress];"
} else {
set stride [expr {[dict get $content AddressRange] + 1}]
puts $RdlFile " [dict get $content Name] $properties $identifier \[$num\] @[dict get $content BaseAddress] += $stride;"
puts $RdlFile " [dict get $content Name] $properties $identifier \[$num\] @[dict get $content BaseAddress] += $stride;"
}
#if { $NodesUnderParent > 1 && $Idx == 1 } {
puts $RdlFile " \} ch${AccessChannel}_${identifier};"
......@@ -543,7 +548,7 @@ proc ::fwfwk::addr::runDesyRdl {outType} {
}
set cmdToRun "desyrdl -o $outPath -i $RdlFilenamesPerCh -f $outType"
# puts [exec bash -c $cmdToRun]
puts [exec bash -c $cmdToRun]
# -----------------------------------------------------------------------------
if { [catch { exec sh -c "$cmdToRun" } resulttext] } {
puts "\n !! DesyRdl failed: \n"
......
......@@ -26,6 +26,9 @@ proc ::fwfwk::doc::main {args} {
set docTypes [lindex $args 0]
# check if project do is properly initialized and create initial files if needed
::fwfwk::doc::initPrjDoc
foreach type $docTypes {
puts "type: $type"
switch $type {
......@@ -36,6 +39,10 @@ proc ::fwfwk::doc::main {args} {
pdf {
::fwfwk::doc::genPdf
}
adoc {
::fwfwk::addr::main {adoc}
::fwfwk::doc::genAdocReg
}
default {
puts "No doc type specyfied"
}
......@@ -43,6 +50,30 @@ proc ::fwfwk::doc::main {args} {
}
}
proc ::fwfwk::doc::initPrjDoc {} {
if {![file exists ${::fwfwk::ProjectPath}/doc/antora.yml]} {
set fileH [open ${::fwfwk::ProjectPath}/doc/antora.yml w]
puts $fileH "name: ${::fwfwk::ProjectName}"
puts $fileH "title: ${::fwfwk::ProjectName}"
puts $fileH "version: ~"
puts $fileH "start_page: index.adoc"
close $fileH
}
if {![file exists ${::fwfwk::ProjectPath}/doc/modules/ROOT/pages]} { file mkdir ${::fwfwk::ProjectPath}/doc/modules/ROOT/pages}
if {![file exists ${::fwfwk::ProjectPath}/doc/modules/ROOT/pages/index.adoc]} {
set fileH [open ${::fwfwk::ProjectPath}/doc/modules/ROOT/pages/index.adoc w]
puts $fileH "= Project ${::fwfwk::ProjectName} documentation"
close $fileH
}
if {![file exists ${::fwfwk::ProjectPath}/doc/main.adoc]} {
set fileH [open ${::fwfwk::ProjectPath}/doc/main.adoc w]
puts $fileH "include::modules/ROOT/pages/index.adoc[]"
close $fileH
}
}
# ------------------------------------------------------------------------------
proc ::fwfwk::doc::genPdf {args} {
......@@ -52,11 +83,16 @@ proc ::fwfwk::doc::genPdf {args} {
set cmdToRun \
[list \
asciidoctor-pdf \
-r asciidoctor-diagram \
-r asciidoctor-mathematical \
-a mathematical-format=svg \
-a pdf-themesdir=${::fwfwk::ProjectPath}/fwk/tpl/doc \
-a pdf-theme=fwk \
-o ${::fwfwk::ProjectPath}/out/${::fwfwk::ProjectName}_${::fwfwk::ProjectConf}.pdf \
$mainAdocFile \
-a toc \
-a stem \
-a toclevels=4 \
-a sectnums \
-a text-align=justify \
-a icons=font \
......@@ -139,6 +175,7 @@ proc ::fwfwk::doc::genAntoraPlaybook {} {
puts $antoraPlaybook " idseparator: '-'"
puts $antoraPlaybook " linkattrs: ''"
puts $antoraPlaybook " toc: ~"
puts $antoraPlaybook " page-toclevels: 3@"
puts $antoraPlaybook " source-highlighter: ~" ;# enabled with supplemental UI, default has no VHDL, Tcl, etc.
puts $antoraPlaybook " kroki-fetch-diagram: true"
puts $antoraPlaybook " steam: '@'"
......@@ -146,6 +183,9 @@ proc ::fwfwk::doc::genAntoraPlaybook {} {
puts $antoraPlaybook " hide-uri-scheme: '@'"
puts $antoraPlaybook " icons: font"
puts $antoraPlaybook " xrefstyle: short"
puts $antoraPlaybook " ProjectName: ${::fwfwk::ProjectName}"
puts $antoraPlaybook " ProjectConf: ${::fwfwk::ProjectConf}"
puts $antoraPlaybook " ProjectVersion: ${::fwfwk::VerString}"
puts $antoraPlaybook " extensions:"
puts $antoraPlaybook " - asciidoctor-kroki"
puts $antoraPlaybook " - '@djencks/asciidoctor-mathjax'"
......@@ -191,3 +231,68 @@ proc ::fwfwk::doc::genAntoraPlaybook {} {
close $antoraPlaybook
}
proc ::fwfwk::doc::genAdocReg {} {
#
set topFile [open $::fwfwk::addr::ArtifactsPath/adoc/addressmap.adoc w]
puts $topFile "= Address Space"
puts $topFile ":toc:"
puts $topFile ":page-toclevels: 4"
puts $topFile "\n\n"
puts $topFile "== Tree"
dict for {accessChannel nodes} $::fwfwk::AddressSpaceChDict {
puts $topFile ".Address Tree $accessChannel "
puts $topFile "\[plantuml, format=svg\]"
puts $topFile "...."
puts $topFile "@startmindmap"
puts $topFile "skinparam monochrome true"
puts $topFile "skinparam ranksep 20"
puts $topFile "skinparam arrowThickness 0.7"
puts $topFile "skinparam packageTitleAlignment left"
puts $topFile "skinparam usecaseBorderThickness 0.4"
puts $topFile "skinparam defaultFontSize 12"
puts $topFile "skinparam rectangleBorderThickness 1"
puts $topFile "* Access channel $accessChannel"
foreach nodeId [dict keys $nodes] {
set instanceName [dict get $nodes $nodeId Id]
set name [dict get $nodes $nodeId Name]
set depth [expr [dict get $nodes $nodeId Depth] + 0 ]
if { $instanceName != "" } {
puts $topFile "[string repeat * $depth] ${instanceName} ($name)"
}
}
puts $topFile "@endmindmap"
puts $topFile "...."
}
dict for {accessChannel nodes} $::fwfwk::AddressSpaceChDict {
# puts $topFile "\nxref:ch_${accessChannel}_address_map.adoc\[Access channel $accessChannel\]\n"
puts $topFile "\ninclude::ch_${accessChannel}_address_map.adoc\[Access channel $accessChannel,leveloffset=1\]\n"
foreach nodeId [dict keys $nodes] {
}
}
close $topFile
dict for {accessChannel nodes} $::fwfwk::AddressSpaceChDict {
set chFile [open $::fwfwk::addr::ArtifactsPath/adoc/ch_${accessChannel}_address_map.adoc w]
puts $chFile "= Access channel $accessChannel\n"
foreach nodeId [dict keys $nodes] {
set instanceName [dict get $nodes $nodeId Id]
set depth [expr [dict get $nodes $nodeId Depth] - 1 ]
# set depth [dict get $nodes $nodeId Depth]
# if virtual top do not palce in doc
if { $instanceName != "" } {
puts $chFile "include::registers_${instanceName}.adoc\[leveloffset=\+$depth]\n"
}
}
close $chFile
}
if {![file exists $::fwfwk::ProjectPath/doc/modules/addressmap_$::fwfwk::ProjectConf/pages ]} {
file mkdir $::fwfwk::ProjectPath/doc/modules/addressmap_$::fwfwk::ProjectConf/pages}
file delete -force $::fwfwk::ProjectPath/doc/modules/addressmap_$::fwfwk::ProjectConf/pages
file copy -force $::fwfwk::addr::ArtifactsPath/adoc/ $::fwfwk::ProjectPath/doc/modules/addressmap_$::fwfwk::ProjectConf/pages
}
Subproject commit 1edb5a96fa718af9f499f72a7f9a3efcc63662e3
Subproject commit f524ade0d584fbf7071c88d0b37507b4c93b950f
  • Lukasz Butkowski @lbutkows

    mentioned in commit 8a793fd2

    By Lukasz Butkowski on 2022-02-16T09:56:04 (imported from GitLab)

    ·

    mentioned in commit 8a793fd2

    By Lukasz Butkowski on 2022-02-16T09:56:04 (imported from GitLab)

    Edited by Ghost User
    Toggle commit list
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment