Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Lab 9: Combinatorial Circuits - https://artofcomputing.cecs.anu.edu.au/2015 Toggle Navigation The Art of Computing about schedule signup! news labs contact student FAQ Lab 9: Combinatorial Circuits In this lab, you will use the Logisim tool, along with pen and paper, to analyse and create simple combinatorial circuits. Installing and Starting Logisim Unlike Snap!, Logisim does not run in a web browser but needs to be installed. It is not installed on the CSIT lab computers, so to use it, you will have to install it on your own computer or on your student account. Download the Logisim v. 2.7.1 JAR file and save it in a convenient location (e.g., your home directory). You will probably be able to start the program by simply (double-)clicking on the JAR file. If that doesn’t work, on a GNU/Linux system you can start a commandline (“terminal”) and type in java -jar logisim-generic-2.7.1.jar (assuming you are in the directory where the file is). Note that Logisim requires Java version 5 or later. Exercise 9.1 First, do the following simple exercise to familiarise yourself a bit with the Logisim environment. Download the file lab9ex1.circ (using “save link as”), then open the file in Logisim (select “Open…” under the “File” menu). If everything worked, you should now see a simple combinatorial circuit. What does this circuit do? It computes some function Output = F(A, B, C) where all three inputs and the output are binary (0 or 1). But what is the function F? To find out, you can: a. Figure it out by looking at the circuit. b. Select the “poke” tool ( ), click on the inputs A, B and C to change their value, and observe how the output changes. c. From the “Project” menu, select “Analyze Circuit”. This opens a window with information about the circuit. Under “Table” you can find the complete truth table for the circuit, and under “Expression” you can see the equivalent Boolean expression. (Note that Logisim does not have a symbol for logical AND in expressions: “x AND y” is written just “x y”. The symbol for logical OR is “+” and for NOT is “~“.) Make sure you try the first two methods before the last. Is there a simpler/smaller circuit that computes the same function? Using the truth table for the circuit, draw the Karnaugh diagram and find the smallest sum-of-products expression that you can. Build the circuit corresponding to your expression next to the one given (using the same inputs, but a new output) and test it to see that it gives the same result. (Again, Logisim offers you a way to cheat: The “Minimized” tab of the circuit analysis window will give you a minimal expression, and can even rebuild the circuit automatically for you. Use this to check what you came up with by hand.) Exercise 9.2 You need to build a full adder, but you’re short on parts: The only things you can use are 1 half-adder, one 2-input AND gate, one 2-input OR gate, 1 2-input XOR gate and 1 2-input NAND gate. Can you still build the circuit that you need? Download the file lab9ex2.circ and open it in Logisim. The project contains a half-adder circuit, and the main circuit is set up with pins for the inputs and outputs. You need to add the extra gates and wires to produce the two outputs of the full adder. Remember that the truth tables for the half-adder and full adder are on Pascal’s slides (from Wednesday). How to build circuits in Logisim The project file you just opened contains two circuits, named “main” and “HalfAdder”. To see how the half-adder is implemented, double-click on it. (Then double-click on “main” to get back to the main circuit.) To add a gate to the circuit, select the gate you want from the menu on the left. (The gates you are allowed to use for this exercise are all found under “Gates”. Shortcuts for some of them can also be found in the toolbar at the top.) Then just click on the circuit board to add the gate. When you have selected the edit tool ( ) you can move components and add wires. Right-click and select “Delete” to remove a component or wire. To connect components, add or extend wires. Components have a small marker where they can connect (you will see a small green circle when the pointer is on the mark). You can also add a branch off an existing wire, at any point. Here is a short video showing how it is done. (Note: The circuit built in the video is not the correct solution to this exercise!) Test and save your circuit! After you have built a circuit, you can check that it does the right thing by either using the poke tool to vary the inputs, or using Logisim’s built-in circuit analyzer, which will show you the truth table for both outputs. Save your circuit in a new file (using “Save As…” from the File menu). This is one of the files you will need to submit for this assignment. Exercise 9.3 Remember binary arithmetic? Download the file lab9ex3.circ and open it in Logisim. The file contains a simple circuit that feeds four binary inputs (named X0 .. X3) into a hexadecimal (base 16) display. Use the poke tool to change the input values and see how the display changes. The conventional way to display a single-digit hexadecimal numbers is to use the decimal digits “0” to “9” for numbers 0-9 and the letters “A” to “F” for numbers 10-15. Make sure you understand how the input bits make a number. Now, you must modify this display so that it only shows decimal numbers. More precisely, if the input number is less than or equal to 9, the display should show it as normal. If the number is 10 or greater, the display should show an “E” (for “Error”). Luckily, we can make it show an “E” by setting its input to 14 (1110 in binary). You have to delete the existing wires to build your new circuit. First, design a circuit that determines if the input number is less than 10. Do this using only standard gates (AND, OR, NOT, etc). Logisim’s component library also contains predefined arithmetic components (such as a numeric comparator), but using them would be cheating. Next, use your “>10?” to control what gets shown on the display. Two component types that you may find useful for this are the multiplexer component (which you can find under “Plexers” in the component library), and the constant (which is under “Wiring”). When you add a multiplexer, you should change the “Include Enable?” attribute to “No”. Component attributes are shown and edited in the lower left part of the screen. This is also where you edit the value of a constant. Logisim has wires of different “width”. So far, you have only used 1-bit wires. The splitter component ( ) is used to combine four 1-bit wires into a single 4-bit wire, which is what the hex display component needs as input. Many of Logisim’s predefined components can be configured to have inputs/outputs of different widths. This is done by changing their attributes. For example, you can create a multiplexer with a 4-bit data input, 1-bit selection input, and, consequently, two 4-bit data outputs. Test and save your circuit! After you have built a circuit, check that works by varying the inputs. (The circuit analyzer tool does not work, because the display is not recognised as an “output”.) Save your circuit in a new file (using “Save As…” from the File menu). This is the second file that you will need to submit for this assignment. Submission: You must submit two Logisim circuit files, containing your solutions to exercises 9.2 and 9.3. Submit both files through wattle. 7 May, 2015 1285 words Written by Pascal Van Hentenryck Lexing Xie Patrik Haslum Tags labs Quick links 2015 S1 lecture schedule: Tue 2-3 CSIT N101 Wed 2-3 CSIT N101 Thu 12-1 ENG T Note: The Thu 12-1 lecture slot is used in _some weeks_. × Quick-access class pointers: This will be updated to incldue links, such as the EdX teaching system. © The Art of Computing Team Built with Hugo