Skip to content

Commit 66b77c4

Browse files
authored
Add draft specification proposal from Codasip (#2)
2 parents 0720d7e + 7e0557d commit 66b77c4

File tree

258 files changed

+11671
-207
lines changed

Some content is hidden

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

258 files changed

+11671
-207
lines changed

.github/workflows/build-pdf.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ jobs:
5555
uses: actions/upload-artifact@v3
5656
with:
5757
name: Build Artifacts
58-
path: ${{ github.workspace }}/*.pdf
58+
path: ${{ github.workspace }}/build/*.pdf
5959
retention-days: 30
6060

6161
# Create Release
6262
- name: Create Release
6363
uses: softprops/action-gh-release@v1
6464
with:
65-
files: ${{ github.workspace }}/*.pdf
65+
files: ${{ github.workspace }}/build/*.pdf
6666
tag_name: v${{ github.event.inputs.version }}
6767
name: Release ${{ github.event.inputs.version }}
6868
draft: ${{ github.event.inputs.draft }}

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
*.pdf
2-
1+
build
2+
src/generated

Makefile

+123-36
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Makefile for RISC-V Doc Template
1+
# Makefile for RISC-V specification for CHERI extensions
22
#
33
# This work is licensed under the Creative Commons Attribution-ShareAlike 4.0
44
# International License. To view a copy of this license, visit
@@ -8,38 +8,111 @@
88
# SPDX-License-Identifier: CC-BY-SA-4.0
99
#
1010
# Description:
11-
#
12-
# This Makefile is designed to automate the process of building and packaging
13-
# the Doc Template for RISC-V Extensions.
11+
#
12+
# This Makefile is designed to automate the process of building and packaging
13+
# the specification document.
14+
15+
# Tools
16+
DOCKER_IMAGE = riscvintl/riscv-docs-base-container-image:latest
17+
GEN_SCRIPT = $(SCRIPTS_DIR)/generate_tables.py
1418

15-
DATE ?= $(shell date +%Y-%m-%d)
16-
VERSION ?= v0.0.0
19+
# Version and date
20+
DATE ?= $(shell date +%Y-%m-%d)
21+
VERSION ?= v0.7.0
1722
REVMARK ?= Draft
18-
DOCKER_RUN := docker run --rm -v ${PWD}:/build -w /build \
19-
riscvintl/riscv-docs-base-container-image:latest
20-
21-
HEADER_SOURCE := header.adoc
22-
PDF_RESULT := spec-sample.pdf
23-
24-
ASCIIDOCTOR_PDF := asciidoctor-pdf
25-
OPTIONS := --trace \
26-
-a compress \
27-
-a mathematical-format=svg \
28-
-a revnumber=${VERSION} \
29-
-a revremark=${REVMARK} \
30-
-a revdate=${DATE} \
31-
-a pdf-fontsdir=docs-resources/fonts \
32-
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
33-
--failure-level=ERROR
34-
REQUIRES := --require=asciidoctor-bibtex \
35-
--require=asciidoctor-diagram \
36-
--require=asciidoctor-mathematical
37-
38-
.PHONY: all build clean build-container build-no-container
39-
40-
all: build
41-
42-
build:
23+
24+
# URLs for downloaded CSV files
25+
URL_BASE = https://docs.google.com/spreadsheets/d/1nyxKamsYZaeTyG8qP-JX4_oQwcuQ_4nZ_Ihm3RK0NEY/gviz/tq?tqx=out:csv
26+
URL_ISA = $(URL_BASE)&gid=0
27+
URL_CSR = $(URL_BASE)&gid=1927549494
28+
29+
# Directories and files
30+
BUILD_DIR = build
31+
SRC_DIR = src
32+
SRCS = $(wildcard $(SRC_DIR)/*.adoc) \
33+
$(wildcard $(SRC_DIR)/*/*.adoc) \
34+
$(wildcard $(SRC_DIR)/*/*.bib) \
35+
$(wildcard $(SRC_DIR)/*/*/*.adoc) \
36+
$(VERSION_FILE)
37+
IMG_DIR = $(SRC_DIR)/img
38+
IMGS = $(wildcard $(IMG_DIR)/*.png) \
39+
$(wildcard $(IMG_DIR)/*.svg) \
40+
$(wildcard $(IMG_DIR)/*.edn)
41+
CSV_DIR = $(SRC_DIR)/csv
42+
CSVS = $(wildcard $(CSV_DIR)/*.csv)
43+
GEN_DIR = $(SRC_DIR)/generated
44+
SCRIPTS_DIR = $(SRC_DIR)/scripts
45+
46+
# Output file
47+
PDF_RESULT := $(BUILD_DIR)/riscv-cheri.pdf
48+
49+
# Top asciidoc file of the document
50+
HEADER_SOURCE := $(SRC_DIR)/riscv-cheri.adoc
51+
52+
# Generated files
53+
GEN_SRC = $(GEN_DIR)/both_mode_insns_table_body.adoc \
54+
$(GEN_DIR)/cap_mode_insns_table_body.adoc \
55+
$(GEN_DIR)/csr_added_legacy_table_body.adoc \
56+
$(GEN_DIR)/csr_added_purecap_mode_d_table_body.adoc \
57+
$(GEN_DIR)/csr_added_purecap_mode_m_table_body.adoc \
58+
$(GEN_DIR)/csr_added_purecap_mode_s_table_body.adoc \
59+
$(GEN_DIR)/csr_added_purecap_mode_u_table_body.adoc \
60+
$(GEN_DIR)/csr_alias_action_table_body.adoc \
61+
$(GEN_DIR)/csr_aliases_table_body.adoc \
62+
$(GEN_DIR)/csr_exevectors_table_body.adoc \
63+
$(GEN_DIR)/csr_metadata_table_body.adoc \
64+
$(GEN_DIR)/csr_permission_table_body.adoc \
65+
$(GEN_DIR)/csr_removed_purecap_mode_d_table_body.adoc \
66+
$(GEN_DIR)/csr_removed_purecap_mode_m_table_body.adoc \
67+
$(GEN_DIR)/csr_removed_purecap_mode_s_table_body.adoc \
68+
$(GEN_DIR)/csr_removed_purecap_mode_u_table_body.adoc \
69+
$(GEN_DIR)/csr_replaced_purecap_mode_d_table_body.adoc \
70+
$(GEN_DIR)/csr_replaced_purecap_mode_m_table_body.adoc \
71+
$(GEN_DIR)/csr_replaced_purecap_mode_s_table_body.adoc \
72+
$(GEN_DIR)/csr_replaced_purecap_mode_u_table_body.adoc \
73+
$(GEN_DIR)/illegal_insns_table_body.adoc \
74+
$(GEN_DIR)/legacy_mnemonic_insns_table_body.adoc \
75+
$(GEN_DIR)/legacy_mode_insns_table_body.adoc \
76+
$(GEN_DIR)/xlen_dependent_encoding_insns_table_body.adoc \
77+
$(GEN_DIR)/Zbh_lr_sc_insns_table_body.adoc \
78+
$(GEN_DIR)/Zcheri_legacy_insns_table_body.adoc \
79+
$(GEN_DIR)/Zcheri_mode_insns_table_body.adoc \
80+
$(GEN_DIR)/Zcheri_purecap_insns_table_body.adoc
81+
82+
# Docker command
83+
DOCKER = docker run --rm -v $(PWD):/build -w /build $(DOCKER_IMAGE)
84+
85+
# AsciiDoctor command
86+
ASCIIDOC_PDF = asciidoctor-pdf
87+
ASCIIDOC_OPTIONS = --trace \
88+
-a compress \
89+
-a mathematical-format=svg \
90+
-a revnumber=$(VERSION) \
91+
-a revremark=$(REVMARK) \
92+
-a revdate=$(DATE) \
93+
-a buildir=$(BUILD_DIR) \
94+
-a srcdir=$(SRC_DIR) \
95+
-a imagesdir=img \
96+
-a imagesoutdir=$(BUILD_DIR)/img \
97+
-a cheri_v9_annotations='' \
98+
-a pdf-fontsdir=docs-resources/fonts \
99+
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
100+
--failure-level=ERROR
101+
ASCIIDOC_REQUIRES = --require=asciidoctor-bibtex \
102+
--require=asciidoctor-diagram \
103+
--require=asciidoctor-mathematical
104+
105+
# Convenience targets
106+
all: $(PDF_RESULT)
107+
generate: $(GEN_SRC)
108+
download: $(CSVS)
109+
110+
$(BUILD_DIR):
111+
@echo " DIR $@"
112+
@mkdir -p $@
113+
114+
%.pdf: $(SRCS) $(IMGS) $(GEN_SRC) | $(BUILD_DIR)
115+
@echo " DOC $@"
43116
@echo "Checking if Docker is available..."
44117
@if command -v docker >/dev/null 2>&1 ; then \
45118
echo "Docker is available, building inside Docker container..."; \
@@ -51,15 +124,29 @@ build:
51124

52125
build-container:
53126
@echo "Starting build inside Docker container..."
54-
$(DOCKER_RUN) /bin/sh -c "$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)"
127+
$(DOCKER) /bin/sh -c "$(ASCIIDOC_PDF) $(ASCIIDOC_OPTIONS) $(ASCIIDOC_REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)"
55128
@echo "Build completed successfully inside Docker container."
56129

57130
build-no-container:
58131
@echo "Starting build..."
59-
$(ASCIIDOCTOR_PDF) $(OPTIONS) $(REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)
132+
$(ASCIIDOC_PDF) $(ASCIIDOR_OPTIONS) $(ASCIIDOC_REQUIRES) --out-file=$(PDF_RESULT) $(HEADER_SOURCE)
60133
@echo "Build completed successfully."
61134

135+
# Rule to generate all the src/generated/*.adoc from the downloaded CSVs using a Python script.
136+
$(GEN_SRC) &: $(CSVS) $(GEN_SCRIPT)
137+
@echo " GEN"
138+
@$(GEN_SCRIPT) -o $(GEN_DIR) --csr $(CSV_DIR)/CHERI_CSR.csv --isa $(CSV_DIR)/CHERI_ISA.csv
139+
140+
# Rule to download CSVs. These files are checked in and only re-downloaded when you `make download`.
141+
$(CSVS) &:
142+
@echo " DOWN CSV (isa)"
143+
@curl -Lo src/csv/CHERI_ISA.csv "$(URL_ISA)"
144+
@echo " DOWN CSV (csr)"
145+
@curl -Lo src/csv/CHERI_CSR.csv "$(URL_CSR)"
146+
147+
# Clean
62148
clean:
63-
@echo "Cleaning up generated files..."
64-
rm -f $(PDF_RESULT)
65-
@echo "Cleanup completed."
149+
@echo " CLEAN"
150+
@$(RM) -r $(PDF_RESULT) $(GEN_SRC)
151+
152+
.PHONY: all generate download clean

chapter2.adoc

-47
This file was deleted.

example.bib

-36
This file was deleted.

header.adoc

-66
This file was deleted.

intro.adoc

-15
This file was deleted.

readme.adoc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
= RISC-V Cheri Specification
1+
= RISC-V Specification for CHERI Extensions
22

3-
This repository contains the CHERI extension specification, adding hardware capabilities to RISC-V ISA to enable fine-grained memory protection and scalable compartmentalization.
3+
This repository contains the CHERI extension specification, adding hardware capabilities to the RISC-V ISA to enable fine-grained memory protection and scalable compartmentalization.
44

55
== License
66

@@ -21,14 +21,15 @@ To build the document, you'll need the following tools installed on your system:
2121
* Make
2222
* asciiDoctor-pdf, asciidoctor-bibtex, asciidoctor-diagram and asciidoctor-mathematical
2323
* Docker
24+
* Python3
2425

2526
=== Cloning the Repository
2627

2728
`git clone --recurse-submodules https://github.com/riscv/riscv-cheri.git`
2829

2930
=== Building the Documentation
3031

31-
To start the build process, run `cd ./docs-spec-template && make build`.
32+
To start the build process, run `cd ./riscv-cheri && make all`.
3233

3334
The Makefile script will check the availability of Docker on your system:
3435

File renamed without changes.

0 commit comments

Comments
 (0)