Skip to content

Commit eb1b261

Browse files
committed
update files
1 parent ad5c811 commit eb1b261

24 files changed

+652
-7
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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "Wokwi-chips clang ",
3+
"dockerFile": "Dockerfile",
4+
"customizations": {
5+
"vscode": {
6+
"extensions": [
7+
"Wokwi.wokwi-vscode",
8+
"ms-vscode.makefile-tools"
9+
]
10+
}
11+
}
12+
}

.github/workflows/build.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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@v4
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+
release:
29+
name: Release
30+
needs: build
31+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Download compiled chip
35+
uses: actions/download-artifact@v3
36+
with:
37+
name: chip
38+
path: chip
39+
- name: Create a zip archive
40+
run: cd chip && zip -9 ../chip.zip chip.*
41+
env:
42+
ZIP_VERSION: ${{ github.ref_name }}
43+
- name: Upload release
44+
uses: ncipollo/release-action@v1
45+
with:
46+
artifacts: chip.zip
47+
token: ${{ secrets.GITHUB_TOKEN }}
48+
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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"wokwi.wokwi-vscode"
4+
]
5+
}

.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/cd74act00/dist",
5+
"binaryPath": "/workspaces/cd74act00/dist/chip.wasm",
6+
"binaryArgs": []
7+
}
8+
]
9+
}

LICENSE

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
The MIT License (MIT)
22

3-
Copyright (c) 2024 wokwi-custom-chips
3+
Copyright (c) 2022 Uri Shaked
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
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.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
.PHONY: all
8+
all: $(TARGET) dist/chip.json
9+
10+
.PHONY: clean
11+
clean:
12+
rm -rf dist
13+
14+
dist:
15+
mkdir -p dist
16+
17+
$(TARGET): dist $(SOURCES) src/wokwi-api.h
18+
clang --target=wasm32-unknown-wasi --sysroot /opt/wasi-libc -nostartfiles -Wl,--import-memory -Wl,--export-table -Wl,--no-entry -Werror -o $(TARGET) $(SOURCES)
19+
20+
dist/chip.json: dist chip.json
21+
cp chip.json dist
22+
23+
24+
.PHONY: test
25+
test:
26+
cd test && arduino-cli sketch new $(testFileName) && arduino-cli compile -e -b arduino:avr:uno $(testFileName)
27+
28+
29+

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
# cd74act00
1+
2+
# CD74ACT00
3+
4+
## QUAD 2-INPUT POSITIVE-NAND GATES Custom Chip for Wokwi
5+
6+
Custom chip that emulates the cd74act00 IC for [Wokwi](https://wokwi.com/).
7+
8+
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).
9+
10+
## chip functionalities explained in DOCS
11+
12+
[docs](docs/README.md)
13+
14+
## Building
15+
16+
The easiest way to build the project is to open it inside a Visual Studio Code dev container, and then run the `make` command.
17+
18+
## Testing
19+
20+
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".
21+
22+
If you want to make changes to the test project firmware, edit [test/logic/logic.ino](test/update/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.
23+
24+
25+
## License
26+
27+
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more details.

cd74act00.zip

12.1 KB
Binary file not shown.

chip.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"version": 1,
3+
"license": "MIT",
4+
"docs": "https://github.com/wokwi/inverter-chip/blob/main/docs/README.md",
5+
"name": "cd74act00",
6+
"author": "Algovoid",
7+
"pins": [
8+
9+
"1A",
10+
"1B",
11+
"1Y",
12+
"2A",
13+
"2B",
14+
"2Y",
15+
"GND",
16+
"3Y",
17+
"3A",
18+
"3B",
19+
"4Y",
20+
"4A",
21+
"4B",
22+
"VCC"
23+
],
24+
"controls" :[]
25+
}

