PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/3/1/Register.hdl

http://github.com/happy4crazy/elements_of_computing_systems
Unknown | 34 lines | 30 code | 4 blank | 0 comment | 0 complexity | cc293166622b098b46242b2fcb041b03 MD5 | raw file
 1// This file is part of the materials accompanying the book 
 2// "The Elements of Computing Systems" by Nisan and Schocken, 
 3// MIT Press. Book site: www.idc.ac.il/tecs
 4// File name: projects/03/1/Register.hdl
 5
 6/**
 7 * 16-Bit register. 
 8 * If load[t-1]=1 then out[t] = in[t-1]
 9 * else out does not change (out[t] = out[t-1])
10 */
11
12CHIP Register {
13
14    IN  in[16], load;
15    OUT out[16];
16
17    PARTS:
18    Bit(in=in[0], load=load, out=out[0]);
19    Bit(in=in[1], load=load, out=out[1]);
20    Bit(in=in[2], load=load, out=out[2]);
21    Bit(in=in[3], load=load, out=out[3]);
22    Bit(in=in[4], load=load, out=out[4]);
23    Bit(in=in[5], load=load, out=out[5]);
24    Bit(in=in[6], load=load, out=out[6]);
25    Bit(in=in[7], load=load, out=out[7]);
26    Bit(in=in[8], load=load, out=out[8]);
27    Bit(in=in[9], load=load, out=out[9]);
28    Bit(in=in[10], load=load, out=out[10]);
29    Bit(in=in[11], load=load, out=out[11]);
30    Bit(in=in[12], load=load, out=out[12]);
31    Bit(in=in[13], load=load, out=out[13]);
32    Bit(in=in[14], load=load, out=out[14]);
33    Bit(in=in[15], load=load, out=out[15]);
34}