Memory

Memory in NSL is a register with depth. It works on the rising edge of master clock (m_clock), but value can be refered without clock (asyncronous read).

Example-NS15

declare NS15 { input in[4],adr[8]; output f[4]; func_in write(); func_in read(); } module NS15 { mem m[256][4]; func write { m[adr] := in; } func read { f=m[adr]; } }



We will make a simulation on this circuitry as following command:

# ./exe NS15



The result will be available on your console.



adr: 1, in: 8, f: x, read:0, write:1 adr: 2, in:11, f: x, read:1, write:0 adr: 3, in: 8, f: 9, read:0, write:1 adr: 0, in:11, f: x, read:1, write:0 adr: 1, in:14, f: 4, read:0, write:1 adr: 2, in:12, f: x, read:1, write:0 adr: 3, in: 1, f: 9, read:0, write:1 adr: 0, in: 1, f: x, read:1, write:0 adr: 1, in: 8, f: 4, read:1, write:0 adr: 2, in: 6, f:14, read:1, write:0 adr: 3, in: 2, f: 9, read:0, write:1 adr: 0, in: 3, f: x, read:1, write:0 adr: 1, in: 2, f: 4, read:1, write:0 adr: 2, in: 9, f:14, read:0, write:1 adr: 3, in: 1, f: x, read:1, write:0



PREV UP NEXT