Skip to content

Zaneham/qsim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

qsim

A quantum circuit accelerator. On classical silicon. Because irony is a valid design methodology.

What Is This

An 8-qubit quantum circuit simulator implemented as a hardware accelerator on SkyWater SKY130 130nm CMOS. Evaluates quantum gates at one gate per clock cycle. Synthesised using an EDA synthesiser I made that I've had sitting on my hard drive.

This is not a quantum computer. This is a chip that SIMULATES quantum circuits at hardware speed, which is approximately 1000× faster than Qiskit running on Python on an x86 pretending it understands superposition.

Gates 238
Area 1,699 µm²
Timing Met at 200 MHz
Qubits 8 (basis-state tracking)
Gate set X, Z, H, CNOT, SWAP, Toffoli, Measure, Prepare
Randomness 16-bit LFSR (for Hadamard superposition)

How It Works

Quantum circuits are sequences of gate operations on qubits. Each gate has a simple truth table on basis states — CNOT flips the target if the control is 1, Toffoli flips if both controls are 1, X is just NOT. These are combinational logic. They're fast in hardware.

The tricky bit is Hadamard, which creates superposition. In a full quantum simulator you'd track complex amplitudes (2^n of them). In qsim, we track basis states and flag qubits that have been superposed. When you measure a superposed qubit, an LFSR gives you a random result. Statistically correct over many runs. Exactly how a real quantum computer works, minus the liquid helium.

Gate Set

Gate Qubits What it does Classical equivalent
X 1 Bit flip NOT
Z 1 Phase flip (no classical equivalent)
H 1 Superposition (definitely no classical equivalent)
CNOT 2 Controlled NOT XOR
SWAP 2 Exchange Wire crossing
Toffoli 3 Double-controlled NOT AND + XOR
Measure 1 Collapse superposition Read a bit (but spookier)
Prepare 1 Reset to |0⟩ Clear a bit

Example: Bell Pair

// Create a Bell pair (maximally entangled state)
// H on qubit 0, then CNOT(0→1)

16'h3000    // H  qubit 0     — enter superposition
16'h4200    // CNOT ctrl=0, tgt=1  — entangle
16'h7000    // MEAS qubit 0   — collapse
16'h7200    // MEAS qubit 1   — correlated!

Four instructions. Two qubits. One entangled pair. Zero liquid helium.

What It's Not

This is not:

  • A quantum computer (needs actual quantum hardware for that)
  • A universal quantum simulator (8 qubits, basis-state tracking only)
  • A replacement for Qiskit (which handles arbitrary circuits on cloud QPUs)

This IS:

  • A hardware accelerator for small quantum circuit simulation
  • A teaching tool for quantum gate operations
  • A proof that quantum gates are just truth tables and truth tables are just silicon
  • 238 gates that evaluate Toffoli at 200 MHz

Why

Because why not? Quantum seems to be the hip thing all the kids are doing these days.

Support New Zealand STEM Education

The Wonder Project gets Kiwi kids excited about science, technology, engineering and maths. It's free for schools, reaches 34% Māori and Pacific students and 49% girls, and just lost 93% of its government funding. If this project is useful to you, consider helping keep the wonder alive.

I never benefited from this specific charity, but I remember programmes like it growing up. A volunteer showing up with a robot and saying "wanna see how this works?" is the reason I'm designing chips today. Every kid deserves that moment.

Keep the Wonder Alive

License

Apache 2.0.

About

Quantum circuit accelerator on classical silicon. 8 qubits, 238 gates, 200MHz. Because irony is a valid design methodology.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors