Skip to content

Commit ad8139b

Browse files
committed
refactor: move mock data into arch_overlay
1 parent de3ea3e commit ad8139b

File tree

16 files changed

+262
-204
lines changed

16 files changed

+262
-204
lines changed

.github/workflows/regress.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,28 @@ jobs:
9393
runs-on: ubuntu-latest
9494
env:
9595
SINGULARITY: 1
96+
MODEL: MockProcessor
97+
CONFIG: mocks
9698
steps:
9799
- name: Clone Github Repo Action
98100
uses: actions/checkout@v4
99101
- name: singularity setup
100102
uses: ./.github/actions/singularity-setup
101103
- name: Generate extension PDF
102-
run: ./do gen:proc_crd_pdf[MockProcessor]
104+
run: ./do gen:proc_crd_pdf
103105
regress-gen-profile:
104106
runs-on: ubuntu-latest
105107
env:
106108
SINGULARITY: 1
109+
RELEASE: Mock
110+
CONFIG: mocks
107111
steps:
108112
- name: Clone Github Repo Action
109113
uses: actions/checkout@v4
110114
- name: singularity setup
111115
uses: ./.github/actions/singularity-setup
112116
- name: Generate extension PDF
113-
run: ./do gen:profile_release_pdf[Mock]
117+
run: ./do gen:profile_release_pdf
114118
build-llvm:
115119
runs-on: ubuntu-latest
116120
steps:

Rakefile

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,14 @@ namespace :gen do
121121
end
122122
end
123123

124-
desc "Resolve the standard in arch/, and write it to gen/resolved_arch/_"
125-
task "resolved_arch" => "#{$root}/.stamps/resolve-_.stamp"
124+
desc <<~DESC
125+
Resolve the architecture files, and write it to gen/resolved_arch/<CONFIG_NAME>
126+
127+
By default, resolves the standard architecture ("_") under arch.
128+
129+
To resolve an overlay, set the CONFIG enviornment variable to a config name that uses the overlay
130+
DESC
131+
task "resolved_arch" => "#{$root}/.stamps/resolve-#{ENV.key?('CONFIG') ? ENV['CONFIG'] : '_'}.stamp"
126132
end
127133

128134
# rule to generate standard for any configurations with an overlay
@@ -496,12 +502,18 @@ namespace :test do
496502
Rake::Task["gen:html"].invoke("example_rv64_with_overlay")
497503

498504
$logger.info "Generating MockProcessor-CRD.pdf"
505+
ENV["CONFIG"] = "mocks"
506+
ENV["MODEL"] = "MockProcessor"
499507
Rake::Task["#{$root}/gen/proc_crd/pdf/MockProcessor-CRD.pdf"].invoke
500508

501509
$logger.info "Generating MockProcessor-CTP.pdf"
510+
ENV["CONFIG"] = "mocks"
511+
ENV["MODEL"] = "MockProcessor"
502512
Rake::Task["#{$root}/gen/proc_ctp/pdf/MockProcessor-CTP.pdf"].invoke
503513

504514
$logger.info "Generating MockProfileRelease.pdf"
515+
ENV["CONFIG"] = "mocks"
516+
ENV["RELEASE"] = "Mock"
505517
Rake::Task["#{$root}/gen/profile/pdf/MockProfileRelease.pdf"].invoke
506518

