Skip to content

Commit b1695f8

Browse files
authored
Merge pull request #122 from riscv-software-src/ext_pdf
Make extension doc generation work with extensions that are missing data
2 parents fb1cf3d + 52443b4 commit b1695f8

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

backends/ext_pdf_doc/templates/ext_pdf.adoc.erb

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
raise "TODO: #{ext_version["state"]} description"
3232
end
3333
%>
34-
:company: <%= ext.company["name"] %>
34+
:company: <%= ext.company.nil? ? "unknown" : ext.company["name"] %>
3535
:url-riscv: https://riscv.org
3636
:doctype: book
3737
:preface-title: Licensing and Acknowledgements
@@ -119,20 +119,22 @@ endif::[]
119119

120120
[preface]
121121
== Copyright and license information
122-
This document is released under the <%= ext.doc_license["url"] %>[<%= ext.doc_license["name"] %>].
122+
This document is released under the <%= ext.doc_license.nil? ? "unknown" : ext.doc_license["url"] %>[<%= ext.doc_license.nil? ? "unknown" : ext.doc_license["name"] %>].
123123

124-
Copyright <%= ext_version["ratification_date"].split("-")[0] %> by <%= ext.company["name"] %>.
124+
Copyright <%= ext_version["ratification_date"].split("-")[0] %> by <%= ext.company.nil? ? "unknown" : ext.company["name"] %>.
125125

126126
[preface]
127127
== Acknowledgements
128128

129129
<%- ext.versions.each do |version| -%>
130130
Contributors to version <%= version["version"] %> of the specification (in alphabetical order) include: +
131131

132+
<%- unless version["contributors"].nil? -%>
132133
<%- version["contributors"].sort { |a, b| a["name"].split(" ").last <=> b["name"].split(" ").last }.each do |c| -%>
133134
* <%= c["name"] %> <<%= c["email"] %>> (<%= c["company"] %>)
134135
<%- end -%>
135136
<%- end -%>
137+
<%- end -%>
136138

137139
We express our gratitude to everyone that contributed to, reviewed or
138140
improved this specification through their comments and questions.
@@ -252,7 +254,7 @@ This CSR format changes dynamically.
252254
<%- csr.fields.each do |field| -%>
253255
| xref:<%=csr.name%>-<%=field.name%>-def[`<%= field.name %>`]
254256
| <%= field.location_pretty(arch_def) %>
255-
| <%= field.type_pretty(arch_def) %>
257+
| <%= field.type_pretty(arch_def.symtab) %>
256258
| <%= field.reset_value_pretty(arch_def) %>
257259

258260
<%- end -%>
@@ -278,7 +280,7 @@ Description::
278280
<%= field.description %>
279281

280282
Type::
281-
<%= field.type_pretty(arch_def) %>
283+
<%= field.type_pretty(arch_def.symtab) %>
282284

283285
Reset value::
284286
<%= field.reset_value_pretty(arch_def) %>
@@ -315,7 +317,7 @@ This CSR may return a value that is different from what is stored in hardware.
315317

316318
[source,idl,subs="specialchars,macros"]
317319
----
318-
<%= csr.sw_read_ast(arch_def.idl_compiler).gen_adoc %>
320+
<%= csr.sw_read_ast(arch_def.symtab).gen_adoc %>
319321
----
320322
<%- end -%>
321323

@@ -415,30 +417,26 @@ RV64::
415417
<%- end -%>
416418

417419
Operation::
420+
<%- unless i.data["operation()"].nil? -%>
418421
[source,idl,subs="specialchars,macros"]
419422
----
420-
<%= i.operation_ast(arch_def.idl_compiler).gen_adoc %>
423+
<%= i.operation_ast(arch_def.symtab).gen_adoc %>
421424
----
425+
<%- end -%>
422426

423427
Included in::
424-
[%header,cols="4,2"]
425-
|===
426-
|Extension
427-
|Minimum version
428428

429-
<%- i.defined_by.each do |ext_req| -%>
430-
|<%= ext_req.name %>
431-
|<%= ext_req.version_requirement %>
432-
<%- end -%>
433-
|===
429+
<%= i.defined_by.to_asciidoc %>
430+
431+
434432
<<<
435433
<%- end -%>
436434
<%- end -%>
437435

438436
<<<
439437
== IDL Functions
440438

441-
<%- ext.reachable_functions_unevaluated.sort { |a,b| a.name <=> b.name }.each do |f| -%>
439+
<%- ext.reachable_functions(arch_def.symtab).sort { |a,b| a.name <=> b.name }.each do |f| -%>
442440
[#<%= f.name %>-func-def]
443441
=== <%= f.name %><%- if f.builtin? -%> (builtin)<%- end -%>
444442

lib/arch_obj_models/extension.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,11 @@ def reachable_functions_unevaluated
256256

257257
funcs = []
258258
instructions.each do |inst|
259-
funcs += inst.operation_ast(arch_def.idl_compiler).reachable_functions_unevaluated(arch_def)
259+
funcs += inst.operation_ast(arch_def.symtab).reachable_functions(arch_def.symtab)
260260
end
261261

262262
csrs.each do |csr|
263-
funcs += csr.reachable_functions_unevaluated(arch_def)
263+
funcs += csr.reachable_functions(arch_def)
264264
end
265265

266266
@reachable_functions_unevaluated = funcs.uniq(&:name)

0 commit comments

Comments
 (0)