diagram.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"version": 1,
3+
"author": "Gojap",
4+
"editor": "wokwi",
5+
"parts": [
6+
{ "type": "chip-cd74act00", "id": "chip1", "top": -18.18, "left": 206.4, "attrs": {} },
7+
{
8+
"type": "wokwi-led",
9+
"id": "led1",
10+
"top": -99.6,
11+
"left": 90.2,
12+
"attrs": { "color": "blue" }
13+
},
14+
{
15+
"type": "wokwi-led",
16+
"id": "led2",
17+
"top": 34.8,
18+
"left": 90.2,
19+
"attrs": { "color": "yellow" }
20+
},
21+
{
22+
"type": "wokwi-dip-switch-8",
23+
"id": "sw1",
24+
"top": -32.5,
25+
"left": -56.1,
26+
"rotate": 90,
27+
"attrs": {}
28+
},
29+
{
30+
"type": "wokwi-led",
31+
"id": "led3",
32+
"top": 25.2,
33+
"left": 378.6,
34+
"attrs": { "color": "cyan", "flip": "1" }
35+
},
36+
{
37+
"type": "wokwi-led",
38+
"id": "led4",
39+
"top": -70.8,
40+
"left": 378.6,
41+
"attrs": { "color": "magenta", "flip": "1" }
42+
},
43+
{ "type": "wokwi-vcc", "id": "vcc2", "top": -162.44, "left": 153.6, "attrs": {} },
44+
{ "type": "wokwi-gnd", "id": "gnd1", "top": 134.4, "left": 201, "attrs": {} }
45+
],
46+
"connections": [
47+
[ "led2:A", "chip1:2Y", "green", [ "v0", "h76.8", "v-38.4" ] ],
48+
[ "led1:A", "chip1:1Y", "green", [ "v0", "h67.2", "v67.2" ] ],
49+
[ "sw1:1b", "chip1:1A", "green", [ "h0" ] ],
50+
[ "chip1:1B", "sw1:2b", "green", [ "h-19.2", "v-28.8" ] ],
51+
[ "sw1:1a", "sw1:2a", "red", [ "h-38.4", "v9.6" ] ],
52+
[ "sw1:2a", "sw1:3a", "red", [ "h-38.4", "v9.6" ] ],
53+
[ "sw1:4a", "sw1:3a", "red", [ "h-38.4", "v-9.6" ] ],
54+
[ "sw1:5a", "sw1:4a", "red", [ "h-38.4", "v-9.6" ] ],
55+
[ "sw1:8a", "sw1:7a", "red", [ "h-38.4", "v-9.6" ] ],
56+
[ "sw1:6a", "sw1:5a", "red", [ "h-38.4", "v-9.6" ] ],
57+
[ "sw1:7a", "sw1:6a", "red", [ "h-38.4", "v-9.6" ] ],
58+
[ "chip1:GND", "led2:C", "black", [ "h0", "v48", "h-105.6" ] ],
59+
[ "sw1:3b", "chip1:2A", "green", [ "h162.9", "v38.4" ] ],
60+
[ "chip1:2B", "sw1:4b", "green", [ "h-48", "v-38.4" ] ],
61+
[ "chip1:3A", "sw1:5b", "green", [ "h21.01", "v28.8", "h-182.4", "v-67.2" ] ],
62+
[ "sw1:6b", "chip1:3B", "green", [ "h134.1", "v57.6", "h201.6", "v-38.4" ] ],
63+
[ "sw1:7b", "chip1:4A", "green", [ "h124.5", "v67.2", "h230.4", "v-76.8" ] ],
64+
[ "sw1:8b", "chip1:4B", "green", [ "v0", "h124.5", "v57.6", "h240", "v-86.4" ] ],
65+
[ "chip1:4Y", "led4:A", "green", [ "h78.61" ] ],
66+
[ "chip1:3Y", "led3:A", "green", [ "v28.8", "h78.61" ] ],
67+
[ "led2:C", "led1:C", "green", [ "v0", "h-18.8", "v-134.4" ] ],
68+
[ "led4:C", "led3:C", "green", [ "v0", "h18.8", "v96" ] ],
69+
[ "led3:C", "led2:C", "green", [ "v38.4", "h-192.4" ] ],
70+
[ "vcc2:VCC", "chip1:VCC", "red", [ "v0", "h144" ] ],
71+
[ "vcc2:VCC", "sw1:1a", "red", [ "v0", "h-201.6" ] ],
72+
[ "gnd1:GND", "chip1:GND", "black", [ "v0" ] ]
73+
],
74+
"dependencies": {}
75+
}

docs/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Wokwi CD74ACT00 Chip
2+
3+
This is a custom chip for [Wokwi](https://wokwi.com/). It implements the CD74ACT00 IC.
4+
5+
## Description
6+
7+
The ‘ACT00 devices contain four independent 2-input NAND gates. Each gate performs the Boolean function
8+
of Y = NOT(A . B) or Y = NOT(A) + NOT(B) in positive logic.
9+
10+
## Truth Table
11+
| INPUTS | OUTPUT |
12+
| ------ | ------- |
13+
| A | B | Y |
14+
| ---------- | ------- |
15+
| H | H | L |
16+
| L | X | H |
17+
| X | L | H |
18+
19+
## Pin names
20+
21+
| Name | Description |
22+
| ---- | ------------------------ |
23+
| 1A | Gate 1 Input signal A |
24+
| 1B | Gate 1 Input signal B |
25+
| 2Y | Gate 1 Output signal |
26+
| 2A | Gate 2 Input signal A |
27+
| 2B | Gate 2 Input signal B |
28+
| 2Y | Gate 2 Output signal |
29+
| 3A | Gate 3 Input signal A |
30+
| 3B | Gate 3 Input signal B |
31+
| 3Y | Gate 3 Output signal |
32+
| 4A | Gate 3 Input signal A |
33+
| 4B | Gate 4 Input signal B |
34+
| 4Y | Gate 4 Output signal |
35+
| GND | Ground |
36+
| VCC | Supply voltage |
37+
38+
39+
## Usage
40+
41+
To use this chip in your project, include it as a dependency in your `diagram.json` file:
42+
43+
```json
44+
"dependencies": {
45+
"chip-cd74act00": "github:wokwi/cd74act00@0.1.0"
46+
}
47+
```
48+
49+
Then, add the chip to your circuit by adding a `chip-cd74act00` item to the `parts` section of diagram.json:
50+
51+
```json
52+
"parts": {
53+
...,
54+
{ "type": "chip-cd74act00", "id": "chip1" }
55+
},
56+
```
57+
58+
For a complete example, see [the inverter chip test project](https://wokwi.com/projects/398879430719023105).

sn74ahct1g32.zip

11.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)