File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ rule %r{#{$root}/.stamps/resolve-.+\.stamp} => proc { |tname|
5454 arch_files = Dir . glob ( "#{ $root} /arch/**/*.yaml" )
5555 overlay_files = Dir . glob ( "#{ $root} /cfgs/#{ cfg_name } /arch_overlay/**/*.yaml" )
5656 [
57- "gen:arch" ,
5857 "#{ $root} /.stamps" ,
5958 "#{ $root} /lib/yaml_resolver.py"
6059 ] + arch_files + overlay_files
@@ -135,6 +134,35 @@ namespace :test do
135134
136135 puts "done"
137136 end
137+
138+ desc "Check that CSR definitions in the DB are consistent and do not conflict"
139+ task :csrs do
140+ print "Checking for conflicts in CSRs.."
141+
142+ cfg_arch = cfg_arch_for ( "_" )
143+ csrs = cfg_arch . csrs
144+ failed = false
145+ csrs . each_with_index do |csr , idx |
146+ [ 32 , 64 ] . each do |xlen |
147+ next unless csr . defined_in_base? ( xlen )
148+
149+ ( idx ...csrs . size ) . each do |other_idx |
150+ other_csr = csrs [ other_idx ]
151+ next unless other_csr . defined_in_base? ( xlen )
152+ next if other_csr == csr
153+
154+ if csr . address == other_csr . address && !csr . address . nil?
155+ warn "CSRs #{ csr . name } and #{ other_csr . name } have conflicting addresses (#{ csr . address } )"
156+ failed = true
157+ end
158+ end
159+ end
160+ end
161+ raise "CSR test failed" if failed
162+
163+ puts "done"
164+ end
165+
138166 # task :insts do
139167 # puts "Checking instruction encodings..."
140168 # inst_paths = Dir.glob("#{$root}/arch/inst/**/*.yaml").map { |f| Pathname.new(f) }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ $schema: "csr_schema.json#"
44kind : csr
55name : minstreth
66long_name : Machine Instructions Retired Counter
7- address : 0xB02
7+ address : 0xB82
88description : |
99 Upper half of 64-bit instructions retired counters.
1010
You can’t perform that action at this time.
0 commit comments