Skip to content

Commit 1ec484e

Browse files
authored
Merge branch 'main' into dhower/refs
2 parents f85f032 + c79a3a5 commit 1ec484e

File tree

19 files changed

+425
-46
lines changed

19 files changed

+425
-46
lines changed

.devcontainer/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ubuntu:24.04 AS spython-base
2+
RUN export DEBIAN_FRONTEND=noninteractive
3+
RUN apt-get update
4+
RUN apt-get install -y --no-install-recommends git
5+
RUN apt-get install -y --no-install-recommends python3
6+
RUN apt-get install -y --no-install-recommends python3.12-venv python3-pip
7+
RUN apt-get install -y --no-install-recommends build-essential
8+
RUN apt-get install -y --no-install-recommends ruby ruby-dev
9+
RUN apt-get install -y --no-install-recommends bundler
10+
RUN apt-get install -y --no-install-recommends nodejs
11+
RUN apt-get install -y --no-install-recommends npm
12+
RUN apt-get install -y --no-install-recommends ditaa
13+
RUN apt-get clean autoclean
14+
RUN apt-get autoremove -y
15+
RUN rm -rf /var/lib/{apt, dpkg, cache, log}

.devcontainer/devcontainer.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "RISC-V UnifiedDB Dev",
3+
"build": { "dockerfile": "Dockerfile" },
4+
"updateContentCommand": "${containerWorkspaceFolder}/.devcontainer/updateContentCommand.sh",
5+
"onCreateCommand": "${containerWorkspaceFolder}/.devcontainer/onCreateCommand.sh",
6+
"remoteEnv": {
7+
"DISPLAY": ":0"
8+
},
9+
"containerEnv": {
10+
"DEVCONTAINER_ENV": "true"
11+
},
12+
// vscode extensions
13+
"customizations": {
14+
"vscode": {
15+
"settings": {
16+
"solargraph.bundlerPath": "bundle",
17+
"solargraph.useBundler": true,
18+
"files.exclude": {
19+
"**/.home": true,
20+
"**/.yardoc": true
21+
},
22+
"files.watcherExclude": {
23+
"**/.home": true
24+
},
25+
"asciidoc.antora.showEnableAntoraPrompt": true
26+
},
27+
"extensions": [
28+
"castwide.solargraph",
29+
"redhat.vscode-yaml",
30+
"asciidoctor.asciidoctor-vscode",
31+
"zhwu95.riscv",
32+
"tomoki1207.pdf",
33+
"CraigMaslowski.erb",
34+
"HowerLimited.idl-vscode"
35+
]
36+
}
37+
},
38+
"forwardPorts": [
39+
8000, 8080
40+
]
41+
}

.devcontainer/onCreateCommand.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
npm i
4+
bundle install
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
bundle

.vscode/settings.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.adoc

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ This repository contains:
5151

5252
== Prerequisites
5353

54-
The only requirement is the `Singularity CE` (>= 3.3) or `Apptainer` (>= 1.0) container system. Either one will work (they are forks).
54+
There are two supported ways to run the RISC-V Unified Database,
55+
both of which are container-based.
5556

56-
If it is not installed, either as your IT admin or:
57+
=== Singularity/Apptainer
58+
59+
You can run within `Singularity CE` (>= 3.3) or `Apptainer` (>= 1.0) container system. Either one will work (they are forks).
60+
61+
If it is not installed, either ask your IT admin or:
5762

5863
* For Apptainer, see https://apptainer.org/docs/admin/main/installation.html[Apptainer Installation].
5964
* For Singularity CE, see https://docs.sylabs.io/guides/latest/admin-guide/installation.html[Singularity CE Installation].
@@ -62,35 +67,31 @@ If it is not installed, either as your IT admin or:
6267
You do *not* need root privileges to download or use the container. However, to modify/build the container,
6368
you will need either root privileges or the ability to run in `fakeroot` mode. See https://docs.sylabs.io/guides/4.1/user-guide/fakeroot.html[Singularity Fakeroot Documentation] for more information.
6469

65-
== Setup
70+
When you run with Singularity/Apptainer, the files under `bin/`
71+
will run within the container, _e.g._:
6672

67-
Do once:
73+
```bash
74+
./bin/ruby --version
75+
# => ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x86_64-linux-gnu]
76+
```
6877

69-
[source,bash]
70-
----
71-
./bin/setup
78+
=== Devcontainer
7279

73-
# or, if you also want development tools (:development group in Gemfile) installed
74-
# DEVELOPMENT=1 ./bin/setup
75-
----
80+
You can also leverage https://containers.dev/[devcontainers] to run the RISC-V Unified Database.
7681

77-
[NOTE]
78-
If you forget, don't worry. Setup will be invoked by any program in bin/ if necessary.
82+
This is especially useful when using Visual Studio Code or GitHub codespaces, as it will setup up your IDE environment for you.
83+
84+
==== VS Code
7985

80-
=== VSCode
86+
To run the devcontainer locally, you will need to have https://docs.docker.com/engine/install[Docker installed].
8187

82-
If using Visual Studio Code and want to use development tools, you will need to restart the editor
83-
after setup.
88+
With Docker installed, install the https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers[Dev Containers] extension in VS Code.
8489

85-
Helpful extensions are
90+
You can then run `Dev Containers: Open Folder in Container...` from the Command Palette (Ctrl+Shift+P) and select the folder with this repository.
8691

87-
* https://marketplace.visualstudio.com/items?itemName=asciidoctor.asciidoctor-vscode[AsciiDoc]
88-
* https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml[YAML]
89-
* https://marketplace.visualstudio.com/items?itemName=castwide.solargraph[Solargraph] (for a Ruby Language Server)
90-
* https://marketplace.visualstudio.com/items?itemName=onnovalkering.vscode-singularity[Singularity] (if you plan on working on the container)
92+
==== GitHub Codespaces
9193

92-
The `.vscode/settings.json` file in the repo will ensure that Solargraph works without any additional
93-
configuration (assuming you've already run ./bin/setup).
94+
You can start a GitHub Codespace for this repository by clicking the "Code" button and selecting "Open with Codespaces".
9495

9596
== Tasks
9697

@@ -100,9 +101,16 @@ Quick start:
100101
----
101102
./do --tasks # list all documented tasks
102103
103-
# examples
104-
./do validate # validate against the schema
105-
./do gen:arch[generic_rv64] # generate arch spec for the 'generic_rv64' config
104+
## examples
105+
106+
# validate against the schema
107+
./do validate
108+
109+
# generate all versions of ISA manual, as an Antora static website
110+
./do gen:html_manual MANUAL_NAME=isa VERSIONS=all
111+
112+
# generate an implementation-specific spec for the 'generic_rv64' config
113+
./do gen:arch[generic_rv64]
106114
----
107115

108116
== More info

arch/inst/I/addiw.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ addiw:
77
base: 64
88
assembly: xd, xs1, imm
99
encoding:
10-
match: -----------------000-----0001011
10+
match: -----------------000-----0011011
1111
variables:
1212
- name: imm
1313
location: 31-20

backends/indexer/README.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Creates an index of the database using JSON Reference.
2+
3+
== Tasks
4+
5+
[source,bash]
6+
----
7+
./do gen:index # writes index to ROOT/gen/indexer/index-unifieddb.json
8+
----
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
const process = require('process');
5+
const path = require('path');
6+
const fs = require('fs');
7+
8+
const { readdir, stat } = fs.promises;
9+
10+
const rec = async (branch, root) => {
11+
const node = {};
12+
const localPath = path.resolve(root, ...branch);
13+
const els = await readdir(localPath);
14+
for (const el of els) {
15+
const isFile = (await stat(path.resolve(localPath, el))).isFile();
16+
const fileExt = path.extname(el);
17+
const baseName = path.basename(el, fileExt);
18+
if (isFile) {
19+
if (['.yaml', '.json'].includes(fileExt)) {
20+
node[baseName] = {$ref: path.join(...branch, el)};
21+
}
22+
} else {
23+
node[el] = await rec([...branch, el], root);
24+
}
25+
}
26+
return node;
27+
};
28+
29+
const main = async () => {
30+
const [, , root] = process.argv;
31+
if (root === undefined) {
32+
console.error('usage: ./index-unifieddb.js <path-to-unifieddb-arch-folder>');
33+
return;
34+
}
35+
const rootPath = path.resolve('.', root);
36+
const tree = await rec([], rootPath);
37+
console.log(JSON.stringify(tree, null, 2));
38+
};
39+
40+
main();

backends/indexer/tasks.rake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
require "pathname"
3+
4+
namespace :gen do
5+
desc "Generate index of the database"
6+
task :index do
7+
index_path = Pathname.new("#{$root}/gen/indexer/index-unified.json")
8+
Dir.chdir "#{$root}/backends/indexer" do
9+
FileUtils.mkdir_p index_path.dirname
10+
File.write index_path, `node index-unifieddb.js #{$root}`
11+
end
12+
end
13+
end

0 commit comments

Comments
 (0)