Arduino Custom IC with Verilog Behaviour: Wiring, Code and Simulator
To build this Arduino Custom IC with Verilog Behaviour project you need an Arduino Uno and a generic IC (DIP), a yellow LED and a 220 Ω resistor. A Generic IC named MY-XOR, with pins you named yourself and one line of Verilog as its behaviour. The Uno steps its inputs and prints the truth table it measures. Make the 7 connections in the wiring table, upload the Arduino C++ code, and select the chip and change its behaviour to assign Y = A & B; (or ~(A | B)), then Run again: the printed truth table changes with your hardware.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | Generic IC (DIP) | Make your own part: set its name, number of pins and pin names (comma-separated) in the inspector. Give it behaviour in Verilog using those pin names (assign OUT = A & B;) and it simulates; a pin named only by its number is P1, P2… in the code. Without behaviour it is drawn and wired only. |
| 1 | yellow LED | Lights when A (anode, the bent leg) is high and C (cathode) is low. Use a resistor. |
| 1 | 220 Ω resistor | Limits current. 220 Ω in series with an LED; 10 kΩ as a pull-up or pull-down. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno pin 2 | Generic IC (DIP) A |
| 2 | Arduino Uno pin 3 | Generic IC (DIP) B |
| 3 | Arduino Uno pin 4 | Generic IC (DIP) Y |
| 4 | Arduino Uno GND | Generic IC (DIP) GND |
| 5 | Generic IC (DIP) Y | yellow LED anode (A, long leg) |
| 6 | yellow LED cathode (C, short leg) | 220 Ω resistor leg 1 |
| 7 | Arduino Uno GND | 220 Ω resistor leg 2 |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add a generic IC (DIP), a yellow LED and a 220 Ω resistor from the parts palette.
- Wire 1. Connect Arduino Uno pin 2 to Generic IC (DIP) A.
- Wire 2. Connect Arduino Uno pin 3 to Generic IC (DIP) B.
- Wire 3. Connect Arduino Uno pin 4 to Generic IC (DIP) Y.
- Wire 4. Connect Arduino Uno GND to Generic IC (DIP) GND.
- Wire 5. Connect Generic IC (DIP) Y to yellow LED anode (A, long leg).
- Wire 6. Connect yellow LED cathode (C, short leg) to 220 Ω resistor leg 1.
- Wire 7. Connect Arduino Uno GND to 220 Ω resistor leg 2.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Select the chip and change its behaviour to assign Y = A & B; (or ~(A | B)), then Run again: the printed truth table changes with your hardware.
Arduino C++ code
// Your own chip: a Generic IC whose behaviour is a line of Verilog.
// The Uno steps A and B (pins 2, 3) through 00, 01, 10, 11 and reads the
// chip's Y output back on pin 4, printing the truth table it measures.
const int A = 2, B = 3, Y = 4;
void setup() {
Serial.begin(9600);
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(Y, INPUT);
Serial.println("A B | Y");
}
void loop() {
for (int n = 0; n < 4; n++) {
int a = (n >> 1) & 1, b = n & 1;
digitalWrite(A, a);
digitalWrite(B, b);
delay(5);
Serial.print(a); Serial.print(' '); Serial.print(b);
Serial.print(" | "); Serial.println(digitalRead(Y));
delay(700);
}
Serial.println("-----");
}
What to try
Select the chip and change its behaviour to assign Y = A & B; (or ~(A | B)), then Run again: the printed truth table changes with your hardware.
Frequently asked questions
How do I wire the Custom IC with Verilog Behaviour project on an Arduino Uno?
Make 7 connections: Arduino Uno pin 2 to Generic IC (DIP) A; Arduino Uno pin 3 to Generic IC (DIP) B; Arduino Uno pin 4 to Generic IC (DIP) Y; Arduino Uno GND to Generic IC (DIP) GND; Generic IC (DIP) Y to yellow LED anode (A, long leg); yellow LED cathode (C, short leg) to 220 Ω resistor leg 1; Arduino Uno GND to 220 Ω resistor leg 2.
What parts do I need for this Arduino project?
An Arduino Uno and a generic IC (DIP), a yellow LED and a 220 Ω resistor.
Can I simulate this Arduino project online for free?
Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.
What does the code do?
A Generic IC named MY-XOR, with pins you named yourself and one line of Verilog as its behaviour. The Uno steps its inputs and prints the truth table it measures.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator