From fe51ebe611324c14c18a9c9b889c5e58b333274f Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 4 Mar 2026 04:31:29 +0000 Subject: [PATCH 1/7] bump upstream --- .submodules/utoss-risc-v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.submodules/utoss-risc-v b/.submodules/utoss-risc-v index bf8094f..daec300 160000 --- a/.submodules/utoss-risc-v +++ b/.submodules/utoss-risc-v @@ -1 +1 @@ -Subproject commit bf8094f2d8b7f076345c5dc9a97eb495bc57a41e +Subproject commit daec300960c9458f108fd500c4633405e04943c8 From 07eb1a91ec61f0770f10badaa4fe57716b77617b Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 4 Mar 2026 05:11:26 +0000 Subject: [PATCH 2/7] integrate sv2v --- .devcontainer/Dockerfile | 13 +++++++++++++ .github/actions/install-sv2v/action.yaml | 21 +++++++++++++++++++++ .github/workflows/gds.yaml | 6 ++++++ .github/workflows/test.yaml | 6 ++++++ .gitignore | 1 + Makefile | 22 ++++++++++++++++++++++ info.yaml | 19 ++++++++----------- 7 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 .github/actions/install-sv2v/action.yaml create mode 100644 Makefile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9c311ba..f9eaa9e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -24,5 +24,18 @@ RUN umask 022 && \ tar zxf - -C /usr/local --strip-components=1 && \ chmod 755 /usr/local/bin +# install sv2v +ARG SV2V_VERSION=0.0.13 +ARG SV2V_ZIP_NAME=sv2v-Linux.zip +ARG SV2V_ZIP_URL=https://github.com/zachjs/sv2v/releases/download/v${SV2V_VERSION}/${SV2V_ZIP_NAME} +ARG SV2V_ZIP_HASH="552799a1d76cd177b9b4cc63a3e77823a3d2a6eb4ec006569288abeff28e1ff8 ${SV2V_ZIP_NAME}" +RUN mkdir /tmp/sv2v && \ + cd /tmp/sv2v && \ + wget ${SV2V_ZIP_URL} && \ + echo ${SV2V_ZIP_HASH} | sha256sum -c && \ + unzip ${SV2V_ZIP_NAME} && \ + chmod +x sv2v-Linux/sv2v && sudo cp sv2v-Linux/sv2v /usr/local/bin && \ + cd .. && rm -r /tmp/sv2v + # Install LibreLane RUN /ttsetup/venv/bin/pip install librelane==2.4.2 diff --git a/.github/actions/install-sv2v/action.yaml b/.github/actions/install-sv2v/action.yaml new file mode 100644 index 0000000..ee07e75 --- /dev/null +++ b/.github/actions/install-sv2v/action.yaml @@ -0,0 +1,21 @@ +name: 'Install sv2v' +description: 'Install sv2v SystemVerilog to Verilog converter' +runs: + using: 'composite' + steps: + - name: Install sv2v + shell: bash + run: | + SV2V_VERSION=0.0.13 + SV2V_ZIP_NAME=sv2v-Linux.zip + SV2V_ZIP_URL=https://github.com/zachjs/sv2v/releases/download/v${SV2V_VERSION}/${SV2V_ZIP_NAME} + SV2V_ZIP_HASH="552799a1d76cd177b9b4cc63a3e77823a3d2a6eb4ec006569288abeff28e1ff8 ${SV2V_ZIP_NAME}" + + mkdir /tmp/sv2v + cd /tmp/sv2v + wget ${SV2V_ZIP_URL} + echo ${SV2V_ZIP_HASH} | sha256sum -c + unzip ${SV2V_ZIP_NAME} + chmod +x sv2v-Linux/sv2v + sudo cp sv2v-Linux/sv2v /usr/local/bin + rm -rf /tmp/sv2v diff --git a/.github/workflows/gds.yaml b/.github/workflows/gds.yaml index b99cbdd..5ebd3ef 100644 --- a/.github/workflows/gds.yaml +++ b/.github/workflows/gds.yaml @@ -55,6 +55,12 @@ jobs: with: submodules: recursive + - name: Install sv2v + uses: ./.github/actions/install-sv2v + + - name: sv2v + run: make sv2v + - name: Build GDS uses: TinyTapeout/tt-gds-action@ttsky25b with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6e1b5c7..b1c5436 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -23,6 +23,12 @@ jobs: shell: bash run: pip install -r test/requirements.txt + - name: Install sv2v + uses: ./.github/actions/install-sv2v + + - name: sv2v + run: make sv2v + - name: Run tests run: | cd test diff --git a/.gitignore b/.gitignore index 9571d7f..b5a1e98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store .idea +*.sv2v.v *.vcd *.fst *.fst.hier diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..00d024d --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +# Convert SystemVerilog (.sv) files to Verilog (.v) using sv2v + +SV_FILES := $(shell find src/ -follow -name "*.sv" -type f 2>/dev/null | grep -v '/src/src') +INCLUDE_FLAGS := -I src/utoss-risc-v/ +DEFINE_FLAGS := -DUTOSS_RISCV_HARDENING +V_FILES := $(SV_FILES:.sv=.sv2v.v) + +.PHONY: sv2v clean help + +sv2v: + @mkdir -p .sv2v_temp + @sv2v $(INCLUDE_FLAGS) $(DEFINE_FLAGS) $(SV_FILES) -w .sv2v_temp + @for svfile in $(SV_FILES); do \ + module_name=$$(basename "$$svfile" .sv); \ + if [ -f ".sv2v_temp/$$module_name.v" ]; then \ + mv ".sv2v_temp/$$module_name.v" "$$(dirname "$$svfile")/$$module_name.sv2v.v"; \ + fi; \ + done + @rm -rf .sv2v_temp + +clean: + @rm -f $(V_FILES) diff --git a/info.yaml b/info.yaml index 8ec74dd..63d2566 100644 --- a/info.yaml +++ b/info.yaml @@ -17,19 +17,16 @@ project: # Source files must be in ./src and you must list each source file separately, one per line. # Don't forget to also update `PROJECT_SOURCES` in test/Makefile. source_files: - - "tt_um_utoss_riscv.sv" - - "MA.sv" + - "tt_um_utoss_riscv.sv2v.v" + - "MA.sv2v.v" - "utoss-risc-v/src/ALU_ALUdecoder/ALU.v" - - "utoss-risc-v/src/ALU_ALUdecoder/ALUdecoder.sv" - - "utoss-risc-v/src/ControlFSM.sv" - - "utoss-risc-v/src/fetch.sv" - - "utoss-risc-v/src/Instruction_Decode/Instruction_Decode.sv" - - "utoss-risc-v/src/Instruction_Decode/MemoryLoader.sv" + - "utoss-risc-v/src/ALU_ALUdecoder/ALUdecoder.sv2v.v" + - "utoss-risc-v/src/ControlFSM.sv2v.v" + - "utoss-risc-v/src/fetch.sv2v.v" + - "utoss-risc-v/src/Instruction_Decode/Instruction_Decode.sv2v.v" + - "utoss-risc-v/src/Instruction_Decode/MemoryLoader.sv2v.v" - "utoss-risc-v/src/Instruction_Decode/RegisterFile.v" - - "utoss-risc-v/src/params.svh" - - "utoss-risc-v/src/types.svh" - - "utoss-risc-v/src/utils.svh" - - "utoss-risc-v/src/utoss_riscv.sv" + - "utoss-risc-v/src/utoss_riscv.sv2v.v" # The pinout of your project. Leave unused pins blank. DO NOT delete or add any pins. # This section is for the datasheet/website. Use descriptive names (e.g., RX, TX, MOSI, SCL, SEG_A, etc.). From aacc3135c5fd42a55f8a21b7b78423b2cc8434d1 Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 4 Mar 2026 05:12:09 +0000 Subject: [PATCH 3/7] temporarily bump tile count --- info.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info.yaml b/info.yaml index 63d2566..98c9ed0 100644 --- a/info.yaml +++ b/info.yaml @@ -8,7 +8,7 @@ project: clock_hz: 0 # Clock frequency in Hz (or 0 if not applicable) # How many tiles your design occupies? A single tile is about 167x108 uM. - tiles: "4x2" # Valid values: 1x1, 1x2, 2x2, 3x2, 4x2, 6x2 or 8x2 + tiles: "6x2" # Valid values: 1x1, 1x2, 2x2, 3x2, 4x2, 6x2 or 8x2 # Your top module name must start with "tt_um_". Make it unique by including your github username: top_module: "tt_um_utoss_riscv" From 5356b021f8cfa7a84948a004d8137aa80aecf9aa Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 4 Mar 2026 05:12:27 +0000 Subject: [PATCH 4/7] fix ws --- .github/workflows/gds.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gds.yaml b/.github/workflows/gds.yaml index 5ebd3ef..bc2bea6 100644 --- a/.github/workflows/gds.yaml +++ b/.github/workflows/gds.yaml @@ -21,23 +21,23 @@ jobs: with: script: | const comment = `👋 Hello! Before merging this PR, you can use the \`run-gds\` label to start the GDS workflow. - + ⚠️ **Important:** The GDS workflow takes a long time (~1 hour) and consumes significant CI runtime quota. - + **Before running the GDS workflow:** 1. Make sure you've run the hardening command locally first: \`\`\`bash ./tt/tt_tool.py --harden \`\`\` 2. Verify that the hardening command succeeded without errors - + **To run the GDS workflow:** - Add the \`run-gds\` label to this PR - The workflow will run automatically - It will also re-run on subsequent pushes while the label remains attached - + 📚 For more information about the hardening command, see the [TinyTapeout GDS Action](https://github.com/TinyTapeout/tt-gds-action/blob/0d3300e15eda42ae3a24a2bd36433bdd20b32a9f/action.yml#L101-L103).`; - + github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, From 4c626cd5809824fa6a3ce9e124fdac1baa606e93 Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 4 Mar 2026 05:14:01 +0000 Subject: [PATCH 5/7] add sv2v run to docs --- .github/workflows/docs.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 8e34280..d8cb9c3 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -13,5 +13,11 @@ jobs: with: submodules: recursive + - name: Install sv2v + uses: ./.github/actions/install-sv2v + + - name: sv2v + run: make sv2v + - name: Build docs uses: TinyTapeout/tt-gds-action/docs@ttsky25b From 6f3f2a4b560e1a4f80d340afe7b32a11251cab24 Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 4 Mar 2026 06:05:36 +0000 Subject: [PATCH 6/7] go back to prev snapshot of risc-v --- .submodules/utoss-risc-v | 2 +- info.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.submodules/utoss-risc-v b/.submodules/utoss-risc-v index daec300..bf8094f 160000 --- a/.submodules/utoss-risc-v +++ b/.submodules/utoss-risc-v @@ -1 +1 @@ -Subproject commit daec300960c9458f108fd500c4633405e04943c8 +Subproject commit bf8094f2d8b7f076345c5dc9a97eb495bc57a41e diff --git a/info.yaml b/info.yaml index 98c9ed0..63d2566 100644 --- a/info.yaml +++ b/info.yaml @@ -8,7 +8,7 @@ project: clock_hz: 0 # Clock frequency in Hz (or 0 if not applicable) # How many tiles your design occupies? A single tile is about 167x108 uM. - tiles: "6x2" # Valid values: 1x1, 1x2, 2x2, 3x2, 4x2, 6x2 or 8x2 + tiles: "4x2" # Valid values: 1x1, 1x2, 2x2, 3x2, 4x2, 6x2 or 8x2 # Your top module name must start with "tt_um_". Make it unique by including your github username: top_module: "tt_um_utoss_riscv" From 8091222f5d3db10b8753f4b25ea54b13cb54f45b Mon Sep 17 00:00:00 2001 From: Boris Date: Wed, 4 Mar 2026 14:53:59 +0000 Subject: [PATCH 7/7] bump upstream --- .submodules/utoss-risc-v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.submodules/utoss-risc-v b/.submodules/utoss-risc-v index bf8094f..9ea4b6d 160000 --- a/.submodules/utoss-risc-v +++ b/.submodules/utoss-risc-v @@ -1 +1 @@ -Subproject commit bf8094f2d8b7f076345c5dc9a97eb495bc57a41e +Subproject commit 9ea4b6d045d910915fb76b5d2f0c91fde500acb0