A very simple webtoy to visualize pipeline hazards https://peace.uber.space/hazardtoy
Find a file
peacememories 8401fc7a00
All checks were successful
Build the website / build (push) Successful in 25s
Build the website / deploy (push) Successful in 2s
fix: Fixed the base path.
2025-09-14 02:52:36 +00:00
.devcontainer tooling: Added dev container. 2025-09-14 02:16:12 +00:00
.forgejo/workflows ci: Fixed a typo. 2025-09-14 02:50:34 +00:00
.gitignore Initial commit 2021-06-29 03:07:59 +02:00
index.html chore: Ported hazardtoy to newer build tools. 2025-09-14 02:46:35 +00:00
main.css chore: Ported hazardtoy to newer build tools. 2025-09-14 02:46:35 +00:00
main.js chore: Ported hazardtoy to newer build tools. 2025-09-14 02:46:35 +00:00
package-lock.json chore: Ported hazardtoy to newer build tools. 2025-09-14 02:46:35 +00:00
package.json fix: Fixed the base path. 2025-09-14 02:52:36 +00:00
README.md Added readme 2021-06-29 03:37:33 +02:00
registerUpdate.js chore: Ported hazardtoy to newer build tools. 2025-09-14 02:46:35 +00:00
vite.config.ts chore: Ported hazardtoy to newer build tools. 2025-09-14 02:46:35 +00:00
whole_svg.svg chore: Ported hazardtoy to newer build tools. 2025-09-14 02:46:35 +00:00

Hazardtoy

Hazardtoy is a small webtoy meant to demonstrate how pipeline hazards work.

It shows data-hazards like read-after write as well as branch hazards.

Allowed Instructions

To keep the code to a minimum because i am lazy, the "cpu" only supports four different instructions:

  • nop does nothing
  • j <address> jumps unconditionally to an absolute address
  • addi <destination> <source> <immediate> adds an immediate value (a number) to register <source> and stores the result in <destination>
  • add <destination> <source1> <source2> like addi but adding two registers

Registers

The cpu supports 6 registers which are normal javascript numbers.

Building

Hazardtoy is based on Parcel, tailwindcss, and Alpine.js

To start a development server, run:

npm install
npm start

To build for production:

npm ci
npm run build