Skip to content

Commit 63796f1

Browse files
Merge pull request #212 from riscv/org-param-app-by-ch
Organize params by chapter.
2 parents db58a02 + f7c9bb3 commit 63796f1

File tree

128 files changed

+1335
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1335
-191
lines changed

Makefile

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ CREATE_PARAMS_TOOL := $(TOOLS_DIR)/create_params.py
4040
CREATE_PARAMS_PYTHON := python3 $(CREATE_PARAMS_TOOL)
4141
CREATE_PARAM_ADOC_FILES_TOOL := $(TOOLS_DIR)/create_param_appendix.py
4242
CREATE_PARAM_ADOC_FILES_PYTHON := python3 $(CREATE_PARAM_ADOC_FILES_TOOL)
43-
PARAM_ADOC_TEST_SCRIPT := $(PARAMS_TESTS_DIR)/test_param_appendix.py
44-
PARAM_ADOC_TEST_PYTHON := python3 $(PARAM_ADOC_TEST_SCRIPT)
45-
PARAMS_ADOC_TEMPLATE := $(PARAMS_TESTS_DIR)/test-param-appendix-template.adoc
43+
PARAMS_ADOC_SOURCE := $(PARAMS_TESTS_DIR)/test-param-appendix.adoc
44+
PARAM_TABLE_SCHEMA_INPUT := $(TOOLS_DIR)/default_param_table.yaml
45+
PARAM_TABLE_VARIANT_FILES := \
46+
$(PARAMS_TESTS_DIR)/test-param-table-full-default.yaml \
47+
$(PARAMS_TESTS_DIR)/test-param-table-reordered.yaml \
48+
$(PARAMS_TESTS_DIR)/test-param-table-minimal.yaml
4649

4750
# Stuff for building test standards document in HTML to have links into it.
4851
DOCS = test-ch1 test-ch2
@@ -88,6 +91,8 @@ BUILT_PARAMS_HTML := $(BUILD_DIR)/$(PARAMS_HTML_OUTPUT_FNAME)
8891
BUILT_PARAM_ADOC_DIR := $(BUILD_DIR)/test-param-appendix-adoc-includes
8992
BUILT_PARAM_ADOC_STAMP := $(BUILD_DIR)/test-param-adoc.done
9093
BUILT_PARAMS_ADOC := $(BUILD_DIR)/test-param-appendix.adoc
94+
BUILT_PARAM_TABLE_VARIANTS_DIR := $(BUILD_DIR)/test-param-table-variants
95+
BUILT_PARAM_TABLE_VARIANTS_STAMP := $(BUILD_DIR)/test-param-table-variants.done
9196

9297
# Combine separate fnames into lists.
9398
BUILT_TEST_HTML_FNAMES := $(BUILT_TEST_CH1_HTML_FNAME) $(BUILT_TEST_CH2_HTML_FNAME)
@@ -103,6 +108,7 @@ EXPECTED_PARAMS_JSON := $(PARAMS_EXPECTED_DIR)/$(PARAMS_JSON_OUTPUT_FNAME)
103108
EXPECTED_PARAMS_HTML := $(PARAMS_EXPECTED_DIR)/$(PARAMS_HTML_OUTPUT_FNAME)
104109
EXPECTED_PARAMS_ADOC := $(PARAMS_EXPECTED_DIR)/test-param-appendix.adoc
105110
EXPECTED_PARAM_ADOC_DIR := $(PARAMS_EXPECTED_DIR)/test-param-appendix-adoc-includes
111+
EXPECTED_PARAM_TABLE_VARIANTS_DIR := $(PARAMS_EXPECTED_DIR)/test-param-table-variants
106112

107113
# Normative rule definition input YAML files.
108114
GOOD_NORM_RULE_DEF_FILES := $(NORM_RULE_DEF_DIR)/test-ch1.yaml $(NORM_RULE_DEF_DIR)/test-ch2.yaml
@@ -193,19 +199,20 @@ all: test
193199
test: build-tests compare-tests test-tag-changes test-adoc2html test-shared-utils test-text-to-html
194200

195201
# Build tests
196-
.PHONY: build-tests build-test-tags build-test-norm-rules-json build-test-norm-rules-html build-test-tags-without-rules build-test-params-json build-test-params-html build-test-param-adoc
197-
build-tests: build-test-tags build-test-norm-rules-json build-test-norm-rules-html build-test-tags-without-rules build-test-params-json build-test-params-html build-test-param-adoc
202+
.PHONY: build-tests build-test-tags build-test-norm-rules-json build-test-norm-rules-html build-test-tags-without-rules build-test-params-json build-test-params-html build-test-param-adoc build-test-param-table-variants
203+
build-tests: build-test-tags build-test-norm-rules-json build-test-norm-rules-html build-test-tags-without-rules build-test-params-json build-test-params-html build-test-param-adoc build-test-param-table-variants
198204
build-test-tags: $(BUILT_TEST_NORM_TAGS_FNAMES) $(BUILT_DUPLICATE_NORM_TAGS_FNAME)
199205
build-test-norm-rules-json: $(BUILT_NORM_RULES_JSON)
200206
build-test-norm-rules-html: $(BUILT_NORM_RULES_HTML)
201207
build-test-tags-without-rules: $(BUILT_NORM_RULES_TAGS_NO_RULES)
202208
build-test-params-json: $(BUILT_PARAMS_JSON)
203209
build-test-params-html: $(BUILT_PARAMS_HTML)
204210
build-test-param-adoc: $(BUILT_PARAM_ADOC_STAMP)
211+
build-test-param-table-variants: $(BUILT_PARAM_TABLE_VARIANTS_STAMP)
205212

206213
# Compare tests against expected
207214
.PHONY: compare-tests
208-
compare-tests: compare-test-tags compare-test-norm-rules-json compare-test-norm-rules-html compare-test-params-json compare-test-params-html compare-test-params-adoc compare-test-param-adoc-files
215+
compare-tests: compare-test-tags compare-test-norm-rules-json compare-test-norm-rules-html compare-test-params-json compare-test-params-html compare-test-params-adoc compare-test-param-adoc-files compare-test-param-table-variants
209216

