Skip to content

Latest commit

 

History

History
189 lines (149 loc) · 5.9 KB

File metadata and controls

189 lines (149 loc) · 5.9 KB

Developing CREATOR

Warning

Make sure to initialize the git submodules.

You can either add the --recurse-submodules flag when doing git clone or do git submodule update --init --recursive once it is already cloned.

Project Setup

This project uses Bun (for Web) and Deno (for CLI).

Important

Building the assembler dependency requires installing rustup and Deno

bun install  # install dependencies
bun dev:wasm  # build wasm dependencies

Compile Web and Hot-Reload for Development (with Vite)

bun dev:web

Run CLI and Hot-Reload for Development (with Deno)

bun dev:cli

Note

Remember to pass the extra arguments, e.g:

bun dev:cli -a ./architecture/RISCV/RV32IMFD.yml -I -c creatorconfig.yml

Building Web version for production

bun build:web

The resulting bundle will be saved to dist/web/.

Tip

To test locally the bundle version, as it will be deployed in GitHub Pages:

REPO="creator" bun build:web
cd dist/web
python -m http.server 8080

And go to localhost:8080/creator/

Building CLI version

bun build:cli

Lint with ESLint

bun lint

Format with Prettier

bun format <file/directory>

Run Tests

Unit tests (with Deno)

deno test -A --unstable-node-globals --parallel

Integration tests use Deno's snapshot testing. They store the last known good result, and compare new results against the stored snapshots to verify them (showing the differences if they don't match). For this reason, the snapshots should always be committed to the repo. They are run along with the other tests using the command above. The snapshots can be created/updated automatically with:

deno test -A --unstable-node-globals --parallel -- --update

Backend RPC Server

This project includes a JSON RPC server that exposes the CREATOR emulator's core functionalities.

For more details, see the RPC Server README.

VS Code Setup

The recommended extensions are:

Note

The recommended formatter to use with Vue files is Prettier (esbenp.prettier-vscode):

"[vue]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},

Debugging

We provide some example launch configurations:

Web

We'll need to launch the application in DEV mode, and then attach the VS Code debugger to the Chrome instance.

{
    "type": "chrome",
    "request": "launch",
    "name": "Debug Web",
    "url": "http://localhost:5173",
    "webRoot": "${workspaceFolder}"
}
CLI
{
    "type": "node",
    "request": "launch",
    "name": "Debug CLI",
    "program": "${workspaceFolder}/src/cli/creator-cli.mts",
    "runtimeExecutable": "deno",
    "console": "integratedTerminal",
    "runtimeArgs": ["-A", "--unstable-node-globals", "--inspect-brk"],
    "experimentalNetworking": "off",
    "args": [
        "-a",
        "./architecture/RISCV/RV32IMFD.yml",
        "-s",
        "./tests/arch/riscv/correct/examples/test_riscv_example_011.s",
        "-c",
        "creatorconfig.yml",
        "-I"
    ],
    "attachSimplePort": 9229
}

Resources

General

Web

Assembler