Skip to main content

Audit-friendly simulated CPU toolkit for logic, data-flow, and quantum-build checks

Project description

Simulated CPU Quantum Build Audit Toolkit

This project is packaged as an installable Python program named wifi-cpu. It now acts as an audit toolkit for simulated CPU builds, with a focus on logic flow, data flow, and audit checks for claimed quantum-style builds.

Project site: https://fitzyracing1.github.io/mars-suit-communication-ai-cpu-sim/

What it does

It gives people a small simulated CPU they can install from pip and use to test:

  • logic flow between instructions
  • data flow through registers, memory, ports, and output
  • custom programs loaded from text files
  • audit specifications that verify a build against expected CPU behavior
  • a Wi-Fi call demo path for the original concept

Install as a program

From the project root:

python3 -m pip install -e .

This installs a command-line program:

wifi-cpu --demo

You can also install test dependencies:

python3 -m pip install -e '.[test]'

Example usage

Run the built-in demo:

wifi-cpu --demo

Run the Wi-Fi call path:

wifi-cpu +14155550123

Run a custom program file:

wifi-cpu --program-file examples/data_flow.cpu

Run an audit spec:

wifi-cpu --audit-file examples/quantum_build_audit.json

Use it from Python:

from wifi_cpu import SimulatedCPU

program = """
LOAD R1 5
LOAD R2 8
ADD R1 R2 R3
EMIT R3
HALT
"""

cpu = SimulatedCPU()
cpu.load_program(program)
result = cpu.run_with_state()
print(result.trace)
print(result.state.output)

Instruction set

  • LOAD <register> <value>
  • MOVE <source_register> <target_register>
  • ADD <left_register> <right_register> <target_register>
  • SUB <left_register> <right_register> <target_register>
  • STORE <register> <memory_key>
  • READ <memory_key> <register>
  • SEND <register> <port_name>
  • RECV <port_name> <register>
  • EMIT <register>
  • CALL_WIFI <number>
  • HALT

Audit spec format

Audit files are JSON documents that declare a target build, a simulator, a program, and the expected observed behavior.

{
  "name": "Quantum Uplink Build",
  "target": "uplink-audit",
  "simulator": "wifi_cpu",
  "program": [
    "LOAD R1 5",
    "LOAD R2 8",
    "ADD R1 R2 R3",
    "EMIT R3",
    "HALT"
  ],
  "expectations": {
    "halted": true,
    "output": [13],
    "registers": {"R3": 13},
    "trace_contains": ["EMIT R3"]
  }
}

If an audit expectation does not match the simulated CPU result, the CLI exits with a failing status and lists the findings.

Testing

Run the tests:

pytest

Build distributable files:

python3 -m pip install '.[build]'
python3 -m build

The built wheel and source tarball will be created in dist/.

Publishing

Build locally:

python3 -m build

Upload manually with Twine:

python3 -m pip install twine
python3 -m twine upload dist/*

Or use the GitHub Actions workflow in .github/workflows/publish-pypi.yml with PyPI Trusted Publishing after configuring the project on PyPI.

Project structure

  • pyproject.toml: package metadata and CLI entry point
  • src/wifi_cpu/simulator.py: simulator core
  • src/wifi_cpu/audit.py: audit model and report generation
  • src/wifi_cpu/cli.py: command-line interface
  • tests/test_simulator.py: package tests
  • tests/test_audit.py: audit tests
  • examples/data_flow.cpu: sample custom program
  • examples/quantum_build_audit.json: sample audit spec
  • cpu_simulator.py: compatibility launcher
  • index.html: GitHub Pages landing page
  • robots.txt and sitemap.xml: crawler metadata

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wifi_cpu-0.2.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wifi_cpu-0.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file wifi_cpu-0.2.0.tar.gz.

File metadata

  • Download URL: wifi_cpu-0.2.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for wifi_cpu-0.2.0.tar.gz
Algorithm Hash digest
SHA256 38a89f76f57783dc0a87cd3f13cad8ce6cee6048f017edb89a2e4a96e367e134
MD5 c47aabd888672528cc8036ba78680abd
BLAKE2b-256 ff20fb62cf79fc4f435caeffa458402fff4dcee1e8136ed2898d5d0acbd7b737

See more details on using hashes here.

File details

Details for the file wifi_cpu-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: wifi_cpu-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for wifi_cpu-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41bfd97cc4c5fb7aa0754b120909c209fcd50bb7f18443d598ec1bdaf9627aca
MD5 ef822c4f0c91717a6c753158a5286144
BLAKE2b-256 9c353e3e96176d5c89cf1ca1b059843bf2aa1005ad19eae55d3f3508e073cb4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page