/***************************** memory.lib *****************************/ component { in read, write, init, address[ m ], opd[ n ] } memoryArray( name, x, y, base, m, n ) { out result[ n ] } begin path selection[ 1 << m ]; path readSelect[ 1 << m ]; path writeSelect[ 1 << m ]; path resultSelect[ ( 1 << m ) * n ]; { in address } decode( m ) { out selection }; for i from 0 upto 1 << m do { in read selection[ i ] } and( 2 ) { out readSelect[ i ] }; { in write selection[ i ] } and( 2 ) { out writeSelect[ i ] }; { in readSelect[ i ], writeSelect[ i ], init, set, opd } memory( name & " " & i, x, y + 50 * i, 16, n, 0 ) { out result }; end end