507519
$logger.info "Generating Go Language Support"
@@ -528,38 +540,55 @@ desc <<~DESC
528540
DESC
529541
task :portfolios do
530542
portfolio_start_msg("MockProcessor-CRD")
543+
ENV["CONFIG"] = "mocks"
531544
Rake::Task["#{$root}/gen/proc_crd/pdf/MockProcessor-CRD.pdf"].invoke
532545
portfolio_start_msg("MockProcessor-CTP")
546+
ENV["CONFIG"] = "mocks"
533547
Rake::Task["#{$root}/gen/proc_ctp/pdf/MockProcessor-CTP.pdf"].invoke
534548
portfolio_start_msg("MockProfileRelease")
549+
ENV["CONFIG"] = "mocks"
535550
Rake::Task["#{$root}/gen/profile/pdf/MockProfileRelease.pdf"].invoke
536551
portfolio_start_msg("MC100-32-CTP")
552+
ENV["CONFIG"] = "_"
537553
Rake::Task["#{$root}/gen/proc_ctp/pdf/MC100-32-CTP.pdf"].invoke
538554
portfolio_start_msg("MC100-32-CRD")
555+
ENV["CONFIG"] = "_"
539556
Rake::Task["#{$root}/gen/proc_crd/pdf/MC100-32-CRD.pdf"].invoke
540557
portfolio_start_msg("MC100-64-CRD")
558+
ENV["CONFIG"] = "_"
541559
Rake::Task["#{$root}/gen/proc_crd/pdf/MC100-64-CRD.pdf"].invoke
542560
portfolio_start_msg("MC200-32-CRD")
561+
ENV["CONFIG"] = "_"
543562
Rake::Task["#{$root}/gen/proc_crd/pdf/MC200-32-CRD.pdf"].invoke
544563
portfolio_start_msg("MC200-64-CRD")
564+
ENV["CONFIG"] = "_"
545565
Rake::Task["#{$root}/gen/proc_crd/pdf/MC200-64-CRD.pdf"].invoke
546566
portfolio_start_msg("MC300-32-CRD")
567+
ENV["CONFIG"] = "_"
547568
Rake::Task["#{$root}/gen/proc_crd/pdf/MC300-32-CRD.pdf"].invoke
548569
portfolio_start_msg("MC300-64-CRD")
570+
ENV["CONFIG"] = "_"
549571
Rake::Task["#{$root}/gen/proc_crd/pdf/MC300-64-CRD.pdf"].invoke
550572
portfolio_start_msg("AC100-CRD")
573+
ENV["CONFIG"] = "_"
551574
Rake::Task["#{$root}/gen/proc_crd/pdf/AC100-CRD.pdf"].invoke
552575
portfolio_start_msg("AC200-CRD")
576+
ENV["CONFIG"] = "_"
553577
Rake::Task["#{$root}/gen/proc_crd/pdf/AC200-CRD.pdf"].invoke
554578
portfolio_start_msg("RVI20ProfileRelease")
579+
ENV["CONFIG"] = "_"
555580
Rake::Task["#{$root}/gen/profile/pdf/RVI20ProfileRelease.pdf"].invoke
556581
portfolio_start_msg("RVA20ProfileRelease")
582+
ENV["CONFIG"] = "_"
557583
Rake::Task["#{$root}/gen/profile/pdf/RVA20ProfileRelease.pdf"].invoke
558584
portfolio_start_msg("RVA22ProfileRelease")
585+
ENV["CONFIG"] = "_"
559586
Rake::Task["#{$root}/gen/profile/pdf/RVA22ProfileRelease.pdf"].invoke
560587
portfolio_start_msg("RVA23ProfileRelease")
588+
ENV["CONFIG"] = "_"
561589
Rake::Task["#{$root}/gen/profile/pdf/RVA23ProfileRelease.pdf"].invoke
562590
portfolio_start_msg("RVB23ProfileRelease")
591+
ENV["CONFIG"] = "_"
563592
Rake::Task["#{$root}/gen/profile/pdf/RVB23ProfileRelease.pdf"].invoke
564593
end
565594

arch/ext/Xmock.yaml renamed to arch_overlay/mocks/ext/Xmock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# yaml-language-server: $schema=../../schemas/ext_schema.json
1+
# yaml-language-server: $schema=../../../schemas/ext_schema.json
22

33
$schema: "ext_schema.json#"
44
kind: extension
File renamed without changes.

backends/portfolio/tasks.rake

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,11 @@
55
require "pathname"
66
require_relative "#{$lib}/idl/passes/gen_adoc"
77

