Tutorial for Verilog Synthesis Lab (Part 1)



Tutorial for Verilog Synthesis Lab (Part 1)In this lab, you will be required to write Verilog code for a serial signed-numbers multiplier, then simulate and synthesize it. Later you will do place and route, then tape out. It is assumed that you have very good knowledge of Verilog as prerequisite for this lab. You are required to write your own Verilog code for the lab itself. The sample Verilog code discussed in this tutorial is not the actual code required to complete the lab. The sample code is to familiarize yourself with tools you will be required to use to complete the lab.Synthesis is the process of converting a high-level description of design (Verilog/VHDL) into an optimized gate-level representation. Logic synthesis uses a standard cell library which have simple cells, such as basic logic gates like AND, OR, and NOR, or macro cells, such as adder, muxes, memory, and flip-flops. A set of standard cells put together is called a technology library. Normally the technology library is known by the transistor size (eg. 0.18um).Usually, a circuit description is written in a Hardware Description Language (HDL), such as Verilog. There are different topologies that can be applied for the same design. There are different approaches for designing a large system. One of the approaches is bottom up, i.e. start with the smallest module of the system and individually test them using test benches to make sure proper operation before integrating them into higher level modules. For example, in this part of the tutorial, we will build a 3-bit decoder and simulate it. After proper operation is verified, we can create modules that will use this decoder, and so on.We will place all files for this lab in a folder such as “elec4708/lab2”Open a console and create a folder named “lab2” inside your elec4708 folder (created previously).>cd elec4708>mkdir lab2>cd lab2Start Cadence.>startCds –t cmosp18 –b icfbOpen Library Manager and create a library named “lab2”. Attach to the “cmosp18” technology file. (See tutorial for lab 1 part A for more details.)Create a cell view named “decoder” inside lab2. Select Tool as Verilog-Editor and viewname as “verilog”. This will open a Verilog Editor as shown in the next figure. If you do not see it, double click on view->verilog (while lab2->decoder is highlighted.)If you are familiar with “vi” editor, type the following code for a 3 bit decoder. If you are not comfortable with “vi” and prefer any other editor in Unix, open that application, open the Verilog file (should be located in elec4708/lab2/lab2/decoder/verilog/verilog.v).module decoder (sel, res); input [2:0] sel; output [7:0] res; reg [7:0] res; always @(sel or res) begin case (sel) 3'b000 : res = 8'b00000001; 3'b001 : res = 8'b00000010; 3'b010 : res = 8'b00000100; 3'b011 : res = 8'b00001000; 3'b100 : res = 8'b00010000; 3'b101 : res = 8'b00100000; 3'b110 : res = 8'b01000000; default : res = 8'b10000000; endcase end endmoduleIf you have trouble understanding the code, you should consult a Verilog reference.If you use default “vi” editor, then when you quit editor, a prompt will be given if you want to create a symbol. Choose YES.If you are using any other software, you might need to create a symbol if your simulation does not work. To create the symbol, follow these steps:Open Library Manager and select lab2->decoder->verilog. Double click on verilog to open the file. Press Enter in the editor window and you should be able to see your code.Press Esc to come out of edit mode (if not already), then type “:wq” to save and quit vi editor.If you get a window asking to view errors or warnings, choose Yes to review them (if you want to ignore them, click No). Then a prompt will be given if you want to generate a symbol: choose YES.Click Tools->Verilog Integration->Verilog-XL in the icfb window.In the setup environment window, click “Library Manager Browser” and select your Verilog code. Click close in the browser. Your “Setup Environment” window should look like this (note: the Run Directory will automatically populate if you leave it blank). Press OK.The Virtuoso Verilog Environment for Verilog-XL Integration should open. Investigate different menu options and help files. When you are done, click on Stimulus->verilog.You will see the default stimulus file name (testfixture.verilog) and the directory in which it is located (/elec4708/lab2/decoder.run1).Open File Manager from your Desktop and browse to that directory. Open testfixture.verilog and edit as follows. You can use “vi” or other editor to enter following stimulus file. Save and close the editor when you are done. Also make a backup copy of this testfixture (eg. testfixture.backup) in case your testfixture.verilog file is modified by the tool. If you choose to write your own testbench from scratch, then replace the “testfixture.template” file with the testbench you wrote (make sure you have a copy of it saved, as noted above).// Verilog stimulus file for 3 bit decoderinitialbegin sel[2]=1'b0; sel[1]=1'b0; sel[0]=1'b0; #10; sel[2]=1'b0; sel[1]=1'b0; sel[0]=1'b0; #10; sel[2]=1'b0; sel[1]=1'b0; sel[0]=1'b1; #10; sel[2]=1'b0; sel[1]=1'b1; sel[0]=1'b0; #10; sel[2]=1'b0; sel[1]=1'b1; sel[0]=1'b1; #10; sel[2]=1'b1; sel[1]=1'b0; sel[0]=1'b0; #10; sel[2]=1'b1; sel[1]=1'b0; sel[0]=1'b1; #10; sel[2]=1'b1; sel[1]=1'b1; sel[0]=1'b0; #10; sel[2]=1'b1; sel[1]=1'b1; sel[0]=1'b1; #10; sel[2]=1'b0; sel[1]=1'b0; sel[0]=1'b0;endIf you do not understand the code, consult a Verilog reference. Go back to your Virtuoso verilog environment window and click Stimulus->Verilog. Then click on View File. You should be able to see the code you just entered. If everything is ok, go to the next step.Click on Start Interactive button. The code should run and stop. Then click Continue button to end the simulation. Now click on View Waveforms button. Start Interactive Continue View WaveformIf you are prompted to generate netlist, choose NO unless you have changed your Verilog module file. If you choose YES (if you have changed your Verilog module file, i.e. decoder module for this tutorial), your testfixture file will be reinitialized to default testfixture. You should save a copy of your testfixture to a backup file (with a different name).The waveform viewer window should appear. Investigate different menu options and panels of this window.Click on Windows-> New -> Design Browser. The design browser window will appear. Again investigate menu options and buttons to familiarize you. Click on Shm->test->top on the left pane, then select both res and sel (while pressing control button). Then right click, select Send to Waveform Window (you have to hold and move mouse).The traces should be seen in Waveform window. Double click on sel[2:0] and res[7:0] to expand them. Go through the waveform in different time slots and verify functionality of the decoder. You might want to “Zoom to X” to see whole waveform combinations.When you are done, follow similar procedure to write and simulate Verilog code for multipliers. You must do your paper work first, i.e. divide your whole design in modules in optimized fashion and find out a proper test bench topology to verify functionality of each module. If you do not follow this approach and your whole program does not work, it will be extremely difficult, if not impossible, to find out any logical mistake you make in your module level. In next part of the tutorial we will do a sample synthesis. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download