sourcelibs/Clocked/demos/ram.xtl
1⍝!/usr/bin/env xetal
2⍝ A RAM of eight 8-bit words driven by five commands (write-enable,
3⍝ address, data), one per clock; a disabled write changes nothing and a
4⍝ later write wins. The memory's contents at the end, and after every
5⍝ clock. Run with "just demo-lib Clocked ram".
6ᶜᵏ⁼u̲se< "Clocked"
7cmds ← 5 3 r̲eshape 1 0 11 1 7 77 0 3 99 1 0 12 1 4 200
8mem ← 8 r̲eshape 0
9mem 'ᶜᵏw̲rite ᶜᵏr̲un cmds
10mem 'ᶜᵏw̲rite ᶜᵏt̲race cmds