您的位置:首页 > 理论基础

《计算机系统要素》学习笔记:第三章时序逻辑

2017-01-21 14:11 465 查看
1.学习要点

1)本章内容基础知识属于数字电路的时序逻辑电路部分,和部分计算机组成原理的内容。

2)触发器相关的基础知识,如内部结构,时钟等,在书中被忽略,需要单独学习

3)本章内容以D触发器为基本元件,其他元件的构造都基于它。

4)设计计算机时钟时,时钟周期的长度要比1个比特在计算机两个物理距离最长的芯片之间的传输时间稍长。

5)RAM芯片,注意结合计算机组成的知识,理解对应的地址线,数据线,控制线三部分。

6)PC(程序计数器机)是一个CPU的核心部件,与计算机的流水线(取指—译码—执行)结构有关,第四章的理解重点之一。

2.代码实现

(1)1比特位寄存器

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)寄存器(16-bit)

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计数器

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);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: