Skip to content

Commit

Permalink
Rename ArchDef -> ConfiguredArchitecture, ArchDefObj -> DatabaseObjec…
Browse files Browse the repository at this point in the history
…t, add Zce
  • Loading branch information
dhower-qc committed Dec 12, 2024
1 parent 8bb3b95 commit 764f8bb
Show file tree
Hide file tree
Showing 84 changed files with 847 additions and 833 deletions.
26 changes: 12 additions & 14 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ end

directory "#{$root}/.stamps"

def arch_def_for(config_name)
def cfg_arch_for(config_name)
Rake::Task["#{$root}/.stamps/resolve-#{config_name}.stamp"].invoke

@arch_defs ||= {}
return @arch_defs[config_name] if @arch_defs.key?(config_name)
@cfg_archs ||= {}
return @cfg_archs[config_name] if @cfg_archs.key?(config_name)

@arch_defs[config_name] =
ArchDef.new(
@cfg_archs[config_name] =
ConfiguredArchitecture.new(
config_name,
$root / "gen" / "resolved_arch" / config_name,
overlay_path: $root / "cfgs" / config_name / "arch_overlay"
Expand All @@ -37,7 +37,7 @@ namespace :gen do
desc "Generate documentation for the ruby tooling"
task tool_doc: "#{$root}/.stamps/dev_gems" do
Dir.chdir($root) do
sh "bundle exec yard doc --yardopts arch_def.yardopts"
sh "bundle exec yard doc --yardopts cfg_arch.yardopts"
sh "bundle exec yard doc --yardopts idl.yardopts"
end
end
Expand Down Expand Up @@ -103,9 +103,7 @@ end

desc "Clean up all generated files"
task :clean do
FileUtils.rm_rf $root / "gen"
FileUtils.rm_rf $root / ".stamps"
FileUtils.rm_rf $root / ".home"
warn "Don't run clean using Rake. Run `./do clean` (alias for `./bin/clean`) instead."
end

namespace :test do
Expand All @@ -124,16 +122,16 @@ namespace :test do
end
task idl: ["gen:resolved_arch", "#{$root}/.stamps/resolve-rv32.stamp", "#{$root}/.stamps/resolve-rv64.stamp"] do
print "Parsing IDL code for RV32..."
arch_def32 = arch_def_for("rv32")
cfg_arch32 = cfg_arch_for("rv32")
puts "done"

arch_def32.type_check
cfg_arch32.type_check

print "Parsing IDL code for RV64..."
arch_def64 = arch_def_for("rv64")
cfg_arch64 = cfg_arch_for("rv64")
puts "done"

arch_def64.type_check
cfg_arch64.type_check

puts "All IDL passed type checking"
end
Expand All @@ -143,7 +141,7 @@ def insert_warning(str, from)
# insert a warning on the second line
lines = str.lines
first_line = lines.shift
lines.unshift(first_line, "\n# WARNING: This file is auto-generated from #{Pathname.new(from).relative_path_from($root)}\n\n").join("")
lines.unshift(first_line, "\n# WARNING: This file is auto-generated from #{Pathname.new(from).relative_path_from($root)}").join("")
end
private :insert_warning

Expand Down
1 change: 0 additions & 1 deletion arch/csr/H/hcounteren.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# yaml-language-server: $schema=../../../schemas/csr_schema.json

# WARNING: This file is auto-generated from arch/csr/H/hcounteren.layout

$schema: csr_schema.json#
kind: csr
name: hcounteren
Expand Down
2 changes: 0 additions & 2 deletions arch/csr/I/mcounteren.layout
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ description: |
<%%- end -%>
.
<%%- end -%>


definedBy: U # actually, defined by RV64, but must implement U-mode for this CSR to exist
fields:
CY:
Expand Down
2 changes: 0 additions & 2 deletions arch/csr/I/mcounteren.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# yaml-language-server: $schema=../../schemas/csr_schema.json

# WARNING: This file is auto-generated from arch/csr/I/mcounteren.layout

$schema: csr_schema.json#
kind: csr
name: mcounteren
Expand Down Expand Up @@ -82,7 +81,6 @@ description: |
<%- end -%>
.
<%- end -%>
definedBy: U # actually, defined by RV64, but must implement U-mode for this CSR to exist
fields:
CY:
Expand Down
50 changes: 25 additions & 25 deletions arch/csr/I/pmpcfgN.layout
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,39 @@ fields:
base: 64 # upper half doesn't exist in RV32
<%- end -%>
description: |
*PMP configuration for entry <%= pmpcfg_num*4 + i %>*
*PMP configuration for entry <%= pmpcfg_num*4 + i %>*

The bits are as follows:
The bits are as follows:

[separator="!",%autowidth]
!===
! Name ! Location ! Description
[separator="!",%autowidth]
!===
! Name ! Location ! Description

h! L ! <%= ((i+1)*8)-1 %> ! Locks the entry from further modification. Additionally, when set, PMP checks also apply to M-mode for the entry.
h! - ! <%= ((i+1)*8)-2 %>:<%= ((i+1)*8)-3 %> ! _Reserved_ Writes shall be ignored.
h! A ! <%= ((i+1)*8)-4 %>:<%= ((i+1)*8)-5 %>
a! Address matching mode. One of:
h! L ! <%= ((i+1)*8)-1 %> ! Locks the entry from further modification. Additionally, when set, PMP checks also apply to M-mode for the entry.
h! - ! <%= ((i+1)*8)-2 %>:<%= ((i+1)*8)-3 %> ! _Reserved_ Writes shall be ignored.
h! A ! <%= ((i+1)*8)-4 %>:<%= ((i+1)*8)-5 %>
a! Address matching mode. One of:

[when="PMP_GRANULARITY < 2"]
* *OFF* (0) - Null region (disabled)
* *TOR* (1) - Top of range
* *NA4* (2) - Naturally aligned four-byte region
* *NAPOT* (3) - Natrually aligned power of two
[when="PMP_GRANULARITY < 2"]
* *OFF* (0) - Null region (disabled)
* *TOR* (1) - Top of range
* *NA4* (2) - Naturally aligned four-byte region
* *NAPOT* (3) - Natrually aligned power of two

[when="PMP_GRANULARITY >= 2"]
* *OFF* (0) - Null region (disabled)
* *TOR* (1) - Top of range
* *NAPOT* (3) - Natrually aligned power of two
[when="PMP_GRANULARITY >= 2"]
* *OFF* (0) - Null region (disabled)
* *TOR* (1) - Top of range
* *NAPOT* (3) - Natrually aligned power of two

[when="PMP_GRANULARITY >= 2"]
Naturally aligned four-byte region, *NA4* (2), is not valid (not needed when the PMP granularity is larger than 4 bytes).
[when="PMP_GRANULARITY >= 2"]
Naturally aligned four-byte region, *NA4* (2), is not valid (not needed when the PMP granularity is larger than 4 bytes).

h! X ! <%= ((i)*8)+2 %> ! When clear, instruction fetchs cause an `Access Fault` for the matching region and privilege mode.
h! W ! <%= ((i)*8)+1 %> ! When clear, stores and AMOs cause an `Access Fault` for the matching region and privilege mode.
h! R ! <%= ((i)*8)+0 %> ! When clear, loads cause an `Access Fault` for the matching region and privilege mode.
!===
h! X ! <%= ((i)*8)+2 %> ! When clear, instruction fetchs cause an `Access Fault` for the matching region and privilege mode.
h! W ! <%= ((i)*8)+1 %> ! When clear, stores and AMOs cause an `Access Fault` for the matching region and privilege mode.
h! R ! <%= ((i)*8)+0 %> ! When clear, loads cause an `Access Fault` for the matching region and privilege mode.
!===

The combination of R = 0, W = 1 is reserved.
The combination of R = 0, W = 1 is reserved.
type(): |
if (NUM_PMP_ENTRIES > <%= pmpcfg_num*4 + i %>) {
return CsrFieldType::RWR;
Expand Down
1 change: 0 additions & 1 deletion arch/csr/S/scounteren.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# yaml-language-server: $schema=../../schemas/csr_schema.json

# WARNING: This file is auto-generated from arch/csr/S/scounteren.layout

$schema: csr_schema.json#
kind: csr
name: scounteren
Expand Down
4 changes: 2 additions & 2 deletions arch/csr/Zicntr/mcountinhibit.layout
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ description: |

definedBy:
anyOf:
- name: Sm
- name: Smhpm
- name: Sm
- name: Smhpm
fields:
CY:
location: 0
Expand Down
1 change: 0 additions & 1 deletion arch/csr/Zicntr/mcountinhibit.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# yaml-language-server: $schema=../../../schemas/csr_schema.json

# WARNING: This file is auto-generated from arch/csr/Zicntr/mcountinhibit.layout

$schema: csr_schema.json#
kind: csr
name: mcountinhibit
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent10.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent11.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent12.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent13.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent14.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent15.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent16.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent17.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent18.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent19.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent20.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent21.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent22.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent23.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent24.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent25.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent26.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent27.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent28.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent29.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent3.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent30.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent31.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent4.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
4 changes: 1 addition & 3 deletions arch/csr/Zihpm/mhpmevent5.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout

# yaml-language-server: $schema=../../../schemas/csr_schema.json
# WARNING: This file is auto-generated from arch/csr/Zihpm/mhpmeventN.layout# yaml-language-server: $schema=../../../schemas/csr_schema.json

$schema: csr_schema.json#
kind: csr
Expand Down
Loading

0 comments on commit 764f8bb

Please sign in to comment.