Skip to content

Commit b1652be

Browse files
Fix updated path to common templates
1 parent c3ffda1 commit b1652be

File tree

5 files changed

+307
-771
lines changed

5 files changed

+307
-771
lines changed

Rakefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ directory "#{$root}/.stamps"
1717

1818
# Load and execute Rakefile for each backend.
1919
Dir.glob("#{$root}/backends/*/tasks.rake") do |rakefile|
20-
puts "UPDATE: Loading #{rakefile}"
2120
load rakefile
2221
end
2322

@@ -295,6 +294,7 @@ namespace :test do
295294
These are basic but fast-running tests to check the database and tools
296295
DESC
297296
task :smoke do
297+
puts "UPDATE: Starting test:smoke"
298298
puts "UPDATE: Running test:idl_compiler"
299299
Rake::Task["test:idl_compiler"].invoke
300300
puts "UPDATE: Running test:lib"
@@ -303,6 +303,7 @@ namespace :test do
303303
Rake::Task["test:schema"].invoke
304304
puts "UPDATE: Running test:idl"
305305
Rake::Task["test:idl"].invoke
306+
puts "UPDATE: Done test:smoke"
306307
end
307308

308309
desc <<~DESC
@@ -311,22 +312,29 @@ namespace :test do
311312
These tests must pass before a commit will be allowed in the main branch on GitHub
312313
DESC
313314
task :regress do
315+
puts "UPDATE: Starting test:regress"
314316
Rake::Task["test:smoke"].invoke
315317

318+
puts "UPDATE: Running gen:html_manual MANUAL_NAME=isa VERSIONS=all"
316319
ENV["MANUAL_NAME"] = "isa"
317320
ENV["VERSIONS"] = "all"
318321
Rake::Task["gen:html_manual"].invoke
319322

323+
puts "UPDATE: Running gen:ext_pdf"
320324
ENV["EXT"] = "B"
321325
ENV["VERSION"] = "latest"
322326
Rake::Task["gen:ext_pdf"].invoke
323327

328+
puts "UPDATE: Running gen:html for generic_rv64"
324329
Rake::Task["gen:html"].invoke("generic_rv64")
325330

331+
puts "UPDATE: Generating MockProcCertModel.pdf"
326332
Rake::Task["#{$root}/gen/crd/pdf/MockProcCertModel.pdf"].invoke
333+
334+
puts "UPDATE: Generating MockProfileRelease.pdf"
327335
Rake::Task["#{$root}/gen/profile/pdf/MockProfileRelease.pdf"].invoke
328336

329-
puts
337+
puts "UPDATE: Done test:regress"
330338
puts "Regression test PASSED"
331339
end
332340

backends/manual/tasks.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,15 +206,15 @@ end
206206
rule %r{#{MANUAL_GEN_DIR}/.*/.*/antora/modules/csrs/pages/.*\.adoc} => [
207207
__FILE__,
208208
"gen:arch",
209-
($root / "backends" / "common_templates" / "adoc" / "csr.adoc.erb").to_s
209+
($root / "backends" / "templates" / "csr.adoc.erb").to_s
210210
] do |t|
211211
csr_name = File.basename(t.name, ".adoc")
212212

213213
design = cfg_arch_for("_")
214214
csr = design.arch.csr(csr_name)
215215
raise "Can't find csr '#{csr_name}'" if csr.nil?
216216

