logisim实验-逻辑电路实习题目

上传人:hao****an 文档编号:163673259 上传时间:2022-10-22 格式:DOC 页数:14 大小:173.01KB
收藏 版权申诉 举报 下载
logisim实验-逻辑电路实习题目_第1页
第1页 / 共14页
logisim实验-逻辑电路实习题目_第2页
第2页 / 共14页
logisim实验-逻辑电路实习题目_第3页
第3页 / 共14页
资源描述:

《logisim实验-逻辑电路实习题目》由会员分享,可在线阅读,更多相关《logisim实验-逻辑电路实习题目(14页珍藏版)》请在装配图网上搜索。

1、Logisim实验中国地质大学信息工程学院2010-3-26修订历史记录日期版本号修改说明修改人核准人2009-4-2初稿陈亮2009-4-20增加fsm部分陈亮2010-4-27修改fsm部分陈亮2011-3-26补充部分中文缺失的地方,增加中文翻译陈亮2011-3-31补充子电路和分解器的说明陈亮2012-10-21删减部分实验(触发器)陈亮2013-9-21修改部分ALU的内容(不自己做这个部件)陈亮目 录1熟悉环境41.1基本功能:41.2练习二(ToolBar主要功能)41.3练习子电路51.4练习分解器Splitter51.5练习(传说中的选择器啊)51.6练习61.7练习61.8

2、练习62FSM62.1基础:根据真值表设计电路62.2看电路,分析功能72.3看功能,分析电路(分析伯克利实验八的第一个实验的电路)82.4伯克利实验十的Part (A): Advanced Logisim的Exercise A.1: Storing State83ALU114CPU(2次实验课,伯克利prj3)111 熟悉环境学习使用logisim,熟悉基本功能。1.1 基本功能: 学会使用toolbar上的功能。 学会增加子电路,并能够将子电路放到main电路中或者其他电路中使用 学会使用时钟 学会使用splitter,理解带宽的含义。这部分需要实现一个8位带宽的输入,其中2位输入到一个与

3、门,中间3位输入到一个3输入的或门,剩下三位输入到其他已有的门电路。1.2 练习二(ToolBar主要功能)我们将通过创建一个非常简单的电路来感受一下如何放置门和电线。1、 首先,单击“AND gate” 按钮。这时鼠标附近会出现一个与门的图标,在主电路图窗口任意位置单击鼠标以放置与门。2、 单击“Input Pin” 按钮。在你的与门左侧放置两个输入(input pin)。3、 单击“Onput Pin” 按钮。在你的与门右侧放置一个输出(output pin)。这时你的电路图看上去可能如下图所示:4、 单击“Wire tool”按钮。单击并拖动它,以便将输入端和与门的左边相连。如果你只画垂

4、直电线和水平电线的话,这一步可以分成几步。首先画一条水平电线,放开鼠标,单击并拖动电线的末端画一条垂直电线。你可以把电线连接到与门左边的任意一条腿上。重复这一过程,把与门的输出和LED相连。这时你的电路图看上去可能如下图所示:5、 最后,单击“Poke”按钮,试着单击电路图中的输入,看看会发生什么。这和你想象中的与门的功能相符么?1.3 练习子电路正如C程序可以包含帮助函数一样,一个电路图中也可以含有子电路。在这部分中,我们会创建几个子电路,并示范一下他们的使用。1、 新建一个电路图(FileNew)。2、 新建一个子电路(ProjectAdd Circuit),并命名为NAND。3、 在新电

5、路图窗口中,你可以看见你刚创建的含有两个输入一个输出NAND电路。4、 在屏幕左侧电路选择板中双击“main”以返回主电路图。这时,最初的空白电路图会显示出来,而NAND电路图则被保存。5、 单击列表中的“NAND”,告诉Logisim你想吧“NAND”电路添加到主电路中。6、 试着把“NAND”电路放到主电路图中。如果你正确地做到了,你会看到一个左边含两个输入右边含一个输出的门。试着把输入输出相连,看看它是否和想象中一样工作。7、 重复这些步骤,创建其他几个子电路:NOR,XOR,2 to 1 MUX,和 4 to 1 MUX。除了AND,OR和NOT外,不要使用其他内置门。但是,一旦你创建

6、了一个子电路,你可以使用它来创建其他电路。提示:不熟练者可以查看讲义学习如何创建。你可能需要使用一些你定制的电路来设计其他电路。1.4 练习分解器Splitter它是你这次课上需要使用的最基本的工具之一。为了示范如何使用它,你需要创建一个当最高有效位和最低有效位为1时输出1的电路。1、 创建一个名为“Exer2”的子电路。2、 在该电路中添加一个8位输入。3、 在该电路中添加一个1位输入。4、 选择“Splitter”电路,这个电路可以将一根电线分解成几根小电线。5、 在放置“Splitter”电路前,将“Bit Width In”属性改为8,“Fan Out”属性改为3。这时如果将鼠标移到电

7、路图上,光标看上去就像6、 现在,选择哪些位输出到输入的哪一部分。最低有效位为第0位,最高有效位为第7位。改变第1、2、6位输出到输入1。或者,选择“None”,使得第1、2、6位不输出到任一个输入。7、 配置完分解器后就可以把它放置在电路中。再添加一个与门,该电路就完成了。1.5 选择器(可不做)实现一个二路的复用器的子电路。问题:如果信号是一位,而备选的两个输入时32bit,电路怎么做?1.6 练习锁存器(可不做)实现如上子电路。1.7 练习触发器(可不做)实现一个一位的触发器,注意要用时钟。用logisim的时钟实验一下结果,看看Q是否存储值。用这个子电路实现一个32位的寄存器。1.8

8、练习(可不做)实现一个3-8译码器。2 FSM2.1 基础:根据真值表设计电路上课时,你只是看到了真值表。在这次实验中,通过Logisim,你有足够的工具来实现真值表。假定真值表如下图所示,完成以下任务。in1in0|out1out000|0101|1010|1111|001、 从上面的真值表中推导出out1和out0的规范的SOP布尔表达式。2、 根据布尔代数中的公式简化布尔表达式(看讲义或者google来复习这部分内容)。得到最简式后,你可以检查一下该等式是否满足众所周知的那些门的模式。3、 在Logisim的主电路图中实现该最简式。可以随意使用你之前设计的那些子电路。务必使用“Text”

9、 工具来注记你的输入输出。选择“Text” 工具工具,在电路图上单击,并输入文本即可。如果输错了,你可以通过selection 工具来选中文本对象,编辑位于属性电路浏览器下侧的属性列表中的“Text”属性。2.2 看电路,分析功能下面的FSM电路,假设初始状态Register 1 =1; register 2=0 理解下面fsm的功能,绘出波形图(参考ppt) 写出前5个周期两个寄存器的值2.3 看功能,分析电路(分析伯克利实验八的第一个实验的电路, 可不做)Consider the design of a finite state machine (FSM) with two 1-bit i

10、nputs (clk and CE), and one 2-bit output (X). clk is the clock signal and CE is the count enable signal. While CE=1, the FSM behaves as a binary counter, i.e. its output cycles through the pattern 00, 01, 10 11, 00, moving from one output value to the next on each positive edge of clk. If CE = 0 the

11、 output value remains unchanged.Note that FSM has no reset input signal. You can assume that it starts up in any legal state.Sketch the state transition diagram that represents the behavior of this FSM in the style of the lecture notes.考虑设计一个FSM,有2个1位的输入(clk和CE),还有一个2位的输出(X)。clk是时钟信号,CE是“计数使能”信号。当CE

12、=1的时候,FSM的行为就是一个二进制计数器,它的输出一直就是按照00,01,10,11,00状态进行变化,在每个上升沿时钟将状态转换到下一状态。当CE=0的时候,输出值不变。注意FSM没有复位信号,你可以以任何合法的状态开始。根据上面描述,绘制状态转移图分析FSM,并考虑一下实现的问题(只考虑,不实现)。2.4 伯克利实验十的Part (A): Advanced Logisim的Exercise A.1: Storing State(可以不做)以下是网络上下载的A.1Lets implement the circuit you worked on in Lab 8. The differen

13、ce between this circuit and the circuits youve built for lab so far is that you need some registers. The following will show you how to add registers to your circuit. 我们现在开始考虑实现2.1和2.2中的那个FSM,这2个电路和我们以前实现的电路最大的区别在于现在我们需要用到寄存器。(即现在的电路不再是单纯的组合逻辑电路)。下面的提示可以告诉你如何在自己的电路中使用软件内置的寄存器。1. Create a new subcirc

14、uit (Project-Add Circuit). Name this new subcircuit, Fib8. 创建一个新的子电路,假设名字叫fib82. Load in the Arithmetic Library (Go to Project-Load Library-Built in Library and select Arithmetic). This library contains elements that will perform basic mathematical operations. When you load a library, the circuit br

15、owser at left will have a new Arithmetic folder. 菜单“Project”-“Load Library”-“Built In Library”,选择“Arithmetic”,这个库包含一些基本的算术操作电路。当你load一个库的时候,左边的电路列表就会显示出一个“Arithmetic”文件夹。其他的你自己试试看?3. Select the adder subcircuit from the Arithmetic library and place the adder into your Fib8 subcircuit选择Arithmetic中的一个

16、加法器子电路.,将它放在Fib8电路中4. Load in the Memory Library (Go to Project-Load Library-Built in Library and select Memory). This library contains memory elements used to keep state in a circuit. A new Memory folder will appear in the circuit browser. 按照上面类似的方法加载“Memory”库,这个库包含一些存储电路。加载成功后,你在左边列表中会看到“Memory”文件

17、夹。5. Select the register from the Memory folder and place two registers into your subcircuit. Below is an image diagraming the parts of a register. 从“Memory”库中选择寄存器,增加两个寄存器到我们的子电路中来。寄存器应该是下面这个样子。注意reset和时钟很近,别弄混了。6. Connect a clock to your register. You can find the clock circuit element in the Base

18、 folder in the circuit browser. 为寄存器连接上时钟。时钟电路在“base”节点下寻找,你懂的。7. Connect the two registers and adder together based on the diagram in Lab 8. 两个寄存器和加法器连接起来,实现2.1和2.2的电路。You may notice that when you connect the adder to a register, you will get a Incompatible widths error. This means that your wire i

19、s trying to connect two pins together with different bit widths. If you click on one the adder with the Selection tool, you will notice that in the box below circuit browser will have a field called Data Bit Width. This field controls the number of bits the the adder will add. Change this field to 8

20、 and the Incompatible widths error should now go away. In general, the box below the circuit browser will list the properties of a given circuit element. Other circuit elements will have other properties. 你可能已经注意到当你连接加法器到寄存器的时候,可能遇到“Incompatible widths”错误(请回顾试验1的1.1的)。在logisim软件中,连线两端的带宽必须是相同的8. Add

21、 three output pins to your circuit so that you may monitor what comes out of the adder and both registers. Thus, by the end, your circuit should look like as follows: 增加三个输出到你的电路,检测加法器和寄存器的值。最后,你的电路可能做成如下这个样子(这是2.2的电路)Now lets see if you built your circuit correctly. 好,我们现在可以测试一下你的电路是否正确。如果正确,你也可以来实

22、现以下2.2的FSM的电路。电路有了时钟后,大家是不是不知道如何测试了呢?下面这段步骤,是告诉你如何使用你的子电路,并用软件功能模拟时钟,来检测电路实现的,大家自己看看。1. Go back to the main subcircuit by double clicking on main in the circuit browser. 2. Change the Facing property to another direction. Any circuit with the Facing property can be rotated to accomodate wires as you

23、 need them. This will definately be useful when you do your project. 3. Place your Fib8 subcircuit into the main subcircuit. 4. Select the Fib8 subcircuit you just placed into main. 5. Connect output pins to the Fib8 subcircuit. Output pins are ordered top to bottom, left to right. Thus, if you foll

24、owed the schematic above, then the top pin on the right side outputs the value one of the top register, the middle pin is the output of adder, and the bottom pin is the output of the bottom register. 6. Right click on your Fib8 subcircuit, and select View Fib8. This is the ONLY method to preserving

25、state. Double-clicking on the circuit at the circuit browser at left makes logisim think you want to edit the circuit instead of just checking what state the circuit has. Note: You can use Simulate-Go In To State-*Circuit Name*, but that allows you go into the first circuit of that type. If you plac

26、ed two Fib8 circuits down, it only takes you to the first Fib8 circuit to put down. 7. Initialize the register values to 1. You can do this by first, click on the register value with the poke tool. Then, type the hex value in. 8. To return to the main circuit while preserving state, go to Simulate-G

27、o Out To State-main. Alternatively, you can hold Control key and press Up-Arrow. 9. Now start running your circuit by going to Simulate-Ticks Enabled. Your circuit should now be outputting the fibonachi numbers in binary form. 10. If you want to run your circuit faster, you can change the tick frequ

28、ency in Simulate-Tick Frequency. 3 ALU实现hw5对应的8位ALU,可以不实现溢出。注意参考附录B中相关章节。要求实现加、减、或,判等 四种操作。说明:为了支持第四部分的内容,仅仅要求实现add、sub、or,要求能够支持equal信号输出4 CPU(2次实验课,伯克利prj3)为了考虑大家体力有限,我们不实现32位的CPU。(也可以参考http:/inst.eecs.berkeley.edu/cs61c/sp11/projects/04/)实现prj3对应的8位CPU。这是体力活和脑力活的结合体,体会一下一个能够自动绘制电路软件的必要性吧:)指令设计如下:

29、一共支持7个指令:lw,sw,add,sub,ori,beq,jmp留给寄存器的位数只有1位,所以只有2个通用寄存器不支持移位操作。I类型指令中立即数位数为3,J类型指令地址5位具体指令编码如下指令OpcodeRsRtRdFunc76543210Add00000Sub00001指令OpcodeRsRtIMM/AddrOri001Lw010Sw011Beq100指令OpcodeTarget AddrJmp1011、 设计2个8位寄存器的寄存器堆2、 支持add、sub、or的ALU(可以先用现成的组件,而不自己实现;当然自己实现是最好的)3、 扩展器(3位的立即数扩展到8位),两种扩展方式4、

30、PC的两种特殊扩展方式5、 Ram的试用试验Logisim RAM modules can be found in the built-in memory library.Because the RAM module doesnt look like the idealized memory we saw in lecture, you may feel confused about where to begin. The picture above shows a good way to wire up a circuit to use RAM. Here are a few things

31、to know before you get started. sel determines whether or not the RAM module is active. We will probably not run into any cases where we need to turn our RAM off, so you can wire a constant 1 to this. A chooses which address will be accessed. The clock input provides synchronization for memory write

32、s. Be sure to use the same clock here as you do for your reg file. ld determines whether we are reading or writing to memory. If out is high, then D will be driven with the contents of memory at address A. clr will instantly set all contents of memory to 0 if high. You should wire a manual switch so

33、 you can clear out memory whenever you want to restart a test. D acts as both data in and data out for this module. This means you have to be careful not to drive this line from two conflicting sources, which in this case are DataIn and the output of the memory. You can solve this by using a control

34、led buffer (aka a tri-state buffer) on the D port of the RAM module. By wiring logic to the out port and the valve port of the controlled buffer together so that they are always opposite values (as in the picture above), we can prevent conflicts between data being driven in and the contents of memor

35、y coming out. The poke tool can be used to modify the contents of the memory. You can also use right-click - Load Image. to load an image from a file. 6、 控制电路Func0001We dont careOpcode000000001010011100101AddSubOriLwSwBeqJmpRegDst1(rd)10(rt)0XXXnPCsel000001XRegW1111000MemW0000100MemToReg0001XXXALUSr

36、c001110XExtOpXX011XXALUCtl1001000XALUCtl0010001XALUCtlAddSubOrAddAddSubXJump0000001Rtype = opcode2 . opcode1. opcode0Add = rtype . func1 . func0Sub = rtype . func1. Func0Ori = op2.op1. op0lw = op2.op1.op0beq = op2.op1op0jmp = op2.op1.op0RegDst = add + subnPCsel = beqRegW = add + sub + ori + lwMemW = swMemToReg = lwALUSrc = Ori + lw + swALUCtl1 = oriALUCtl0 = sub + beqJump = jmp7、 连接各个部件

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!