This is the source code for the Assembler and Simulator for the P4 educational CPU.
You can see the online version here: https://dinismadeira.github.io/p4/
- Open the
index.html
file on a web browser.
- Install NW.js.
- Put the source code inside a
package.nw
folder. - Run the
nw
executable.
- Put the source code in a directory served by your HTTP server.
- Open the URL for your HTTP server on a web browser.
There's a Minified Web Version Creation Tool in Node.js that allows you to create a minified web version that will load faster.
In order to create a minified version run node web.js
. A web
folder containing the minified version will be created.
You can create a .p4z
zip file with the program and data memory initialization files for P4 from assembly source files using the Command Line Assembler for P4 in Node.js.
- Install packages:
npm install
- Assemble:
node p4as.js INPUT_FILE.as
Where INPUT_FILE.as
is the name of the P4 assembly source file.
You can set a custom output file by appending the option: -o OUTPUT_FILE
where OUTPUT_FILE
is the output file.
To show references append the option --show-refs
.
You can create NW.js executables for several operating systems using the nwjs-builder-phoenix Node.js module.
- Install packages:
npm install
- Create executables:
./node_modules/.bin/build --tasks win-x64,mac-x64,linux-x64,linux-x86,win-x86
.