Skip to content

Commit 5eaf2f0

Browse files
committed
Initial Release
1 parent d8d5c3d commit 5eaf2f0

21 files changed

+629
-22
lines changed

.devcontainer/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM wokwi/builder-clang-wasm
2+
3+
USER root
4+
RUN apk add gcompat libc6-compat
5+
6+
# Install arduino-cli:
7+
RUN wget -O /tmp/cli.tar.gz \
8+
https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz && \
9+
tar -C /usr/local/bin -zxvf /tmp/cli.tar.gz && \
10+
rm /tmp/cli.tar.gz
11+
RUN arduino-cli core update-index && arduino-cli core install arduino:avr

.devcontainer/devcontainer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "Wokwi-chips clang ",
3+
"dockerFile": "Dockerfile",
4+
"customizations": {
5+
"vscode": {
6+
"extensions": [
7+
"Wokwi.wokwi-vscode"
8+
]
9+
}
10+
}
11+
}

.github/workflows/build.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build Chip
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
name: Build
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Check out repository
13+
uses: actions/checkout@v3
14+
- name: Build chip
15+
uses: wokwi/wokwi-chip-clang-action@main
16+
with:
17+
sources: "src/main.c"
18+
- name: Copy chip.json
19+
run: sudo cp chip.json dist
20+
- name: 'Upload Artifacts'
21+
uses: actions/upload-artifact@v3
22+
with:
23+
name: chip
24+
path: |
25+
dist/chip.json
26+
dist/chip.wasm
27+
28+
# The release job only runs when you push a tag starting with "v", e.g. v1.0.0
29+
release:
30+
name: Release
31+
needs: build
32+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Download compiled chip
36+
uses: actions/download-artifact@v3
37+
with:
38+
name: chip
39+
path: chip
40+
- name: Create a zip archive
41+
run: cd chip && zip -9 ../chip.zip chip.*
42+
env:
43+
ZIP_VERSION: ${{ github.ref_name }}
44+
- name: Upload release
45+
uses: ncipollo/release-action@v1
46+
with:
47+
artifacts: chip.zip
48+
token: ${{ secrets.GITHUB_TOKEN }}
49+
generateReleaseNotes: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"wokwi.wokwi-vscode",
4+
"ms-vscode.makefile-tools",
5+
"vsciot-vscode.vscode-arduino"
6+
]
7+
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"makefile.launchConfigurations": [
3+
{
4+
"cwd": "/workspaces/sn54s64/dist",
5+
"binaryPath": "/workspaces/sn54s64/dist/chip.wasm",
6+
"binaryArgs": []
7+
}
8+
]
9+
}

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2024 wokwi-custom-chips
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2022 Uri Shaked
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: © 2022 Uri Shaked <uri@wokwi.com>
2+
# SPDX-License-Identifier: MIT
3+
4+
SOURCES = src/main.c
5+
TARGET = dist/chip.wasm
6+
testFileName = logic
7+
testFolderName = test
8+
9+
.PHONY: all
10+
all: $(TARGET) dist/chip.json ; \
11+
12+
.PHONY: clean
13+
clean:
14+
rm -rf dist ; \
15+
rm -rf $(testFolderName) ; \
16+
17+
18+
dist:
19+
mkdir -p dist
20+
21+
$(TARGET): dist $(SOURCES) src/wokwi-api.h
22+
clang --target=wasm32-unknown-wasi --sysroot /opt/wasi-libc -nostartfiles -Wl,--import-memory -Wl,--export-table -Wl,--no-entry -Werror -o $(TARGET) $(SOURCES)
23+
24+
dist/chip.json: dist chip.json
25+
cp chip.json dist
26+
27+
28+
.PHONY: test
29+
test:
30+
mkdir -p $(testFolderName) ; \
31+
cd test && arduino-cli sketch new $(testFileName) && arduino-cli compile -e -b arduino:avr:uno $(testFileName) ; \

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
# sn54s64
1+
# 4-2-3-2 AND-OR-INVERT Gate
2+
3+
Custom chip for [Wokwi](https://wokwi.com/).
4+
5+
The actual source code for the chip lives in [src/main.c](src/main.c), and the pins are described in [chip.json](chip.json).
6+
7+
## DOCS
8+
Chip functionalities and how to use it are explained in docs .
9+
[Go-to-docs](docs/README.md)
10+
11+
## Building
12+
13+
The easiest way to build the project is to open it inside a Visual Studio Code dev container, and then run the `make` command.
14+
15+
## Testing
16+
17+
You can test this project using the [Wokwi extension for VS Code](https://marketplace.visualstudio.com/items?itemName=wokwi.wokwi-vscode). Open the project with Visual Studio Code, press "F1" and select "Wokwi: Start Simulator".
18+
19+
If you want to make changes to the test project firmware, edit [test/logic/sketch.ino](test/logic/sketch.ino), and then run `make test` to rebuild the .hex file. You'll need the [arduino-cli](https://arduino.github.io/arduino-cli/latest/installation/), which is already installed in the dev container.
20+
21+
## License
22+
23+
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more details.

chip.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "sn54s64",
3+
"docs": "https://github.com/wokwi-custom-chips/sn5454/blob/main/docs/README.md",
4+
"author": "algovoid",
5+
"pins": [
6+
"A",
7+
"E",
8+
"F",
9+
"G",
10+
"H",
11+
"I",
12+
"GND",
13+
"Y",
14+
"J",
15+
"K",
16+
"B",
17+
"C",
18+
"D",
19+
"VCC"
20+
],
21+
"controls": []
22+
}

0 commit comments

Comments
 (0)