TAMS / Java / Hades / applets: contents | previous | next | ||||
Hades Applets contents visual index introduction std_logic_1164 gatelevel circuits delay models flipflops adders and arithm... counters LFSR and selftest memories programmable logic state-machine editor misc. demos I/O and displays DCF-77 clock relays (switch-le... CMOS circuits (sw... RTLIB logic RTLIB registers Prima processor PRIMA processor sequencer control unit PRIMA inc/dec PRIMA factorial D*CORE MicroJava Pic16 cosimulation Mips R3000 cosimu... Intel MCS4 (i4004) image processing ... [Sch04] Codeumsetzer [Sch04] Addierer [Sch04] Flipflops [Sch04] Schaltwerke [Sch04] RALU, Min... [Fer05] State-Mac... [Fer05] PIC16F84/... [Fer05] Miscellan... [Fer05] Femtojava FreeTTS | PRIMA processor (increment/decrement loop)
Circuit Description
Another demonstration of the PRIMA processor
with the following program:
# simple PRIMA program to demonstrate external (SW) input. # The program initializes the variable count (at RAM location 24) # then enters a loop to increment / decrement the count variable # depending on the current value of the input switch SW. # # .program 0 14 # LD 0 akku = 0 1 0 # dummy 2 72 # ST 24 count = 0 3 24 # # .loop 4 145 # BSW sw == 1 ? 5 14 # # .decrement 6 09 # LD 24 akku = count 7 24 # 8 12 # SB1 akku = akku - 1 9 0 # 10 72 # ST 24 count = akku 11 24 # 12 128 # BR 4 goto loop 13 4 # # .increment 14 09 # LD 24 15 24 # 16 10 # AD1 17 0 # 18 72 # ST 19 24 # 20 128 # BR 21 4 # # # .data 24 0 # Variable c # .endDepending on the external input switch, the variable at memory address 24 (or 0x18) is incremented or decremented. The program loop, which starts at address 4, uses the BSW (branch-if-switch) instruction to read the external switch input and jumps to address 14 if the switch is set. Otherwise, the program continues at address 6, reads the counter variable from the memory, decrements it, and stores it back. The corresponding part of the loop starting at address 14 increments the counter variable. Open the memory editor window (popup-menu, edit-component) to watch the execution of the program. You might also want to change the clock frequency to speed-up the execution a bit. Note: to keep the schematics as simple as possible, this applet again uses the simplified datapath with 8-bit ALU and 8-bit accumulator register. Also, neither the accumulator output nor the carry-out output from the ALU are connected to the control unit. This does no harm, because the above program only uses the BSW (branch-if-switch) instruction, but none of the arithmetic comparison instructions.
| |||
Print version | Run this demo in the Hades editor (via Java WebStart) | ||||
Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German) | ||||
Impressum | http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/50-rtlib/90-prima/prima-loop.html |