IT 252 Lab 2 – Introduction to Schematic Capture/Simulation with Altera Quartus II Objective: The objective of this lab is to become familiar with the schematic capture and simulation using the Altera Quartus II toolset. Procedures: You are to create two schematics, reg1bit and reg4bit. These schematics are shown on the following page. Reg1bit implements a 1‐bit register, and reg4bit uses four copies of reg1bit to implement a 4‐bit register. Duplicate both the schematics and waveforms shown on the following pages and demonstrate your completed work to the TA. 1‐bit register schematic 1‐bit register timings 4‐bit registers schematic Setting up for New Project: 1. Open Quartus II Web Edition by going to Start, then in the Search box type: Quartus. The top program should be Quartus II 7.2 Web Edition. If it is, hit enter, if not, find it in the Programs search list then click on it. 2. If no screen shows up, click File → New Project Wizard. If a screen shows up, click Create a New Project. Follow the instructions and the screenshots below: a. Click Next on the first screen b. In the second line, enter Lab#, replacing the # with whatever lab it happens to be, the process is the same c. A Quartus II warning might show up. If it does, click No, otherwise ignore this instruction d. Hit Next on this screen e. Select the device: i. First, in the Device Family drop down box, select Cyclone II ii. In the Available devices section, scroll down until you see EP2C20, then slow down and individually go down using the keys to find the model we are going to use, EP2C20F484C7 and then select it iii. Click Next when ready, making sure that you have the right board type and board selected f. This step is very important that you do correctly or any simulation and/or actual programming will not work on the board. Make sure that all of the boxes have none selected as you will not need them g. This is the last page. Review everything and make sure you know which folder your project is saved in so that once you finish, you can copy all your files either to an eternal drive and/or email them to yourself and your partner. Make sure that under Device assignments: it is Cyclone II and EP2C20F484C, under EDA tools: they should all be <None>, and Operating conditions: should have 1.2V and 0-85 °C. If so, hit Finish, and you are ready to continue. Directions for Schematic Capture: 1. Use File New Block Diagram/Schematic File to create a new schematic. 2. Double clicking on white space in the schematic will bring up the dialog box that allows you add new components. Type the names in the search box and it should bring them up, then hit Enter. Once you have that component, click anywhere to place it. Repeat this process until you have one of each of the five components. The component names used in this schematic are AND2, OR2, NOT, BAND2, DFF, INPUT, OUTPUT. You will need a total of 5 input components, 2 and2 components, and then 1 of every other, so either copy and paste or reinsert, but copying and pasting is faster and recommended. 3. Next you will need to add connections, or nets, between the components. For both steps three and four, look at the examples for the 1-bit and 4-bit registers at the beginning. To add a net (connection) between two components, click on the pin and drag to make a connection to another pin on another component, if you can’t make it in one pass, click unclick and then re-click and drag to the next pin spot. 4. To label a pin, double-click on the name and type in text. To label a net, select then Right Click → Properties and add the text. 5. The compile step is necessary before simulating your schematic. Use the File Save Project. Then run the Compiler by selecting Processing > Start Compilation, Ctrl+L, or by clicking on the toolbar icon that looks like a purple triangle. At this point you will have errors, so don’t be too worried, you haven’t done anything yet. 6. If you have multiple schematics open, to compile the current schematic, you must use Save the project current file before using the Compile command sequence as in the previous step. To use the REG1BIT schematic in the REG4BIT schematic, you will need to create a symbol for Reg1bit. Since Quartus II is having problems writing from a schematic, we will first make a VHDL file, then make a symbol table from that file. 7. Use the command File Create/Update → Create HDL Design File from Current File to create the file. Select VHDL then hit OK. When the file is created successfully, close the compilation report and open that VHDL file by going to File → Open, then select the name of the file.vhd (file should be replaced with the same name of the project you are in or whatever you named the file). Next, make sure the file.vhd is selected then select File → Create/Update → Create Symbol Files for Current File. This will make a symbol for you to use in the 4-bit register. At this point, if you are working on the 1-bit register, move to the next section talking about Simulation/Waveforms and then come back here and start on step eight for the 4-bit once passed off with the TA. 8. To do the 4 bit, you need to create a new block diagram by going to File → New → Block Diagram/Schematic File. Now double click the same way you did for 1bit and you should see a new Project subfolder. Expand this folder and double click on that symbol, that is the symbol you created earlier. Copy and paste 3 more of those, these save your project and save this bdf as 4bit. Now you need to make all the connections and a Bus. Use the picture at the beginning as a visual guide. 9. To create a Bus, you can use the Orthogonal Bus Tool in the mini sidebar of the menu to select a wider line style, then click on the 'line' draw symbol along the left hand side before drawing the line. The line style is ONLY for aesthetic purposes only; a bus is identified by its NAME, not its line style. A bus name is NAME[high_index . .0], i.e., DIN[3..0]. You add this label to a net by clicking on the net and typing the text. To label individual nets that make up bits of the bus, select a net and then Right Click → Properties. In the name box, type the name. Do this for all the DIN and DOUT nets. Use the example picture at the beginning as a reference. You can also drag the name towards the center or left so that other lines don’t get in the way and the name is still visible. Directions for Simulation/WaveForm Editing: 1. To create a new waveform window, use File New Other Files → Vector Waveform File 2. To insert a node (a waveform), Right Click → Insert → Insert Node or Bus. In the next screen, click Node Finder. In the Filter dropdown box, select Pins: unassigned, if not already selected, then click list. There should be 6 items that show up: clear_b, clk, din, dout, load, and reset. Hit the >> button, then hit Ok, then Ok again. 3. To set the END TIME of the simulation waveform, make sure the waveform window is selected, then use Edit End Time to set the ending time and set it to 160.0 and choose ns 4. To insert a clock waveform, select the clk signal, RIGHT CLICK, and overwrite with a ‘clock’ by going to Value → Clock. Start time should be 0ns and end time should be 160ns. In the time period area, period should be 20ns and offset should be 0ns. When all this is set, click OK. After setting the clock, deselect at by clicking in white space, then in that same white space Right Click → Zoom → Fit in Window to make it nice and pretty. Save the project. It should look something like the respective example picture at the beginning of this file. 5. You will need to manually change the values of certain components in order to create the correct simulation results. Please do these as close as possible to the example simulations at the beginning of this document. Also please note, unless a whole block of 10ns is going to be changed, you can only change up to 10ns or less per select. To change the value of portion of the waveform, click and drag on the portion of the waveform to change, then Right Click → Value → Count Value. In the Counting tab, set the Start Value to 1. In the timing tab, change the start and end time accordingly, then hit Ok. Repeat this process for every section of every component as seen in the example except for dout, this will be your result after simulation. 6. To execute the simulator, you first need to save the project, save the current file you are in, and then compile the whole project using steps done before. After all three of these steps are done, go to Processing → Start Simulation, hit Ctrl + I, or by hitting the blue play icon with the clock interval underneath it . 7. When the simulation is done, if there are any errors, it will not complete successfully. At this point, look at the message bar at the bottom of the program and see the red text, this will point you to where it says there is an error. Look at it and try to figure it out yourselves. AFTER trying yourselves, if you still cannot fix it, call the TA over to look at it and help you. When after your problem is fixed and the simulation works, or if it works the first time, take a screenshot of the simulation result and one of the Block Diagram you created. You will need a total of 3 screenshots, one for each part. To take a screenshot, you can do either of the following: - Hit F12, hit Start and in the search bar type Paint then select the program, hit Ctrl+v to paste, then crop to just include the diagram or simulation, then save the file by hitting Ctrl+s. Or - Hit Start and in the search box type Snipping Tool then select the program, once open it is ready to go so just click and drag over the area you want to make a screenshot of, once done, save by hitting Ctrl+s. If you accidentally don’t get everything you want or too much, hit New in the upper left and try again. Writeup: Be sure to include in your lab repot: 1. Reglbit Schematic 2. Reg4bit Schematic 3. Waveform of 1 bit Be sure to report on: IN RESULTS 1. What the waveform is used for, and how to understand it. 2. Label all schematics and waveforms with captions 3. Explain what you built and how it relates to a computer. Questions Section: Create and answer 2 questions for this lab: These should be well thought questions. Conclusion: What type of Flip Flops did we use in this lab? What other types of flip‐flops are there, and what are they used for? How do todays computers use registers?