217-
csr_template_path = $root / "backends" / "common_templates" / "adoc" / "csr.adoc.erb"
217+
csr_template_path = $root / "backends" / "templates" / "csr.adoc.erb"
218218
erb = ERB.new(csr_template_path.read, trim_mode: "-")
219219
erb.filename = csr_template_path.to_s
220220

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<<<
2+
[appendix]
3+
== CSR Details
4+
5+
<% design.in_scope_csrs.sort_by(&:name).each do |csr| -%>
6+
<<<
7+
[[csr-<%= csr.name %>-def]]
8+
=== <%= csr.name %>
9+
10+
*<%= csr.long_name %>*
11+
12+
<% unless csr.base.nil? -%>
13+
[NOTE]
14+
--
15+
`<%= csr.name %>` is only defined in RV<%= csr.base %>.
16+
--
17+
<% end -%>
18+
19+
<%= csr.description %>
20+
21+
==== Attributes
22+
[%autowidth]
23+
|===
24+
h| CSR Address | <%= "0x#{csr.address.to_s(16)}" %>
25+
<% if csr.priv_mode == 'VS' -%>
26+
h| Virtual CSR Address | <%= "0x#{csr.virtual_address.to_s(16)}" %>
27+
<% end -%>
28+
h| Defining extension a| <%= csr.defined_by_condition.to_asciidoc %>
29+
<% if csr.dynamic_length?(design) -%>
30+
h| Length | <%= csr.length_pretty(design) %>
31+
<% else -%>
32+
h| Length | <%= csr.length_pretty(design) %>
33+
<% end -%>
34+
h| Privilege Mode | <%= csr.priv_mode %>
35+
|===
36+
37+
38+
==== Format
39+
<% unless csr.dynamic_length?(design) || csr.implemented_fields(design).any? { |f| f.dynamic_location?(design) } -%>
40+
<%# CSR has a known static length, so there is only one format to display -%>
41+
.<%= csr.name %> format
42+
[wavedrom, ,svg,subs='attributes',width="100%"]
43+
....
44+
<%= JSON.dump csr.wavedrom_desc(design, csr.base.nil? ? 32 : csr.base, optional_type: 2) %>
45+
....
46+
<% else -%>
47+
<%# CSR has a dynamic length, or a field has a dynamic location,
48+
so there is more than one format to display -%>
49+
This CSR format changes dynamically with XLEN.
50+
51+
.<%= csr.name %> Format when <%= csr.length_cond32 %>
52+
[wavedrom, ,svg,subs='attributes',width="100%"]
53+
....
54+
<%= JSON.dump csr.wavedrom_desc(design, 32, optional_type: 2) %>
55+
....
56+
57+
.<%= csr.name %> Format when <%= csr.length_cond64 %>
58+
[wavedrom, ,svg,subs='attributes',width="100%"]
59+
....
60+
<%= JSON.dump csr.wavedrom_desc(design, 64, optional_type: 2) %>
61+
....
62+
63+
64+
<% end # unless dynamic length -%>
65+
66+
==== Field Summary
67+
68+
// use @ as a separator since IDL code can contain |
69+
[%autowidth,separator=@,float="center",align="center",cols="^,<,<,<",options="header",role="stretch"]
70+
|===
71+
@ Name @ Location @ Type @ Reset Value
72+
73+
<%- csr.implemented_fields(design).each do |field| -%>
74+
@ xref:<%=csr.name%>-<%=field.name%>-def[`<%= field.name %>`]
75+
a@
76+
<%- if field.dynamic_location?(design) -%>
77+
78+
[when,"<%= field.location_cond32 %>"]
79+
--
80+
<%= field.location_pretty(design, 32) %>
81+
--
82+
83+
[when,"<%= field.location_cond64 %>"]
84+
--
85+
<%= field.location_pretty(design, 64) %>
86+
--
87+
88+
<%- else -%>
89+
<%= field.location_pretty(design) %>
90+
<%- end -%>
91+
a@
92+
93+
--
94+
<%= field.type_pretty(design.symtab) %>
95+
--
96+
97+
a@
98+
99+
--
100+
<%= field.reset_value_pretty(design) %>
101+
--
102+
103+
<%- end -%>
104+
|===
105+
106+
==== Fields
107+
108+
<%- if csr.implemented_fields(design).empty? -%>
109+
This CSR has no fields. However, it must still exist (not cause an `Illegal Instruction` trap) and always return zero on a read.
110+
<%- else -%>
111+
112+
<%- csr.implemented_fields(design).each do |field| -%>
113+
[[<%=csr.name%>-<%=field.name%>-def]]
114+
===== `<%= field.name %>`
115+
116+
<%- if !field.defined_in_all_bases? -%>
117+
IMPORTANT: <%= field.name %> is only defined in <%= field.base32_only? ? "RV32" : "RV64" %> (`<%= field.base32_only? ? field.location_cond32 : field.location_cond64 %>`)
118+
<%- end -%>
119+
120+
****
121+
Location::
122+
<%= field.location_pretty(design) %>
123+
124+
Description::
125+
<%= field.description.gsub("\n", " +\n") %>
126+
127+
Type::
128+
<%= field.type_pretty(design.symtab) %>
129+
130+
Reset value::
131+
<%= field.reset_value_pretty(design) %>
132+
133+
****
134+
135+
<%- end -%>
136+
<%- end -%>
137+
138+
<%- if csr.implemented_fields(design).map(&:has_custom_sw_write?).any? -%>
139+
==== Software write
140+
141+
This CSR may store a value that is different from what software attempts to write.
142+
143+
When a software write occurs (_e.g._, through `csrrw`), the following determines the
144+
written value:
145+
146+
[idl]
147+
----
148+
<%- csr.implemented_fields(design).each do |field| -%>
149+
<%- if field.has_custom_sw_write? -%>
150+
<%= field.name %> = <%= field["sw_write(csr_value)"] %>
151+
<%- else -%>
152+
<%= field.name %> = csr_value.<%= field.name %>
153+
<%- end -%>
154+
<%- end -%>
155+
----
156+
<%- end -%>
157+
158+
<%- if csr.has_custom_sw_read? -%>
159+
==== Software read
160+
161+
This CSR may return a value that is different from what is stored in hardware.
162+
163+
[source,idl,subs="specialchars,macros"]
164+
----
165+
<%= csr.sw_read_ast(design.symtab).gen_adoc %>
166+
----
167+
<%- end -%>
168+
169+
<% end # do in_scope_csrs -%>

0 commit comments

Comments
 (0)