Simulation of a von neumann arcitecture
The core of this version is at https://github.com/Laubersheini/johnny to be found. This version contains a lot additional and useful features besides bugfixes.
This edited version can be viewed at https://tobisma.github.io/johnny
1.3
is understood as 01.003
which would be TAKE 003
)Number | Corresponding button |
---|---|
0 | no instruction |
1 | db --> ram |
2 | ram --> db |
3 | db --> ins |
4 | ins --> ab |
5 | ins --> mc |
6 | none |
7 | mc:=0 |
8 | pc --> ab |
9 | pc++ |
10 | =0?pc++ |
11 | ins --> pc |
12 | acc:=0 |
13 | plus |
14 | minus |
15 | acc --> db |
16 | acc++ |
17 | acc-- |
18 | db --> acc |
19 | stop |
To get the menu for editing you need to make a click on the entry in the micro code table. Then, an prompt pops up asking for a number or a button. The numbers are the micro code instrcution numbers listed in the table above. When clicking on the input field a list with possible optinos will show.
The buttons are text input. They are parsed by checking the start of the input and the end.
You can either just type out the full button like db --> ram
or continue reading to understand how to shorten your buttons. The numbers are the shortest way, but also the most complicated. As always, there are exceptions. Those are listed at the end.
Buttons are built using the following operators and destinations:
Destination | Component |
---|---|
ram |
RAM |
db |
Data Bus |
mc |
micro code |
ins |
instruction register |
pc |
program counter |
acc |
accumulator |
Operators are always used after an Destination
Operator | Meaning |
---|---|
+ |
increase the destination by one if such an button exists (e. g. pc+ for pc++ ) |
- |
same as the + -operator but for decreasing |
0 |
reset the destination to zero (e. g. acc0 means acc:=0 ) |
just type the first destination (the starting point) followed by the second destination. For example, dbram
would translate to db --> ram
or insab
would translate to ins --> ab
. As mentioned in the beginning typing db --> ram
works fine as well, because it still starts with db
and ends with ram
.
Examples: acc-
, pc+
, mc0
acc-
and pc+
just mean acc++
and pc++
. It is just an character shorter
mc0
is a bit more complicated but button inputs ending on 0
mean to reset the destination. So, mc0
refers to mc:=0
and acc0
would be acc:=0
.
Input | Corresponding button | Example inputs, which are valid for the button |
---|---|---|
plus |
plus |
|
minus |
minus |
|
^sub |
minus |
subtract |
stop |
stop |
|
^= $+ |
=0?pc++ |
=0?+ , =+ , =0?pc+ |
^
prepended to a code block signals that the input needs to start with this code block$
prepended to a code block signals that the input needs to end on that code block
For example
^'ram' $'db'
describes that the input needs to start withram
and needs to end withdb
. This input corresponds to the buttonram --> db
Actions on RAM which are possible from micro code, as well (e. g. save) are with perssing ⇧ Shift additionally.
Key | Action | Key meaining & Notes |
---|---|---|
E | Reset & Execute Program | Execute |
R | Reset | Reset |
S | Execute one macro step | Step |
P | Pause execution | Pause |
⇧ Shift S | Execute one micro step | Step |
↑ | Move one up in RAM | |
↓ | Move one down in RAM | |
K | Move one up in RAM | Vim keybinding |
J | Move one down in RAM | Vim keybinding |
U | Toggle control unit view | Unit |
+ | Make execution faster | |
- | Make execution slower | |
Alt C | Clear Ram | Clear |
⌥ Option C | Clear RAM | Clear |
Alt ⇧ Shift C | Reset micro code | Clear |
⌥ Option ⇧ Shift C | Reset micro code | Clear |
: | Enter command mode for buttons | Vim keybinding |
v | Enter command mode for buttons | Vim |
D | Focus Data bus input | Data Bus |
A | Focus Address bus input | Address Bus |
W | Focus RAM row input | Write (to RAM) |
Insert | Insert row above current selected row in RAM | Insert |
⇧ Shift Del | Remove current selected row in RAM | Delete |
⇧ Shift A | Focus the address input for custom macro codes | Address (and Shift because microcode) |
⇧ Shift N | Focus the name input for custom micro codes | Name (and Shift because microcode) |
⇧ Shift Q | record a microcode | as in vim macros (you are recording a macrocode after all xD) |
⇧ Shift Enter | record a microcode | works only in the input fields for address and name of a custom makrocode. Exists because ⇧ ShiftQ will be disabled |
Del | Remove current selected row in RAM | Delete (disabled per default; change in settings) |
⌃ Ctrl O | Opening RAM file from disk | Open |
⌃ Ctrl ⇧ Shift O | Opening micro code file from disk | Open |
⌃ Ctrl S | Saving current RAM to file | Save |
⌃ Ctrl ⇧ Shift S | Saving current micro code to file | Save |
ram --> db
Those shortcuts are in VIM style meaning you need to enter command mode first by pressing :(VIM keybinding) or V (added by this website). Afterwards you type the commmand from the list below. Then press ⏎ Enter to emulate pressing the button. While in command mode you can press Esc or ^ Ctrl C to leave command mode. While in command mode all basic shortcuts above are disabled. The visual feedback is in command mode in the bottom left corner.
Command | Button | Meaning & Notes |
---|---|---|
a |
ManuellAb |
|
a+ |
acc++ |
|
a++ |
acc++ |
|
a- |
acc-- |
|
a-- |
acc-- |
|
a0 |
acc:=0 |
|
ar |
acc:=0 |
|
i |
Insert Row |
Inserts always above selection (like in vim before the cursor) |
dr |
db --> ram |
|
rd |
ram --> db |
|
d |
ManuellDb |
|
da |
db --> acc |
|
p |
plus |
plus |
s |
minus |
subtract |
ad |
acc --> db |
|
di |
db --> ins |
NOTE: they are also working when the control unit is not visible
Command | Button | Meaning |
---|---|---|
im |
ins --> mc |
|
ip |
ins --> pc |
|
ia |
ins --> ab |
|
pa |
pc --> ab |
|
p+ |
pc++ |
|
p++ |
pc++ |
|
=0 |
=0?pc++ |
|
m0 |
mc:=0 |
|
stop |
stop |
|
h |
stop |
HALT program |
Command | Button |
---|---|
lr |
Load RAM |
lm |
Load microcode |
sr |
Save RAM |
sm |
Save microcode |
cr |
Clear Ram |
cm |
Clear microcode |
rec |
Record micro code |
cnf |
Open settings |
They are made of "operators" (and similar to the buttons read when editing micro instructions):
Operator | Meaning(s) | Type |
---|---|---|
a |
Accumulator , Address Bus |
Destination |
d |
Data Bus |
Destination |
r |
Ram |
Destination |
p |
Program counter |
Destination |
i |
Instruction Register |
Destination |
m |
Micro code |
Location |
l |
Load |
Action |
s |
Save |
Action |
c |
Clear |
Action |
By putting them together buttons like ram --> db
are represented as rd
with the meaning from r
(ram) to d
(data bus).
Adding +
or -
causes counting buttons to be triggered. For example p+
means to add to the program counter. An alias would be p++
. Just for the case someone types two +
. In a context like a+
the a
stands for Accumulator
instead of Address Bus
because there are no counting buttons for the address bus.
I recommend to use Firefox (continue reading for the reason).
This website works on Firefox and chromium based browsers (Edge, Chrome, ...). Not listed browsers have not been tested which does not mean they are not compatible.
NOTE: If the dataset gets larger the time to update the RAM rows becomes longer. But it has been fixed, so that chromium base browser only need ~500ms instead of 3.5sec
npm install
npx
is globally accessable, otherwise edit either package.json to match your requirements or install npxnpm run package-win
and for linux run npm run package-linux
. This will create a folder in executables
for the windows or linux executable version. Beware, that it overwrites this folder, should this folder already exist and it is always for the x64
arcitecture. To change that behaviour, edit the package.json
fileJohnny.exe
to start the app