8-
# @return [Architecture]
9-
def pf_create_arch
10-
# Ensure that unconfigured resolved architecture called "_" exists.
11-
Rake::Task["#{$root}/.stamps/resolve-_.stamp"].invoke
12-
13-
# Create architecture object using the unconfigured resolved architecture called "_".
14-
Architecture.new($root / "gen" / "resolved_arch" / "_")
15-
end
16-
178
# @param portfolio_grp_with_arch [PortfolioGroup] Contains one or more Portfolio objects that have an arch (not a cfg_arch).
189
# @return [ConfiguredArchitecture]
19-
def pf_create_cfg_arch(portfolio_grp_with_arch)
10+
def pf_create_cfg_arch(portfolio_grp_with_arch, config_name)
2011
raise ArgumentError, "portfolio_grp_with_arch is a #{portfolio_grp_with_arch.class} but must be a PortfolioGroup" unless portfolio_grp_with_arch.is_a?(PortfolioGroup)
2112

22-
# Ensure that unconfigured resolved architecture called "_" exists.
23-
Rake::Task["#{$root}/.stamps/resolve-_.stamp"].invoke
24-
2513
# Create a ConfiguredArchitecture object and provide it a PortfolioGroupConfig object to implement the AbstractConfig API.
2614
# The DatabaseObjects in PortfolioGroup only have an Architecture object and not a ConfiguredArchitecture object
2715
# otherwise there would be a circular dependency. To avoid this circular dependency, none of the routines
@@ -30,7 +18,7 @@ def pf_create_cfg_arch(portfolio_grp_with_arch)
3018
ConfiguredArchitecture.new(
3119
portfolio_grp_with_arch.name,
3220
PortfolioGroupConfig.new(portfolio_grp_with_arch),
33-
$root / "gen" / "resolved_arch" / "_"
21+
$root / "gen" / "resolved_arch" / config_name
3422
)
3523
end
3624

backends/proc_cert/tasks.rake

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ require "pathname"
77
# @param erb_template_pname [String] Path to ERB template file
88
# @param target_pname [String] Full name of adoc file being generated
99
# @param model_name [String] Name of the processor certificate model
10-
def proc_cert_create_adoc(erb_template_pname, target_pname, model_name)
10+
def proc_cert_create_adoc(erb_template_pname, target_pname, model_name, config_locator)
1111
# Create Architecture object without any knowledge of certificate model.
12-
$logger.info "Creating Architecture object for #{model_name}"
13-
arch = pf_create_arch
12+
$logger.info "Creating Architecture object for #{model_name}, config #{config_locator}"
13+
bootstrap_cfg_arch = cfg_arch_for(config_locator)
1414

1515
# Create ProcCertModel for specific processor certificate model as specified in its arch YAML file.
1616
# The Architecture object also creates all other portfolio-related class instances from their arch YAML files.
1717
# None of these objects are provided with a AbstractConfig or Design object when created.
1818
$logger.info "Creating ProcCertModel with only an Architecture object for #{model_name}"
19-
proc_cert_model_with_arch = arch.proc_cert_model(model_name)
19+
proc_cert_model_with_arch = bootstrap_cfg_arch.proc_cert_model(model_name)
20+
21+
raise "?" if proc_cert_model_with_arch.nil?
2022

2123
# Create the ConfiguredArchitecture object with knowledge of the ProcCertModel.
2224
# Needs a PortfolioGroup object so just create one with just one ProcCertModel (which is a child of Portfolio).
23-
cfg_arch = pf_create_cfg_arch(PortfolioGroup.new(model_name, [proc_cert_model_with_arch]))
25+
cfg_arch = pf_create_cfg_arch(PortfolioGroup.new(model_name, [proc_cert_model_with_arch]), bootstrap_cfg_arch.name)
2426

2527
$logger.info "Creating ProcCertModel with a ConfiguredArchitecture object for #{model_name}"
2628
proc_cert_model_with_cfg_arch = cfg_arch.proc_cert_model(model_name)

0 commit comments

Comments
 (0)