Skip to content

Commit 9cce5fc

Browse files
authored
fix: cfgs with custom overlays; was broken by refactoring (riscv-software-src#908)
- Fixes the generation of an extension PDF when a custom overlay is involved - Fixes some minor IDL issues in Xqci that were revealed by recent compiler improvements - Adds the Xqci document generation to regression tests
1 parent 4e2b930 commit 9cce5fc

File tree

15 files changed

+107
-76
lines changed

15 files changed

+107
-76
lines changed

.github/workflows/regress.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ jobs:
201201
uses: ./.github/actions/singularity-setup
202202
- name: Run cpp unit tests
203203
run: ./do test:cpp_hart CONFIG=rv64 JOBS=4
204+
regress-xqci-doc:
205+
runs-on: ubuntu-latest
206+
env:
207+
SINGULARITY: 1
208+
steps:
209+
- name: Clone Github Repo Action
210+
uses: actions/checkout@v4
211+
- name: singularity setup
212+
uses: ./.github/actions/singularity-setup
213+
- name: Run cpp unit tests
214+
run: ./do gen:ext_pdf EXT=Xqci CFG=qc_iu.yaml VERSION=latest
204215
call-deploy:
205216
uses: ./.github/workflows/merge.yml
206217
with:

backends/ext_pdf_doc/tasks.rake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ rule %r{#{$resolver.gen_path}/ext_pdf_doc/.*/pdf/.*_extension\.pdf} => proc { |t
3434
"-a pdf-theme=#{ENV['THEME']}",
3535
"-a pdf-fontsdir=#{$root}/ext/docs-resources/fonts",
3636
"-a imagesdir=#{$root}/ext/docs-resources/images",
37+
"-a wavedrom=#{$root}/node_modules/.bin/wavedrom-cli",
3738
"-r asciidoctor-diagram",
3839
"-r idl_highlighter",
3940
"-o #{t.name}",
@@ -62,6 +63,7 @@ rule %r{#{$resolver.gen_path}/ext_pdf_doc/.*/html/.*_extension\.html} => proc {
6263
"-v",
6364
"-a toc",
6465
"-r asciidoctor-diagram",
66+
"-a wavedrom=#{$root}/node_modules/.bin/wavedrom-cli",
6567
"-o #{t.name}",
6668
adoc_file
6769
].join(" ")
@@ -74,7 +76,7 @@ rule %r{#{$resolver.gen_path}/ext_pdf_doc/.*/adoc/.*_extension\.adoc} => proc {
7476
config_name = Pathname.new(tname).relative_path_from("#{$resolver.gen_path}/ext_pdf_doc").to_s.split("/")[0]
7577
arch_yaml_paths = Dir.glob("#{$resolver.resolved_spec_path(config_name)}/**/*.yaml")
7678
cfg_path = $resolver.gen_path / "ext_pdf_doc" / "#{config_name}.yaml"
77-
cfg = Udb::AbstractConfig.create(cfg_path)
79+
cfg = Udb::AbstractConfig.create(cfg_path, $resolver.cfg_info(config_name))
7880
arch_yaml_paths += Dir.glob("#{cfg.arch_overlay_abs}/**/*.yaml") unless cfg.arch_overlay.nil?
7981
[
8082
(EXT_PDF_DOC_DIR / "templates" / "ext_pdf.adoc.erb").to_s,

backends/ext_pdf_doc/templates/ext_pdf.adoc.erb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
// Settings
4848
:experimental:
4949
:reproducible:
50-
:wavedrom: <%= $root %>/node_modules/.bin/wavedrom-cli
5150
// needs to be changed
5251
:imagesoutdir: images
5352
:icons: font

backends/portfolio/tasks.rake

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ require "idlc/passes/gen_adoc"
1313

1414
require "udb/config"
1515

16-
# @return [Architecture]
16+
sig { returns(Udb::ConfiguredArchitecture) }
1717
def pf_create_arch
1818
$resolver.cfg_arch_for("_")
1919
end
2020

21-
# @param portfolio_grp_with_arch [PortfolioGroup] Contains one or more Portfolio objects that have an arch (not a cfg_arch).
22-
# @return [ConfiguredArchitecture]
21+
# @param portfolio_grp_with_arch Contains one or more Portfolio objects that have an arch (not a cfg_arch).
2322
sig { params(portfolio_grp_with_arch: Udb::PortfolioGroup).returns(Udb::ConfiguredArchitecture) }
2423
def pf_create_cfg_arch(portfolio_grp_with_arch)
2524
# Create a ConfiguredArchitecture object and provide it a PortfolioGroupConfig object to implement the AbstractConfig API.
@@ -29,8 +28,7 @@ def pf_create_cfg_arch(portfolio_grp_with_arch)
2928
# object can require that the PortfolioGroup DatabaseObjects contain a ConfiguredArchitecture.
3029
Udb::ConfiguredArchitecture.new(
3130
portfolio_grp_with_arch.name,
32-
Udb::AbstractConfig.create(portfolio_grp_with_arch),
33-
$resolver.gen_path / "resolved_spec" / "_"
31+
Udb::AbstractConfig.create(portfolio_grp_with_arch, $resolver.cfg_info("_"))
3432
)
3533
end
3634

spec/custom/isa/qc_iu/inst/Xqci/qc.addsat.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ access:
3434
vs: always
3535
vu: always
3636
operation(): |
37-
Bits<xlen()+1> sum = X[rs1] `+ X[rs2];
38-
Bits<xlen()+1> most_negative_number = {2'b11,{(xlen()-1){1'b0}}};
39-
Bits<xlen()+1> most_positive_number = {2'b00,{(xlen()-1){1'b1}}};
37+
Bits<MXLEN+1> sum = X[rs1] `+ X[rs2];
38+
Bits<MXLEN+1> most_negative_number = {2'b11,{(xlen()-1){1'b0}}};
39+
Bits<MXLEN+1> most_positive_number = {2'b00,{(xlen()-1){1'b1}}};
4040
# overflow occurs if the operands are the same sign and the result is a different sign
4141
if (X[rs1][xlen()-1] == X[rs2][xlen()-1]) {
4242
if (sum[xlen()-1] != X[rs1][xlen()-1]) {
43-
if ($signed(X[rs1]) < 0) {
43+
if ($signed(X[rs1]) < 's0) {
4444
sum = most_negative_number;
4545
} else {
4646
sum = most_positive_number;

spec/custom/isa/qc_iu/inst/Xqci/qc.addusat.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ access:
3434
vs: always
3535
vu: always
3636
operation(): |
37-
Bits<xlen()+1> sum = X[rs1] `+ X[rs2];
38-
Bits<xlen()+1> largest_unsigned_value = {1'b0, {xlen(){1'b1}}};
37+
Bits<MXLEN+1> sum = X[rs1] `+ X[rs2];
38+
Bits<MXLEN+1> largest_unsigned_value = {1'b0, {xlen(){1'b1}}};
3939
4040
if (sum > largest_unsigned_value) {
4141
X[rd] = largest_unsigned_value[(xlen() - 1):0];

spec/custom/isa/qc_iu/inst/Xqci/qc.shlsat.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ access:
3434
vs: always
3535
vu: always
3636
operation(): |
37-
Bits<xlen()`*2> sext_double_width_rs1 = {{xlen(){X[rs1][xlen()-1]}}, X[rs1]};
38-
Bits<xlen()`*2> shifted_value = sext_double_width_rs1 << X[rs2][4:0];
39-
Bits<xlen()`*2> most_negative_number = {{(xlen()+1){1'b1}}, {(xlen()-1){1'b0}}};
40-
Bits<xlen()`*2> most_positive_number = {{(xlen()+1){1'b0}}, {(xlen()-1){1'b1}}};
37+
Bits<MXLEN`*2> sext_double_width_rs1 = {{xlen(){X[rs1][xlen()-1]}}, X[rs1]};
38+
Bits<MXLEN`*2> shifted_value = sext_double_width_rs1 << X[rs2][4:0];
39+
Bits<MXLEN`*2> most_negative_number = {{(xlen()+1){1'b1}}, {(xlen()-1){1'b0}}};
40+
Bits<MXLEN`*2> most_positive_number = {{(xlen()+1){1'b0}}, {(xlen()-1){1'b1}}};
4141
4242
if ($signed(shifted_value) < $signed(most_negative_number)) {
4343
X[rd] = most_negative_number[(xlen() - 1):0];

spec/custom/isa/qc_iu/inst/Xqci/qc.shlusat.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ access:
3434
vs: always
3535
vu: always
3636
operation(): |
37-
Bits<xlen()`*2> zext_double_width_rs1 = {{xlen(){1'b0}}, X[rs1]};
38-
Bits<xlen()`*2> shifted_value = zext_double_width_rs1 << X[rs2][4:0];
39-
Bits<xlen()`*2> largest_unsigned_value = {{xlen(){1'b0}}, {xlen(){1'b1}}};
37+
Bits<MXLEN`*2> zext_double_width_rs1 = {{xlen(){1'b0}}, X[rs1]};
38+
Bits<MXLEN`*2> shifted_value = zext_double_width_rs1 << X[rs2][4:0];
39+
Bits<MXLEN`*2> largest_unsigned_value = {{xlen(){1'b0}}, {xlen(){1'b1}}};
4040
4141
if (shifted_value > largest_unsigned_value) {
4242
X[rd] = largest_unsigned_value[(xlen() - 1):0];

spec/custom/isa/qc_iu/inst/Xqci/qc.subsat.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ access:
3434
vs: always
3535
vu: always
3636
operation(): |
37-
Bits<xlen()+1> result = X[rs1] `- X[rs2];
38-
Bits<xlen()+1> most_negative_number = {2'b11,{(xlen()-1){1'b0}}};
39-
Bits<xlen()+1> most_positive_number = {2'b00,{(xlen()-1){1'b1}}};
37+
Bits<MXLEN+1> result = X[rs1] `- X[rs2];
38+
Bits<MXLEN+1> most_negative_number = {2'b11,{(xlen()-1){1'b0}}};
39+
Bits<MXLEN+1> most_positive_number = {2'b00,{(xlen()-1){1'b1}}};
4040
4141
# overflow occurs if the operands have different signs and the result is a different sign than the first operand
4242
if (X[rs1][xlen()-1] != X[rs2][xlen()-1]) {
4343
if (result[xlen()-1] != X[rs1][xlen()-1]) {
44-
if ($signed(X[rs1]) < 0) {
44+
if ($signed(X[rs1]) < 's0) {
4545
result = most_negative_number;
4646
} else {
4747
result = most_positive_number;

spec/custom/isa/qc_iu/inst/Xqci/qc.wrap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ operation(): |
3838
XReg rs1_value = X[rs1];
3939
X[rd] = ($signed(rs1_value) >= $signed(X[rs2]))
4040
? rs1_value - X[rs2]
41-
: (($signed(rs1_value) < 0)
41+
: (($signed(rs1_value) < 's0)
4242
? (rs1_value + X[rs2])
4343
: rs1_value);

0 commit comments

Comments
 (0)