Skip to content

fdcastel/ArchSims

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

109 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArchSims

Simulators for use in computer architecture classes.

Overview

This project is a clean room implementation of the hypothetical machines used in computer architecture classes at the Institute of Informatics of Universidade Federal do Rio Grande do Sul.

The goal is to faithfully recreate the instruction set architecture of each machine. Every implementation is backed by an extensive test suite and follows the original specifications provided by professors Raul Fernando Weber and Taisy Silva Weber.

The four machines form a progression of increasing complexity:

Machine Width Highlights Manual
Neander 8-bit Baseline: single accumulator, one addressing mode, N/Z flags doc/Neander.md
Ahmes 8-bit Adds SUB, shifts, rotates, C/V/B flags, extended conditional jumps doc/Ahmes.md
Ramses 8-bit Multiple registers (RA/RB/RX), four addressing modes, JSR doc/Ramses.md
Cesar 16-bit Eight registers, eight addressing modes, stack, memory-mapped I/O doc/Cesar.md

Each manual documents the programmer's model, instruction set, execution cycle, and UI design suggestions.

Content

This repository contains two complete implementations: the original F# core plus an in-browser TypeScript port with skeuomorphic front-panel UIs.

F# core (fs/)

  • Core implementations for Neander, Ahmes, Ramses, and Cesar (fs/ArchSims.Core)
  • Assemblers for Ramses and Cesar (fs/ArchSims.Assemblers)
    • Neander and Ahmes ship without an assembler (by design)
  • A Ramses emulator for Cesar (it was a cold and rainy day...)
  • Thorough test cases (fs/ArchSims.Core.Tests)
    • An adapter to test the Ramses emulator with the same test cases used for Ramses
  • A command-line utility for simple demos (fs/ArchSims.CmdLine)

Web UI & TypeScript port (web/)

  • Framework-free TypeScript port of the F# core (web/src/core/)
  • TypeScript ports of the Ramses and Cesar assemblers (web/src/assemblers/)
  • Skeuomorphic Svelte front panels for each machine (web/src/ui/)
  • Bundled sample programs loadable from each panel's Service drawer (web/src/samples/)
  • Vitest parity suite mirroring the F# NUnit tests (web/tests/)
  • Static-site output (Astro) — no server, no backend

Roadmap and task status for the web port live in doc/WEB_UI_PLAN.md.

Running the F# simulators

Prerequisites

Both are cross-platform, so the project and its samples run on Windows, macOS, and Linux.

Run the tests

dotnet test

Run the samples

Run the .ps1 scripts from the Samples folder:

pwsh Samples/Demo-Ramses.ps1
pwsh Samples/Demo-Cesar.ps1
pwsh Samples/Demo-Cesar-Debug.ps1

Running the web UI locally

Prerequisites

Install, test, develop

From the repository root:

pnpm -C web install        # install dependencies (first run only)
pnpm -C web test            # run the Vitest parity suite
pnpm -C web test:e2e        # run the Playwright browser suite
pnpm -C web check           # astro check + tsc --noEmit
pnpm -C web dev             # start the dev server at http://localhost:4321
pnpm -C web build           # produce a static site in web/dist/
pnpm -C web preview         # serve the built site locally
pnpm -C web perf            # assert the per-page transfer budget
pnpm -C web og              # regenerate the Open Graph share cards

The dev server auto-opens the landing page with machine cards; each card links to its front panel (/neander, /ahmes, /ramses, /cesar) and its manual (/manuals/<name>). Every panel exposes a Service drawer (right-edge button) with palette, base, density, sample-loader, and .mem image save/load controls.

Deploying your own copy

The site is fully static — pnpm -C web build emits web/dist/, which drops straight onto any static host. No adapter, no server, no database.

Set SITE_URL to your own origin when you build. It is what canonical links and Open Graph share-card URLs are built from, and social scrapers ignore relative image paths:

SITE_URL=https://example.com pnpm -C web build

It deliberately has no production default, so a fork never advertises somebody else's domain in its share cards. Unset, it falls back to a harmless placeholder.

web/wrangler.jsonc packages web/dist/ as a Cloudflare Workers static-assets bundle if you want to host it there — pnpm -C web build && npx wrangler@4 deploy from web/. It names no domain and carries no credentials; point it at your own account and attach whatever hostname you like. Any other static host works just as well.

Share cards are generated from the real front panels rather than drawn by hand, so if you restyle the chassis just re-run pnpm -C web og and the images follow.

License

MIT — free to fork, modify, and use in your own courses.

The simulated architectures themselves are the work of professors Raul Fernando Weber and Taisy Silva Weber at UFRGS; this is an independent clean-room implementation of their published specifications, not a derivative of any original source.

Special thanks

  • Prof. Raul Fernando Weber (in memoriam)

About

Simulators for use in computer architecture classes.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages