标签:bit 距离 reset als and reg 比特 else int
1 本章介绍时钟和触发器,构建记忆单元。触发器是具有记忆功能的最小记忆单元,能够存储一个bit位。
2 设计计算机时钟时,时钟周期的长度要比1个比特在计算机两个物理距离最长的芯片之间的传输时间稍长。
3 D触发器
4 寄存器
1) 1比特位寄存器
/**
* 1-bit register:
* If load[t] == 1 then out[t+1] = in[t]
* else out does not change (out[t+1] = out[t])
*/
CHIP Bit {
IN in, load;
OUT out;
PARTS:
Mux(a=out1,b=in,sel=load,out=out2);
DFF(in=out2,out=out1);
And(a=out1,b=true,out=out);
}
2) Register
/**
* 16-bit register:
* If load[t] == 1 then out[t+1] = in[t]
* else out does not change
*/
CHIP Register {
IN in[16], load;
OUT out[16];
PARTS:
Bit(in=in[0],load=load,out=out[0]);
Bit(in=in[1],load=load,out=out[1]);
Bit(in=in[2],load=load,out=out[2]);
Bit(in=in[3],load=load,out=out[3]);
Bit(in=in[4],load=load,out=out[4]);
Bit(in=in[5],load=load,out=out[5]);
Bit(in=in[6],load=load,out=out[6]);
Bit(in=in[7],load=load,out=out[7]);
Bit(in=in[8],load=load,out=out[8]);
Bit(in=in[9],load=load,out=out[9]);
Bit(in=in[10],load=load,out=out[10]);
Bit(in=in[11],load=load,out=out[11]);
Bit(in=in[12],load=load,out=out[12]);
Bit(in=in[13],load=load,out=out[13]);
Bit(in=in[14],load=load,out=out[14]);
Bit(in=in[15],load=load,out=out[15]);
}
3) RAM8
CHIP RAM8 {
IN in[16], load, address[3];
OUT out[16];
PARTS:
DMux8Way(in=load,sel=address,a=a1,b=b1,c=c1,d=d1,e=e1,f=f1,g=g1,h=h1);
Register(in=in,load=a1,out=out1);
Register(in=in,load=b1,out=out2);
Register(in=in,load=c1,out=out3);
Register(in=in,load=d1,out=out4);
Register(in=in,load=e1,out=out5);
Register(in=in,load=f1,out=out6);
Register(in=in,load=g1,out=out7);
Register(in=in,load=h1,out=out8);
Mux8Way16(a=out1,b=out2,c=out3,d=out4,e=out5,f=out6,g=out7,h=out8,sel=address,out=out);
}
4) RAM64
CHIP RAM64 {
IN in[16], load, address[6];
OUT out[16];
PARTS:
DMux8Way(in=load,sel=address[3..5],a=a1,b=b1,c=c1,d=d1,e=e1,f=f1,g=g1,h=h1);
RAM8(in=in,load=a1,address=address[0..2],out=out1);
RAM8(in=in,load=b1,address=address[0..2],out=out2);
RAM8(in=in,load=c1,address=address[0..2],out=out3);
RAM8(in=in,load=d1,address=address[0..2],out=out4);
RAM8(in=in,load=e1,address=address[0..2],out=out5);
RAM8(in=in,load=f1,address=address[0..2],out=out6);
RAM8(in=in,load=g1,address=address[0..2],out=out7);
RAM8(in=in,load=h1,address=address[0..2],out=out8);
Mux8Way16(a=out1,b=out2,c=out3,d=out4,e=out5,f=out6,g=out7,h=out8,sel=address[3..5],out=out);
}
5) PC计数器
/**
* A 16-bit counter with load and reset control bits.
* if (reset[t] == 1) out[t+1] = 0
* else if (load[t] == 1) out[t+1] = in[t]
* else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition)
* else out[t+1] = out[t]
*/
CHIP PC {
IN in[16],load,inc,reset;
OUT out[16];
PARTS:
Mux16(a=back,b=in,sel=load,out=in1);
Mux16(a=in1,b=false,sel=reset,out=in2);
Register(in=in2,load=true,out=out1);
And16(a=out1,b=true,out=out);
Inc16(in=out1,out=out2);
Mux16(a=out1,b=out2,sel=inc,out=back);
}
标签:bit 距离 reset als and reg 比特 else int
原文地址:http://www.cnblogs.com/way19/p/5995146.html