210217
.PHONY: compare-test-tags
211218
compare-test-tags: compare-test-ch1-tags compare-test-ch2-tags
@@ -250,6 +257,11 @@ compare-test-param-adoc-files: $(EXPECTED_PARAM_ADOC_DIR) $(BUILT_PARAM_ADOC_DIR
250257
@echo "CHECKING GENERATED PARAM ADOC FILES AGAINST EXPECTED"
251258
diff -r $(EXPECTED_PARAM_ADOC_DIR) $(BUILT_PARAM_ADOC_DIR) && echo "diff PASSED" || (echo "diff FAILED"; exit 1)
252259

260+
.PHONY: compare-test-param-table-variants
261+
compare-test-param-table-variants: $(EXPECTED_PARAM_TABLE_VARIANTS_DIR) $(BUILT_PARAM_TABLE_VARIANTS_DIR)
262+
@echo "CHECKING PARAM TABLE VARIANT OUTPUTS AGAINST EXPECTED"
263+
diff -r $(EXPECTED_PARAM_TABLE_VARIANTS_DIR) $(BUILT_PARAM_TABLE_VARIANTS_DIR) && echo "diff PASSED" || (echo "diff FAILED"; exit 1)
264+
253265
# Test tag change detection
254266
.PHONY: test-tag-changes test-tag-changes-basic test-tag-changes-verbose test-tag-changes-no-changes test-tag-changes-additions-only test-tag-changes-whitespace-only test-tag-changes-formatting-only test-tag-changes-update
255267
test-tag-changes: test-tag-changes-basic test-tag-changes-verbose test-tag-changes-no-changes test-tag-changes-additions-only test-tag-changes-whitespace-only test-tag-changes-formatting-only test-tag-changes-update
@@ -318,7 +330,7 @@ test-tag-text-to-html-unit: $(TAG_TEXT_TO_HTML_UNIT_TEST_SCRIPT) $(TOOLS_DIR)/ta
318330

319331
# Update expected files from built files
320332
.PHONY: update-expected
321-
update-expected: update-test-tags update-test-norm-rules-json update-test-norm-rules-html update-test-params-json update-test-params-html update-test-params-adoc update-test-param-adoc-files
333+
update-expected: update-test-tags update-test-norm-rules-json update-test-norm-rules-html update-test-params-json update-test-params-html update-test-params-adoc update-test-param-adoc-files update-test-param-table-variants
322334

323335
.PHONY: update-test-tags
324336
update-test-tags: update-test-ch1-tags update-test-ch2-tags
@@ -357,8 +369,12 @@ update-test-params-adoc: $(BUILT_PARAMS_ADOC)
357369
.PHONY: update-test-param-adoc-files
358370
update-test-param-adoc-files: $(BUILT_PARAM_ADOC_DIR)
359371
rm -rf $(EXPECTED_PARAM_ADOC_DIR)
360-
mkdir -p $(EXPECTED_PARAM_ADOC_DIR)
361-
cp -f $(BUILT_PARAM_ADOC_DIR)/*.adoc $(EXPECTED_PARAM_ADOC_DIR)
372+
cp -r $(BUILT_PARAM_ADOC_DIR) $(EXPECTED_PARAM_ADOC_DIR)
373+
374+
.PHONY: update-test-param-table-variants
375+
update-test-param-table-variants: $(BUILT_PARAM_TABLE_VARIANTS_DIR)
376+
rm -rf $(EXPECTED_PARAM_TABLE_VARIANTS_DIR)
377+
cp -r $(BUILT_PARAM_TABLE_VARIANTS_DIR) $(EXPECTED_PARAM_TABLE_VARIANTS_DIR)
362378

363379
# Build normative tags with ch1 adoc input
364380
$(BUILT_TEST_CH1_NORM_TAGS_FNAME): $(NORM_RULE_TESTS_DIR)/$(TEST_CH1_INPUT_ADOC_FNAME) $(CONVERTERS_DIR)/$(TAGS_BACKEND)
@@ -401,16 +417,24 @@ $(BUILT_PARAMS_HTML): $(BUILT_NORM_RULES_JSON) $(PARAM_DEF_TEST_FILES) $(CREATE_
401417
$(WORKDIR_TEARDOWN)
402418

403419
# Build parameter AsciiDoc row fragments from generated params JSON.
404-
$(BUILT_PARAM_ADOC_STAMP): $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) $(CREATE_PARAM_ADOC_FILES_TOOL) $(PARAM_ADOC_TEST_SCRIPT) $(PARAMS_ADOC_TEMPLATE)
420+
$(BUILT_PARAM_ADOC_STAMP): $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) $(CREATE_PARAM_ADOC_FILES_TOOL) $(PARAMS_ADOC_SOURCE) $(PARAM_TABLE_SCHEMA_INPUT)
405421
$(WORKDIR_SETUP)
406422
cp -f $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) $@.workdir/$(BUILD_DIR)
407-
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_PARAM_ADOC_FILES_PYTHON) --input $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) --output-dir $(BUILT_PARAM_ADOC_DIR) && touch $(BUILT_PARAM_ADOC_STAMP) $(DOCKER_QUOTE)
408-
$(DOCKER_CMD) $(DOCKER_QUOTE) $(PARAM_ADOC_TEST_PYTHON) --template $(PARAMS_ADOC_TEMPLATE) --adoc-dir $(BUILT_PARAM_ADOC_DIR) --output $(BUILT_PARAMS_ADOC) $(DOCKER_QUOTE)
423+
cp -f $(PARAMS_ADOC_SOURCE) $@.workdir/$(BUILT_PARAMS_ADOC)
424+
$(DOCKER_CMD) $(DOCKER_QUOTE) $(CREATE_PARAM_ADOC_FILES_PYTHON) --input $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) --param-table $(PARAM_TABLE_SCHEMA_INPUT) --output-dir $(BUILT_PARAM_ADOC_DIR) && touch $(BUILT_PARAM_ADOC_STAMP) $(DOCKER_QUOTE)
409425
rm -rf $(BUILT_PARAM_ADOC_DIR)
410426
mv $@.workdir/$(BUILT_PARAM_ADOC_DIR) $(BUILT_PARAM_ADOC_DIR)
411427
mv $@.workdir/$(BUILT_PARAMS_ADOC) $(BUILT_PARAMS_ADOC)
412428
$(WORKDIR_TEARDOWN)
413429

430+
$(BUILT_PARAM_TABLE_VARIANTS_STAMP): $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) $(CREATE_PARAM_ADOC_FILES_TOOL) $(PARAM_TABLE_VARIANT_FILES)
431+
$(WORKDIR_SETUP)
432+
cp -f $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) $@.workdir/$(BUILD_DIR)
433+
$(DOCKER_CMD) $(DOCKER_QUOTE) set -e; rm -rf $(BUILT_PARAM_TABLE_VARIANTS_DIR); mkdir -p $(BUILT_PARAM_TABLE_VARIANTS_DIR); for f in $(PARAM_TABLE_VARIANT_FILES); do stem=$$(basename $$f .yaml); python3 $(CREATE_PARAM_ADOC_FILES_TOOL) --input $(BUILD_DIR)/$(PARAMS_JSON_OUTPUT_FNAME) --param-table $$f --output-dir $(BUILT_PARAM_TABLE_VARIANTS_DIR)/$$stem; done; touch $(BUILT_PARAM_TABLE_VARIANTS_STAMP) $(DOCKER_QUOTE)
434+
rm -rf $(BUILT_PARAM_TABLE_VARIANTS_DIR)
435+
mv $@.workdir/$(BUILT_PARAM_TABLE_VARIANTS_DIR) $(BUILT_PARAM_TABLE_VARIANTS_DIR)
436+
$(WORKDIR_TEARDOWN)
437+
414438
# Build normative rules with HTML output format
415439
$(BUILT_NORM_RULES_HTML): $(BUILT_TEST_NORM_TAGS_FNAMES) $(GOOD_NORM_RULE_DEF_FILES) $(BUILT_TEST_HTML_FNAMES)
416440
$(WORKDIR_SETUP)

schemas/param-table-schema.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Schema for parameter table layout files",
4+
"type": "object",
5+
"properties": {
6+
"$schema": {
7+
"type": "string",
8+
"description": "Optional path/URI to this schema"
9+
},
10+
"columns": {
11+
"type": "array",
12+
"description": "Ordered list of parameter columns from left to right",
13+
"minItems": 1,
14+
"items": {
15+
"type": "object",
16+
"properties": {
17+
"name": {
18+
"type": "string",
19+
"minLength": 1,
20+
"description": "Display name of the column"
21+
},
22+
"column": {
23+
"type": "string",
24+
"description": "Canonical column identifier",
25+
"enum": [
26+
"PARAM_NAME_AND_NORM_RULE_MAPPING",
27+
"TYPE",
28+
"FEATURES",
29+
"DEFINITION"
30+
]
31+
},
32+
"width_pct": {
33+
"type": "number",
34+
"exclusiveMinimum": 0,
35+
"maximum": 100,
36+
"description": "Percentage of total table width allocated to this column"
37+
}
38+
},
39+
"required": ["name", "column", "width_pct"],
40+
"additionalProperties": false
41+
}
42+
}
43+
},
44+
"required": ["columns"],
45+
"additionalProperties": false
46+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.Parameter Definitions (A-Z): 25 Parameters
2+
[cols="30%,10%,10%,50%"]
3+
|===
4+
5+
| Parameter and Mapping to Normative Rules | Type | Feature(s) | Definition
6+
7+
include::test-ch1/ALL_BASES.adoc[]
8+
include::test-ch2/ASIDLEN1.adoc[]
9+
include::test-ch2/ASIDLEN2.adoc[]
10+
include::test-ch2/BASE_RV32I.adoc[]
11+
include::test-ch2/BASE_RV32I_RV64I.adoc[]
12+
include::test-ch1/BIT.adoc[]
13+
include::test-ch1/BOOLEAN.adoc[]
14+
include::test-ch1/BYTE.adoc[]
15+
include::test-ch1/DWORD.adoc[]
16+
include::test-ch2/FOOBAR.adoc[]
17+
include::test-ch1/HWORD.adoc[]
18+
include::test-ch1/INT64.adoc[]
19+
include::test-ch1/LIST_INT.adoc[]
20+
include::test-ch1/LIST_STR.adoc[]
21+
include::test-ch2/MOCK_CSR_FIELD_Y.adoc[]
22+
include::test-ch2/MOCK_CSR_X.adoc[]
23+
include::test-ch2/MOCK_EXT_DEP_A_ON_B.adoc[]
24+
include::test-ch2/MOCK_INST_X.adoc[]
25+
include::test-ch2/NO_IMPL_DEF.adoc[]
26+
include::test-ch2/ROSE_COLORS.adoc[]
27+
include::test-ch1/UINT32.adoc[]
28+
include::test-ch1/UINT6.adoc[]
29+
include::test-ch1/UINT_1TO100.adoc[]
30+
include::test-ch1/WORD.adoc[]
31+
include::test-ch2/XLEN.adoc[]
32+
33+
|===
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.Chapter One Parameter Definitions: 13 Parameters
2+
[cols="30%,10%,10%,50%"]
3+
|===
4+
5+
| Parameter and Mapping to Normative Rules | Type | Feature(s) | Definition
6+
7+
include::test-ch1/all_params.adoc[]
8+
9+
|===
10+
11+
.Chapter Two Parameter Definitions: 12 Parameters
12+
[cols="30%,10%,10%,50%"]
13+
|===
14+
15+
| Parameter and Mapping to Normative Rules | Type | Feature(s) | Definition
16+
17+
include::test-ch2/all_params.adoc[]
18+
19+
|===

tests/params/expected/test-param-appendix-adoc-includes/ALL_BASES.adoc renamed to tests/params/expected/test-param-appendix-adoc-includes/test-ch1/ALL_BASES.adoc

File renamed without changes.

tests/params/expected/test-param-appendix-adoc-includes/BIT.adoc renamed to tests/params/expected/test-param-appendix-adoc-includes/test-ch1/BIT.adoc

File renamed without changes.

tests/params/expected/test-param-appendix-adoc-includes/BOOLEAN.adoc renamed to tests/params/expected/test-param-appendix-adoc-includes/test-ch1/BOOLEAN.adoc

File renamed without changes.

tests/params/expected/test-param-appendix-adoc-includes/BYTE.adoc renamed to tests/params/expected/test-param-appendix-adoc-includes/test-ch1/BYTE.adoc

File renamed without changes.

tests/params/expected/test-param-appendix-adoc-includes/DWORD.adoc renamed to tests/params/expected/test-param-appendix-adoc-includes/test-ch1/DWORD.adoc

File renamed without changes.

tests/params/expected/test-param-appendix-adoc-includes/HWORD.adoc renamed to tests/params/expected/test-param-appendix-adoc-includes/test-ch1/HWORD.adoc

File renamed without changes.

0 commit comments

Comments
 (0)