MATLAB AND MODELSIM LINKING
|
|
- Beatrice Jefferson
- 5 years ago
- Views:
Transcription
1 MATLAB AND MODELSIM LINKING DR.S.S.Limaye Introduction: MATLAB is powerful software package for mathematical simulation, especially when signals are represented in an abstract i.e. mathematical form. When we want to test a hardware system in terms of the abstract inputs and outputs, linking Modelsim VHDL or Verilog simulator with MATLAB is very helpful. The most beneficial use could be to write a test bench for the HDL model in MATLAB. The test cases can be generated in MATLAB at a higher level of abstraction, making it suitable for regression testing with random inputs. Given the ease of interfacing, this provides a very attractive alternative to Verilog PLI or VHDL FLI programming. It can be even considered as a serious alternative to e, vera, system C or system verilog languages. Configuring: For the link to work, Modelsim has to be invoked from the command prompt of MATLAB. For this purpose, MATLAB needs to know the location of MODELSIM. Install MATLAB and MODELSIM on your computer. Open MATLAB and type following command. >>configuremodelsim The system responds with following: Do you want configuremodelsim to locate installed ModelSim executables [y]/n? Press y If it finds Modelsim properly installed, it responds with following: [1] C:\Modeltech_6.2c\win32 ModelSim SE 6.2c [0] None Select ModelSim installation to be configured: Press 1 System responds with following: ModelSim successfully configured to be used with MATLAB and Simulink Invoking socket server MATLAB and Modelsim communicate with each other either through shared memory server or through TCP/IP links using socket calls. If MATLAB and Modelsim are running on different machines then TCP/IP link is mandatory. For same machine, shared memory is preferable. For inter process communication, MATLAB starts a server called HDLDaemon. For shared memory mode, give command: hdldaemon The system should respond with HDLDaemon shared memory server is running with 0 connections In case of trouble, try following steps. type following command to first check the status: >>hdldaemon('status') MATLAB should normally respond with: HDLDaemon is NOT running If a previous instance of HDLDaemon is running, it needs to be killed with the command: >>hdldaemon('kill') MATLAB will respond with:
2 HDLDaemon server was shut down For socket mode, start the HDLDaemon with the command: >>hdldaemon('socket', 0) 0 tells the OS to allocate the next available port. MATLAB will respond with: HDLDaemon socket server is running on Port portnum with 0 connections Where portnum is a socket port number assigned by the OS. Remember this number as it will be required for the Modelsim connection later. Developing VHDL program Let us start with a small VHDL program for implementing a full adder. a b cin FULL ADDER sum cout The program listing is given below. library IEEE; use IEEE.std_logic_1164.all; entity adder is port (a : in std_logic; b : in std_logic; cin : in std_logic; sum : out std_logic; cout : out std_logic); end adder; architecture rtl of adder is begin sum <= (a xor b) xor cin; cout <= (a and b) or (cin and a) or (cin and b); end rtl; Note that the entity name is adder. Remember this as it will be required during invocation of the simulator. Create a folder outside MATLAB. In our demo, we are creating it as C:\MODELSIM_PROJ. Change MATLAB current directory to above. Invoke Modelsim compiler from MATLAB command window with command: >>vsim In Modelsim command window, give dir command and make sure it is pointing to C:\MODELSIM_PROJ. Invoke text editor by pressing File> New> Source> VHDL. Enter the above program and save it as adderfile.vhd. In Modelsim command window, give following commands: ModelSim> vlib work ModelSim> vmap work work Either press compile menu or press compile tool button to invoke COMPILE SOURCE dialog box. Double click on adderfile.vhd. The file gets compiled. If there are errors, correct them and again compile till they are removed.
3 Developing MATLAB test bench The test bench consists of a MATLAB callback function that gets invoked either after a given delay or at rising edge (or falling edge) of any desired port signal. In synchronous systems, usually it is the clock signal. If you wrap the DUT in a VHDL test bench and generate clock as a part of the VHDL test bench then the callback function will be periodically invoked with the clock. However it is possible to avoid the test bench wrapper in VHDL and generate the clock and all other port signals in MATLAB. Since the present example is asynchronous, there is no clock in the device and hence we will generate all the input signals in MATLAB. By default, the name of the MATLAB callback function is same as the VHDL entity name but we can choose any other name for it and inform it to the simulator with the -mfunc switch. The prototype of the callback function is as follows. function [iport,tnext] = ADD_TESTER (oport, tnow, portinfo) Input parameters Oport It is a structure having one member for each VHDL output port signal. In our example, this structure will have following fields: oport.sum, oport.cout The values of these ports will be one of the 9 values of VHDL, namely U,X,0,1,Z,W,L,H,-. If the port signals are of the type STD_LOGIC_VECTOR, then the oport members will be arrays of matching length. Suppose the DUT has a vector output signal named val. It will be represented as a character string will typically look like 0110X. We can use following functions to convert VHDL values to numeric values. bin2dec(oport.val') is used to convert STD_LOGIC_VECTOR to unsigned integer. Note the quote mark after val which takes its transpose. If you don t use the quote, then the function returns an array with same length as val. If the port output signal (y) represents a signed integer, then we can convert it like this: op = bin2dec(oport.y'); b = 2^length(oport.y); if oport.y(1) == '1' ; If sign bit is set, subtract MSB weight op = op - 2^length(oport.y); end tnow Current simulation time in seconds. portinfo: For the first call to the function (at the start of the simulation) only, this parameter receives a structure whose fields describe the ports defined for the associated VHDL entity or Verilog module. This parameter is skipped in subsequent calls. For each port, the portinfo structure passes information such as the port's type, direction, and size. Using this information it is possible to validate the signals or to create a generic MATLAB function that operates differently depending on the port information supplied at startup. In our first example, we are ignoring this parameter. We can check whether portinfo data has been passed with a call to the MATLAB function nargin. For example: if(nargin == 3) The information is supplied in four fields. Field Subfields Sub sub fields portinfo.in portinfo.in.a type, label, size portinfo.in.b type, label, size portinfo.in.c type, label, size
4 portinfo.out portinfo.out.sum type, label, size portinfo.out.cout type, label, size portinfo.inout null portinfo.tscale In our example, type of all signals is std_logic, label is U,X,0,1,Z,W,L,H,-, and size is 1. The Simulator tick size in seconds can be accessed in MATLAB with the statement portinfo.tscale. The size of a port, say cout can be accessed by statement portinfo.out.cout.size. Input parameters The input parameters of the DUT are supplied to the simulator through the output of the callback function. iport iport (DUT input ports) This is a structure similar to oport. We can apply stimulus to the DUT inputs by setting the desired values on the iport members. Single bit values can be assigned as: iport.a = 1 ; For vector inputs, unsigned integers in MATLAB can be converted to a VHDL compatible string with dec2bin function. For example, if you have a 5 bit input port named val, it can be assigned the value of an unsigned integer x as: inport.val = dec2bin(x,5); For signed integers, use mvl2bin(x,5). tnext Time for next invocation of MATLAB test bench. It can be given directly in seconds e.g. tnext = tnow + 100e-9; or in terms of simulator time steps (If configured this way): tnext = 100 ; If you don t want invocation after a fixed time, then you can leave the vector null. The next invocation should then be based on transition of a specified signal. Testing of full adder In the callback routine, it is useful to define a persistent (similar to static in C) type variable (named ud here) to store variables that retain their values from call to call. Here we are using ud.call_count to count the number of calls to the callback routine. This DUT has 3 inputs a,b,cin and 2 outputs sum and cout. We want to give all possible combinations on a,b,cin. A convenient way to generate the input sequence is to convert the call count into a bit string with dec2bin function and apply its individual bits to the inputs a,b,cin. As long as the call count is less than 8, we reinvoke the function after 100 ns. The complete MATLAB program is given below. function [iport,tnext] = ADD_TESTER (oport, tnow, portinfo) persistent ud; tnext = []; iport = struct(); %Create a struct to store persistent user data %initialize tnext to null %initialize iport to null
5 if(nargin ==3) %First call has 3 arguments ud.call_count = 0; %Initialize call counter tnext = tnow+100e-9;%next invocation after 100 ns iport.a = '0'; iport.b = '0'; iport.cin = '0'; else ud.call_count = ud.call_count + 1; if ud.call_count < 8 %run for 8 cycles tnext = tnow+100e-9; %Next invocation after 100 ns bin = dec2bin(ud.call_count,3);%convert counter to binary string iport.a = bin(1); %Assign bits of bin to 3 inputs iport.b = bin(2); iport.cin = bin(3); else disp('over'); %If 8 cycles are over, don t invoke with tnext end end Invoking Modelsim Give following command on the Modelsim prompt to load the ADDER entity for simulation. ModelSim> vsimmatlab adder Now link it to MATLAB test bench with the command at the VSIM prompt: VSIM 3> matlabtb adder -mfunc ADD_TESTER If you are using the socket mode, give command VSIM 3> matlabtb adder -mfunc ADD_TESTER -socket portnum Where portnum is the port number returned by the HDLDaemon In the Modelsim window, using the GUI commands, add all signals in the design to the waveform viewer. Press the run all tool button. The waveforms of input and output should appear in MATLAB and VHDL. If you want to debug the MATLAB function, you may insert suitable break points.
6 Testing of FIR filter The VHDL code of an 8 tap linear phase FIR is given below. It is a low pass filter having cut off frequency of /4 radians, i.e. one eighth of sampling frequency. For the details of design, refer to VHDL a design oriented approach, by Dr S.S.Limaye, McGraw Hill India. It takes an 8 bit signed integer x and produces 8 bit signed integer y. The filter coefficients can be calculated with MATLAB command: fir1(6,.25,'low',rectwin(7),'noscale') --8 TAP LINEAR PHASE FIR FILTER LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_SIGNED.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; PACKAGE FILT IS TYPE CONST_ARRAY IS ARRAY(POSITIVE RANGE <>) OF SIGNED(7 DOWNTO 0); END PACKAGE; USE WORK.FILT.ALL; --USE DEFINITION OF CONST_ARRAY LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_SIGNED.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; ENTITY FIRFILT8 IS GENERIC(CON:CONST_ARRAY := (" ", " "," "," ")); -- 54,49,35,16 - SCALED FROM --.25,.2251,.1592,.075 CUT OFF AT PI/4 PORT(X:IN SIGNED(7 DOWNTO 0); Y:OUT SIGNED(7 DOWNTO 0); CLK,RST:STD_LOGIC); END FIRFILT8; ARCHITECTURE RTL OF FIRFILT8 IS TYPE X_ARRAY IS ARRAY(1 TO 2*CON'HIGH - 2) OF SIGNED(7 DOWNTO 0); SIGNAL XA:X_ARRAY;--SIGNAL DELAY LINE BEGIN SHIFT_PROC:PROCESS(XA,X,CLK,RST) BEGIN IF RST = '1' THEN XA <= (OTHERS => " "); ELSIF CLK'EVENT AND CLK = '1' THEN XA(1) <= X; FOR I IN 1 TO XA'HIGH-1 LOOP XA(I+1) <= XA(I); END LOOP; END IF;
7 END PROCESS SHIFT_PROC; SUM_PROC:PROCESS(XA,X) VARIABLE SUM :SIGNED(18 DOWNTO 0); VARIABLE SUM1:SIGNED( 8 DOWNTO 0); VARIABLE SUM2:SIGNED( 8 DOWNTO 0); BEGIN --INPUT X IS NOT PART OF DELAY LINE XA -- HANDLE IT SEPARATELY SUM1 := (X(7) & X) + XA(XA'HIGH);--FORCE IT TO 9 BITS SUM := (SUM1(8) & SUM1(8) & SUM1) * CON(CON'HIGH); SUM := SUM + XA(CON'HIGH-1) * CON(1); -- UNPAIRED CENTER ELEMENT FOR I IN 1 TO (CON'HIGH - 2) LOOP--OTHER ELEMENTS IN LINE SUM2 := (XA(CON'HIGH-I-1)(7) & XA(CON'HIGH-I-1)) + XA(CON'HIGH+I-1); SUM := SUM + SUM2 * (CON(I+1)); END LOOP; Y <= SUM(15 DOWNTO 8); END PROCESS SUM_PROC; END RTL; The MATLAB test bench initializes the filter by activating RST for 100 ns, setting X to 0 and then starts invoking itself after every 100 ns. In each invocation, 100 sin(x) is computed and applied to X. The user data area ud stores the call count and it is used as the index for arrays that store X and Y values. At the end, the X and Y values are plotted in a graph. The MATLAB code is given below. MATLAB TEST BENCH % FIR_TESTER function [iport,tnext] = FIR_TESTER (oport, tnow, portinfo) persistent ud; %Create a struct to store persistent user data tnext = []; %initialize tnext to null iport = struct(); %initialize iport to null if(nargin ==3) %First call ud.call_count = 0;ud.tb_clk = 0; ud.x = zeros(1,10); ud.y = zeros(1,10); tnext = tnow+100e-9; iport.rst = '1'; iport.clk = '0'; iport.x = dec2bin(0,8); else iport.rst = '0'; if ud.call_count < 50 tnext = tnow+100e-9; if ud.tb_clk == 0 iport.clk = '1'; ud.tb_clk = 1;
8 end else iport.clk = '0'; ud.tb_clk = 0; ud.call_count = ud.call_count + 1; x = 125 * sin(ud.call_count * 3* pi/8); %x= 100; iport.x = dec2mvl(x,8); ud.x(ud.call_count)=x; %op = bin2dec(oport.y')/256; op = bin2dec(oport.y'); b = 2^length(oport.y); if oport.y(1) == '1' op = op - 2^length(oport.y); end ud.y(ud.call_count)= op; end else subplot(2,1,1);plot(ud.x);subplot(2,1,2);plot(ud.y); disp('over'); end SIMULINK and MODELSIM ADDER example: Creating simulink model: In this example, we will embed the previously created adder block in a simulink model. The model will be created in the adder folder. Invoke simulink from the MATLAB command prompt by typing the command simulink or by clicking the simulink icon. In the simulink library window, select File>New>Model. Select Link for Modelsim library in the left pane and HDL cosimulation block from the right pane. Drag it to the center of the new model, leaving space for the stimulus generator on the left side and scope on the right. Enter the simulation stop time as 40 s. Double click on the block to invoke the Function Block Parameters dialog box as shown below. This box has tabs for configuring Ports, Clocks, Timescales, connection and Tcl. By default, the Ports tab is selected. It shows one input port named sig1 and two input ports named sig1 and sig2. Delete all of them one by one by selecting the line and pressing the Delete button to the right. Add a new line by pressing the New button. In the edit box under title Hull HDL name, enter /adder/a and choose I/O mode as Input. Press the Update button situated in the bottom right corner. If the button is not visible, then enlarge the window. In a similar manner, make entries for inputs b, cin and outputs sum, cout. For the output ports, enter sample time as 1, indicating that the output is updated in every cycle. The dialog box should now look like this.
9 Press OK Since we are not using clock, don t use the clocks tab. Select Timescales tab. Make 1 second in simulink correspond to 10 ticks in Modelsim. By default, Modelsim tick is configured for 1 ns. Thus 1 step of simulink running (40s) advances the Modelsim simulator by 400 ns. Press the connection tab and observe that the connection method is shared memory. Don t use the Tcl tab. Press OK. We need to add stimulus generator and scope blocks. We want to show the input and output signal in MATLAB as well as Modelsim. The model should look like this when completed. Now let us create a stimulus generator block. A convenient way to apply exhaustive input combinations to the inputs a, b, cin is to create a 3-bit counter and apply its individual bits to the three inputs. We will create the stimulus generator as a subsystem. In the simulink library browser, in tab simulink, select Ports & subsystems. In the right pane, select configurable subsystem and drag it to the left of the HDL cosimulation block. Click on its caption and change
10 it to 3 bit counter. Double click on it to open its edit window. When completed, it should look like this. In the initial state, it has an input port connected to an output port. Delete the input port and the connecting link. Add two more output ports from the library simulink> Ports and subsystems> Out1. In the simulink library browser, select simulink> sources> counter limited and drag it to the 3- bit counter window. Double click on it to open its block parameters window and set the upper limit to 7, i.e. it cycles through 0-7. In the simulink library browser, select Communication blockset> Utility blocks> Integer to bit converter and drag it to the right of the counter. Double click it to open its parameters dialog and set the number of bits per integer to 4. (One extra bit is required for proper operation of the index vector blocks.) Also, set its output data type as Boolean. The output of the Integer to bit converter block is a bit vector. To pick up its individual bits, we use three index vector blocks. Select them from the library by clicking simulink> signal routing> index vector. Place three constant blocks from the simulink> commonly used blocks library to the left of the index vector blocks and connect them to the select inputs. Double click on the constant blocks and set their values as 1, 2, 3. Note that the index 1 corresponds to the MSB and the index 3 corresponds to the LSB. Connect the output of the Integer to bit converter block to all the index vector blocks. Connect the outputs of the index vector blocks to the corresponding output ports. Save the design and return to the main model. Add a scope from simulink> sinks library. Double click on it to invoke its display window. In this window, click on the parameter tool
11 button (Second from left) and set the number of axes to 5. The scope block in the model now shows 5 inputs. Connect them to a, b, cin, sum and cout. Save the model as adder_simulink. Invoking Modelsim The adder entity has been already developed in the previous exercise. As in previous exercise, on MATLAB prompt, type: Hdldaemon The system should respond with HDLDaemon shared memory server is running with 0 connections Now type vsim This invokes Modelsim. In the Modelsim command window, type vsimulink adder The adder entity gets loaded. Add all signals in the design to the waveform viewer. Running simulation In MATLAB test bench, the VHDL simulator is the master and it calls the MATLAB callback function when programmed. The simulation is started by clicking the run all button in the Modelsim window. In Simulink method, Simulink is the master and it calls VHDL simulator for the evaluation of the VHDL block. The simulation starts by clicking the run button of the simulink model window. The simulation will run for 40 simulated seconds in simulink and 400 ns in Modelsim. We can observe waveforms in both windows. FIR FILTER in Simulink Change the MATLAB current directory to c:\modelsim_proj\fir. We have already saved the VHDL code for FIR filter in this directory. Start simulink library browser either by typing simulink on the command prompt or by clicking on simulink tool button. In the simulink library browser window, click the icon for new model file. The untitled model editor window opens up. Drag the block Link for Modelsim > HDL cosimulation to the model editor. Click the menu simulation> configuration parameters to invoke the configuration parameters dialog box. Select the solver tab in the left pane. In the right pane, make following settings. Set the type as fixed step. Set the solver to discrete (no continious states). Set the tasking mode to single tasking. Click OK. Double click on the HDL cosimulation block to invoke the Function Block Parameters dialog box. By selecting the ports tab, change the port values to look like this:
12 Do not change any other tabs. Press OK. From the simulink> sources library, drag the pulse generator block to the model editor. Double click its icon. Set its pulse type to sample based, amplitude to 1, period to 2 and pulse width to 1 and sample time to 1. Press OK. From the simulink> sources library, drag the convert block to the model editor. Double click its icon. Set its output data type mode to Boolean. Connect pulse generator to converter and converter to CLK input of Modelsim. From the simulink> sources library, drag the sine wave block to the model editor. Double click its icon. Set its sine type to sample based, amplitude to 100, samples per period to 16 and sample time to 2. Sample time should be 2 because the clock period is 2. From the simulink> sources library, drag the converter block to the model editor. Double click its icon. Set its output data type mode to Int8. Connect the sine wave to converter and converter to x. For reset pulse, there is no suitable readymade block. So we will use a signal builder block. From the simulink> sources library, drag the signal builder block to the model editor. Double click its icon. In the signal builder window, drag the vertical lines so that we have a high pulse of 1 sample duration. Since this is a continuous type block, convert it to a discrete type by using a zero hold from simulink> discrete library. Connect the signal builder to the zero order hold and the zero order hold to RST input of Modelsim. Add a scope from simulink> sinks library. Double click on it to invoke its display window. In this window, click on the parameter tool button (Second from left) and set the number of axes to 3. The scope block in the model now shows 3 inputs. Connect them to x,y and reset. Save the model as fir_simulink. Running the simulation
13 On MATLAB prompt, first type hdldaemon, and then vsim. In the Modelsim window, type vsimulink firfilt8. In the fir_simulink model window, click the run button. Following results should appear.
COE 405, Term 062. Design & Modeling of Digital Systems. HW# 1 Solution. Due date: Wednesday, March. 14
COE 405, Term 062 Design & Modeling of Digital Systems HW# 1 Solution Due date: Wednesday, March. 14 Q.1. Consider the 4-bit carry-look-ahead adder (CLA) block shown below: A 3 -A 0 B 3 -B 0 C 3 4-bit
More informationDSP Builder User Guide
DSP Builder User Guide 101 Innovation Drive San Jose, CA 95134 www.altera.com Software Version: 7.2 SP1 Document Date: December 2007 Copyright 2007 Altera Corporation. All rights reserved. Altera, The
More informationLecture 5: Aldec Active-HDL Simulator
Lecture 5: Aldec Active-HDL Simulator 1. Objective The objective of this tutorial is to introduce you to Aldec s Active-HDL 9.1 Student Edition simulator by performing the following tasks on a 4-bit adder
More informationTKT-1212 Digitaalijärjestelmien toteutus. Lecture 7: VHDL Testbenches Ari Kulmala, Erno Salminen 2008
TKT-1212 Digitaalijärjestelmien toteutus Lecture 7: VHDL Testbenches Ari Kulmala, Erno Salminen 2008 Contents Purpose of test benches Structure of simple test bench Side note about delay modeling in VHDL
More informationQuartus Counter Example. Last updated 9/6/18
Quartus Counter Example Last updated 9/6/18 Create a logic design from start to a DE10 implementation This example uses best design practices This example is not about creating HDL The HDL code will be
More informationUsing ModelSim to Simulate Logic Circuits in VHDL Designs. 1 Introduction. For Quartus II 13.0
Using ModelSim to Simulate Logic Circuits in VHDL Designs For Quartus II 13.0 1 Introduction This tutorial is a basic introduction to ModelSim, a Mentor Graphics simulation tool for logic circuits. We
More informationSymbolically the RS-Latch that is being simulated is the one shown below, it s truth table is also given:
Symbolically the RS-Latch that is being simulated is the one shown below, it s truth table is also given: For this example you will need to create two VHDL (.vhd) files one represents the rslatch itself,
More informationExperiment 3. Getting Start with Simulink
Experiment 3 Getting Start with Simulink Objectives : By the end of this experiment, the student should be able to: 1. Build and simulate simple system model using Simulink 2. Use Simulink test and measurement
More informationGuidelines for Laboratory Sessions:
University of Malta Faculty of Engineering Department of Electronic Systems Engineering Hardware Description Languages ELE 3103 Lecturer: Dr. Ivan Grech igrech@eng.um.edu.mt Laboratory Tutors: Dr. Edward
More informationTutorial on VHDL Compilation, Simulation, and Synthesis
Tutorial on VHDL Compilation, Simulation, and Synthesis USING MENTOR GRAPHICS INTRODUCTION This tutorial is designed to give Mentor Graphics users an experience of how to create a VHDL model, compile it
More informationCPEN 230L: Introduction to Digital Logic Laboratory Lab #6: Verilog and ModelSim
CPEN 230L: Introduction to Digital Logic Laboratory Lab #6: Verilog and ModelSim Purpose Define logic expressions in Verilog using register transfer level (RTL) and structural models. Use Quartus II to
More informationVHDL Testbench. Test Bench Syntax. VHDL Testbench Tutorial 1. Contents
VHDL Testbench Tutorial 1 Contents 1 VHDL Testbench 2 Test Bench Syntax 3 Testbench Example: VHDL Code for Up Down Binary Counter 4 VHDL Testbench code for up down binary counter 5 Testbench Waveform for
More informationENGR 5865 DIGITAL SYSTEMS
ENGR 5865 DIGITAL SYSTEMS ModelSim Tutorial Manual January 22, 2007 Introduction ModelSim is a CAD tool widely used in the industry for hardware design. This document describes how to edit/add, compile
More informationVHDL Introduction to tools. TSTE12 Datorteknik Kent Palmkvist, Thomas Johansson. Version
VHDL Introduction to tools TSTE12 Datorteknik Kent Palmkvist, Thomas Johansson Version 0.5 2017-08-30 1 1 Introduction This handbook is your guide to the VHDL simulation tool set used in the course. You
More information2IN35 VLSI Programming Lab Work Assignment 1: Hardware design using Verilog
2IN35 VLSI Programming Lab Work Assignment 1: Hardware design using Verilog Hrishikesh Salunkhe, h.l.salunkhe@tue.nl, Alok Lele, a.lele@tue.nl April 28, 2015 1 Contents 1 Introduction 3 2 Hardware design
More informationSymbolically a D-Latch can be represented as so, it s truth table is also given:
Symbolically a D-Latch can be represented as so, it s truth table is also given: For this example you will need to create two VHDL (.vhd) files one represents the dlatch itself, while the other will test
More informationIntroduction to Simulink. The Use of Mathematic Simulations in Electrical Engineering
Introduction to Simulink The Use of Mathematic Simulations in Electrical Engineering Lecture Outline 1) Introduction to Simulink 2) Modelling of dynamics systems 2 Simulink Tool for modeling, simulating,
More informationExperiment 8 SIMULINK
Experiment 8 SIMULINK Simulink Introduction to simulink SIMULINK is an interactive environment for modeling, analyzing, and simulating a wide variety of dynamic systems. SIMULINK provides a graphical user
More informationUNIT I Introduction to VHDL VHDL: - V -VHSIC, H - Hardware, D - Description, L Language Fundamental section of a basic VHDL code Library :
UNIT I Introduction to VHDL VHDL stands for very high-speed integrated circuit hardware description language. Which is one of the programming languages used to model a digital system by dataflow, behavioral
More informationControl and Datapath 8
Control and Datapath 8 Engineering attempts to develop design methods that break a problem up into separate steps to simplify the design and increase the likelihood of a correct solution. Digital system
More informationHardware Description Languages. Modeling Complex Systems
Hardware Description Languages Modeling Complex Systems 1 Outline (Raising the Abstraction Level) The Process Statement if-then, if-then-else, if-then-elsif, case, while, for Sensitivity list Signals vs.
More informationIn our case Dr. Johnson is setting the best practices
VHDL Best Practices Best Practices??? Best practices are often defined by company, toolset or device In our case Dr. Johnson is setting the best practices These rules are for Class/Lab purposes. Industry
More informationOutline. CPE/EE 422/522 Advanced Logic Design L05. Review: General Model of Moore Sequential Machine. Review: Mealy Sequential Networks.
Outline CPE/EE 422/522 Advanced Logic Design L05 Electrical and Computer Engineering University of Alabama in Huntsville What we know Combinational Networks Sequential Networks: Basic Building Blocks,
More informationEET2141 Project 2: Binary Adder Using Xilinx 7.1i Due Friday April 25
EET2141 Project 2: Binary Adder Using Xilinx 7.1i Due Friday April 25 Introduction This Xilinx project introduces the characteristics of the ripple carry adder. From the last project, you learned that
More informationELCT 501: Digital System Design
ELCT 501: Digital System Lecture 4: CAD tools (Continued) Dr. Mohamed Abd El Ghany, Basic VHDL Concept Via an Example Problem: write VHDL code for 1-bit adder 4-bit adder 2 1-bit adder Inputs: A (1 bit)
More informationDeclarations of Components and Entities are similar Components are virtual design entities entity OR_3 is
Reserved Words component OR_3 port (A,B,C: in bit; Z: out bit); end component ; Reserved Words Declarations of Components and Entities are similar Components are virtual design entities entity OR_3 is
More informationPart 4: VHDL for sequential circuits. Introduction to Modeling and Verification of Digital Systems. Memory elements. Sequential circuits
M1 Informatique / MOSIG Introduction to Modeling and erification of Digital Systems Part 4: HDL for sequential circuits Laurence PIERRE http://users-tima.imag.fr/amfors/lpierre/m1arc 2017/2018 81 Sequential
More informationBasic Xilinx Design Capture. Objectives. After completing this module, you will be able to:
Basic Xilinx Design Capture This material exempt per Department of Commerce license exception TSU Objectives After completing this module, you will be able to: List various blocksets available in System
More informationLecture 38 VHDL Description: Addition of Two [5 5] Matrices
Lecture 38 VHDL Description: Addition of Two [5 5] Matrices -- First, write a package to declare a two-dimensional --array with five elements library IEEE; use IEEE.STD_LOGIC_1164.all; package twodm_array
More informationCMPT 250: Computer Architecture. Using LogicWorks 5. Tutorial Part 1. Somsubhra Sharangi
CMPT 250: Computer Architecture Using LogicWorks 5 Tutorial Part 1 Somsubhra Sharangi What is VHDL? A high level language to describe digital circuit Different that a programming language ( such as Java)
More informationENSC 350 ModelSim Altera Tutorial
ENSC 350 ModelSim Altera Tutorial This is a quick guide get you started with the ModelSim Altera simulator. ModelSim is only a functional verification tool so you will also have to use Quartus II to complete
More informationModeling Complex Behavior
Modeling Complex Behavior Sudhakar Yalamanchili, Georgia Institute of Technology, 2006 (1) Outline Abstraction and the Process Statement Concurrent processes and CSAs Process event behavior and signals
More informationFilter Design HDL Coder 2 User s Guide
Filter Design HDL Coder 2 User s Guide How to Contact The MathWorks www.mathworks.com Web comp.soft-sys.matlab Newsgroup www.mathworks.com/contact_ts.html Technical Support suggest@mathworks.com bugs@mathworks.com
More informationVHDL Examples Mohamed Zaky
VHDL Examples By Mohamed Zaky (mz_rasmy@yahoo.co.uk) 1 Half Adder The Half Adder simply adds 2 input bits, to produce a sum & carry output. Here we want to add A + B to produce Sum (S) and carry (C). A
More informationVivado Design Suite Tutorial. Model-Based DSP Design using System Generator
Vivado Design Suite Tutorial Model-Based DSP Design using System Generator Notice of Disclaimer The information disclosed to you hereunder (the "Materials") is provided solely for the selection and use
More informationConcurrent Signal Assignment Statements (CSAs)
Concurrent Signal Assignment Statements (CSAs) Digital systems operate with concurrent signals Signals are assigned values at a specific point in time. VHDL uses signal assignment statements Specify value
More informationMidterm Exam Thursday, October 24, :00--2:15PM (75 minutes)
Last (family) name: Answer Key First (given) name: Student I.D. #: Department of Electrical and Computer Engineering University of Wisconsin - Madison ECE 551 Digital System Design and Synthesis Midterm
More informationExperiment 6 SIMULINK
Experiment 6 SIMULINK Simulink Introduction to simulink SIMULINK is an interactive environment for modeling, analyzing, and simulating a wide variety of dynamic systems. SIMULINK provides a graphical user
More informationECEU530. Schedule. ECE U530 Digital Hardware Synthesis. Datapath for the Calculator (HW 5) HW 5 Datapath Entity
ECE U530 Digital Hardware Synthesis Prof. Miriam Leeser mel@coe.neu.edu November 6, 2006 Classes November 6 and 8 are in 429 Dana! Lecture 15: Homework 5: Datapath How to write a testbench for synchronous
More informationE85: Digital Design and Computer Engineering Lab 2: FPGA Tools and Combinatorial Logic Design
E85: Digital Design and Computer Engineering Lab 2: FPGA Tools and Combinatorial Logic Design Objective The purpose of this lab is to learn to use Field Programmable Gate Array (FPGA) tools to simulate
More informationECE 545 Lecture 4. Simple Testbenches. George Mason University
ECE 545 Lecture 4 Simple Testbenches George Mason University Required reading P. Chu, RTL Hardware Design using VHDL Chapter 2.2.4, Testbenches 2 Testbenches ECE 448 FPGA and ASIC Design with VHDL 3 Testbench
More informationVHDL Simulation. Testbench Design
VHDL Simulation Testbench Design The Test Bench Concept Elements of a VHDL/Verilog testbench Unit Under Test (UUT) or Device Under Test (DUT) instantiate one or more UUT s Stimulus of UUT inputs algorithmic
More informationLattice VHDL Training
Lattice Part I February 2000 1 VHDL Basic Modeling Structure February 2000 2 VHDL Design Description VHDL language describes a digital system as a set of modular blocks. Each modular block is described
More informationIntroduction to VHDL #1
ECE 3220 Digital Design with VHDL Introduction to VHDL #1 Lecture 3 Introduction to VHDL The two Hardware Description Languages that are most often used in industry are: n VHDL n Verilog you will learn
More informationTutorial 4 HDL. Outline VHDL PROCESS. Modeling Combinational Logic. Structural Description Instantiation and Interconnection Hierarchy
CS3: Hardware Lab Tutorial 4 HDL Outline VHDL basic language concepts basic design methodology Examples A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati i i i3 i4 Modeling Combinational
More informationSimulate the Design using the XSim Simulator
Simulate the Design using the XSim Simulator This tutorial guides you through the simulation flow using Xsim simulator within Vivado design environment. In this tutorial, you will simulate the workings
More informationCCE 3202 Advanced Digital System Design
CCE 3202 Advanced Digital System Design Lab Exercise #2 Introduction You will use Xilinx Webpack v9.1 to allow the synthesis and creation of VHDLbased designs. This lab will outline the steps necessary
More informationSession 3 Introduction to SIMULINK
Session 3 Introduction to SIMULINK Brian Daku Department of Electrical Engineering University of Saskatchewan email: daku@engr.usask.ca EE 290 Brian Daku Outline This section covers some basic concepts
More informationAssignment. Last time. Last time. ECE 4514 Digital Design II. Back to the big picture. Back to the big picture
Assignment Last time Project 4: Using synthesis tools Synplify Pro and Webpack Due 11/11 ning of class Generics Used to parameterize models E.g., Delay, bit width Configurations Configuration specification
More informationSequential Statement
Sequential Statement Sequential Logic Output depends not only on current input values but also on previous input values. Are building blocks of; Counters Shift registers Memories Flip flops are basic sequential
More informationAbi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University
Hardware description language (HDL) Intended to describe circuits textually, for a computer to read Evolved starting in the 1970s and 1980s Popular languages today include: VHDL Defined in 1980s by U.S.
More informationBasic Language Concepts
Basic Language Concepts Sudhakar Yalamanchili, Georgia Institute of Technology ECE 4170 (1) Describing Design Entities a sum b carry Primary programming abstraction is a design entity Register, logic block,
More informationNios II Custom Instruction User Guide Preliminary Information
Nios II Custom Instruction User Guide Preliminary Information 101 Innovation Drive San Jose, CA 95134 (408) 544-7000 http://www.altera.com Copyright 2008 Altera Corporation. All rights reserved. Altera,
More informationUNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180A DIGITAL SYSTEMS I Winter 2015
UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering EEC180A DIGITAL SYSTEMS I Winter 2015 LAB 1: Introduction to Quartus II Schematic Capture and ModelSim Simulation This
More informationDigital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification
Digital Design Using VHDL Using Xilinx s Tool for Synthesis and ModelSim for Verification Ahmed Abu-Hajar, Ph.D. abuhajar@digitavid.net Digitavid, Inc San Jose, CA Session One Outline Introducing VHDL
More informationHardware Description Language VHDL (1) Introduction
Hardware Description Language VHDL (1) Introduction Digital Radiation Measurement and Spectroscopy NE/RHP 537 Introduction Hardware description language (HDL) Intended to describe circuits textually, for
More informationAccelDSP tutorial 2 (Matlab.m to HDL for Xilinx) Ronak Gandhi Syracuse University Fall
AccelDSP tutorial 2 (Matlab.m to HDL for Xilinx) Ronak Gandhi Syracuse University Fall 2009-10 AccelDSP Getting Started Tutorial Introduction This tutorial exercise will guide you through the process of
More informationIntroduction to VHDL. Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez
Introduction to VHDL Yvonne Avilés Colaboration: Irvin Ortiz Flores Rapid System Prototyping Laboratory (RASP) University of Puerto Rico at Mayaguez What is VHDL? Very High Speed Integrated Circuit Hardware
More informationChapter 2 Getting Hands on Altera Quartus II Software
Chapter 2 Getting Hands on Altera Quartus II Software Contents 2.1 Installation of Software... 20 2.2 Setting Up of License... 21 2.3 Creation of First Embedded System Project... 22 2.4 Project Building
More informationActel Libero TM Integrated Design Environment v2.3 Structural Schematic Flow Design Tutorial
Actel Libero TM Integrated Design Environment v2.3 Structural Schematic Flow Design Tutorial 1 Table of Contents Design Flow in Libero TM IDE v2.3 Step 1 - Design Creation 3 Step 2 - Design Verification
More informationDIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6
DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6 FINITE STATE MACHINES (FSMs) Moore Machines Mealy Machines FINITE STATE MACHINES (FSMs) Classification: Moore Machine: Outputs depend only on the current state
More informationGetting Started with Xilinx WebPack 13.1
Getting Started with Xilinx WebPack 13.1 B. Ackland June 2011 (Adapted from S. Tewksbury notes WebPack 7.1) This tutorial is designed to help you to become familiar with the operation of the WebPack software
More informationMridula Allani Fall Fall
Mridula Allani Fall 2010 Fall 2010 1 Model and document digital systems Hierarchical models System, RTL (Register Transfer Level), gates Different levels of abstraction Behavior, structure Verify circuit/system
More informationHDL Interoperability & IP-based System Verification
HDL Interoperability & IP-based System Verification Dennis Brophy Director of Strategic Business Development 1 ModelSim April 2000 Mixed-HDL Issues Why mix HDLs? Use of blocks of IP in the other language.
More informationUniversity of Twente. VHDL tutorial For internal use only. Faculty of Electrical Engineering, Mathematics and Computer Science. E.
University of Twente Faculty of Electrical Engineering, Mathematics and Computer Science VHDL tutorial For internal use only E. Molenkamp January 2016 Contents 1 Introduction... 3 2 Simulation with ModelSim...
More informationDIGITAL SYSTEM DESIGN
DIGITAL SYSTEM DESIGN Prepared By: Engr. Yousaf Hameed Lab Engineer BASIC ELECTRICAL & DIGITAL SYSTEMS LAB DEPARTMENT OF ELECTRICAL ENGINEERING Digital System Design 1 Name: Registration No: Roll No: Semester:
More informationVHDL Testbench Design. Textbook chapters 2.19, , 9.5
VHDL Testbench Design Textbook chapters 2.19, 4.10-4.12, 9.5 The Test Bench Concept Elements of a VHDL/Verilog testbench Unit Under Test (UUT) or Device Under Test (DUT) instantiate one or more UUT s Stimulus
More informationVHDL/Verilog Simulation. Testbench Design
VHDL/Verilog Simulation Testbench Design The Test Bench Concept Elements of a VHDL/Verilog testbench Unit Under Test (UUT) or Device Under Test (DUT) instantiate one or more UUT s Stimulus of UUT inputs
More informationChapter 6 Combinational-Circuit Building Blocks
Chapter 6 Combinational-Circuit Building Blocks Commonly used combinational building blocks in design of large circuits: Multiplexers Decoders Encoders Comparators Arithmetic circuits Multiplexers A multiplexer
More informationVHDL simulation and synthesis
VHDL simulation and synthesis How we treat VHDL in this course You will not become an expert in VHDL after taking this course The goal is that you should learn how VHDL can be used for simulation and synthesis
More informationLecture 32: SystemVerilog
Lecture 32: SystemVerilog Outline SystemVerilog module adder(input logic [31:0] a, input logic [31:0] b, output logic [31:0] y); assign y = a + b; Note that the inputs and outputs are 32-bit busses. 17:
More informationLab 3. Advanced VHDL
Lab 3 Advanced VHDL Lab 3 Advanced VHDL This lab will demonstrate many advanced VHDL techniques and how they can be used to your advantage to create efficient VHDL code. Topics include operator balancing,
More informationSummary of FPGA & VHDL
FYS4220/9220 Summary of FPGA & VHDL Lecture #6 Jan Kenneth Bekkeng, University of Oslo - Department of Physics 16.11.2011 Curriculum (VHDL & FPGA part) Curriculum (Syllabus) defined by: Lectures Lecture6:
More informationExperiment VERI: FPGA Design with Verilog (Part 2) (webpage: /)
Department of Electrical & Electronic Engineering 2 nd Year Laboratory Experiment VERI: FPGA Design with Verilog (Part 2) (webpage: www.ee.ic.ac.uk/pcheung/teaching/e2_experiment /) 1.0 Learning Outcomes
More informationActive-HDL. Getting Started
Active-HDL Getting Started Active-HDL is an integrated environment designed for development of VHDL designs. The core of the system is a VHDL simulator. Along with debugging and design entry tools, it
More informationCDA 4253 FPGA System Design VHDL Testbench Development. Hao Zheng Comp. Sci & Eng USF
CDA 4253 FPGA System Design VHDL Testbench Development Hao Zheng Comp. Sci & Eng USF art-4- > 70% projects spent > 40% time in verification 2 Validation, Verification, and Testing Validation: Does the
More informationTwo HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design
Two HDLs used today Introduction to Structured VLSI Design VHDL I VHDL and Verilog Syntax and ``appearance'' of the two languages are very different Capabilities and scopes are quite similar Both are industrial
More informationCSEE W4840 Embedded System Design Lab 1
CSEE W4840 Embedded System Design Lab 1 Stephen A. Edwards Due January 31, 2008 Abstract Learn to use the Altera Quartus development envrionment and the DE2 boards by implementing a small hardware design
More informationCSE 591: Advanced Hardware Design and Verification (2012 Spring) LAB #0
Lab 0: Tutorial on Xilinx Project Navigator & ALDEC s Active-HDL Simulator CSE 591: Advanced Hardware Design and Verification Assigned: 01/05/2011 Due: 01/19/2011 Table of Contents 1 Overview... 2 1.1
More informationDigital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University
Digital Circuit Design and Language Datapath Design Chang, Ik Joon Kyunghee University Typical Synchronous Design + Control Section : Finite State Machine + Data Section: Adder, Multiplier, Shift Register
More informationAccelerate FPGA Prototyping with
Accelerate FPGA Prototyping with MATLAB and Simulink September 21 st 2010 Stephan van Beek Senior Application Engineer 1 From Idea to Implementation DESIGN Algorithm Development MATLAB Simulink Stateflow
More informationTest Benches - Module 8
Test Benches Module 8 Jim Duckworth, WPI 1 Overview We have concentrated on VHDL for synthesis Can also use VHDL as a test language Very important to conduct comprehensive verification on your design To
More informationReview of Digital Design with VHDL
Review of Digital Design with VHDL Digital World Digital world is a world of 0 and 1 Each binary digit is called a bit Eight consecutive bits are called a byte Hexadecimal (base 16) representation for
More informationINTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX
INTRODUCTION TO MATLAB, SIMULINK, AND THE COMMUNICATION TOOLBOX 1) Objective The objective of this lab is to review how to access Matlab, Simulink, and the Communications Toolbox, and to become familiar
More informationDigital Systems Design
Digital Systems Design Review of Combinatorial Circuit Building Blocks: VHDL for Combinational Circuits Dr. D. J. Jackson Lecture 2-1 Introduction to VHDL Designer writes a logic circuit description in
More informationObjectives. Simulink Basics
Simulink Basics This material exempt per Department of Commerce license exception TSU Objectives After completing this module, you will be able to: Describe Simulink environment List some of the commonly
More informationHardware Verification Group. Department of Electrical and Computer Engineering, Concordia University, Montreal, Canada. CAD Tool Tutorial.
Digital Logic Synthesis and Equivalence Checking Tools Hardware Verification Group Department of Electrical and Computer Engineering, Concordia University, Montreal, Canada CAD Tool Tutorial May, 2010
More informationN-input EX-NOR gate. N-output inverter. N-input NOR gate
Hardware Description Language HDL Introduction HDL is a hardware description language used to design and document electronic systems. HDL allows designers to design at various levels of abstraction. It
More informationUsing the Xilinx CORE Generator in Foundation ISE 3.1i with ModelSim
Using the Xilinx CORE Generator in Foundation ISE 3.1i with ModelSim Installing Foundation ISE, CORE Generator, and ModelSim Foundation ISE This section explains how to install the Xilinx Foundation ISE
More informationVHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language
VHDL Introduction to Structured VLSI Design VHDL I Very High Speed Integrated Circuit (VHSIC) Hardware Description Language Joachim Rodrigues A Technology Independent, Standard Hardware description Language
More informationLecture 9. VHDL, part IV. Hierarchical and parameterized design. Section 1 HIERARCHICAL DESIGN
Lecture 9 VHDL, part IV Hierarchical and parameterized design Section 1 HIERARCHICAL DESIGN 2 1 Dealing with Large Digital System Design 1. Apply hierarchy to the design At the highest level use larger
More informationECE U530 Digital Hardware Synthesis. Course Accounts and Tools
ECE U530 Digital Hardware Synthesis Prof. Miriam Leeser mel@coe.neu.edu Sept 13, 2006 Lecture 3: Basic VHDL constructs Signals, Variables, Constants VHDL Simulator and Test benches Types Reading: Ashenden
More informationField Programmable Gate Array
Field Programmable Gate Array System Arch 27 (Fire Tom Wada) What is FPGA? System Arch 27 (Fire Tom Wada) 2 FPGA Programmable (= reconfigurable) Digital System Component Basic components Combinational
More informationJEE2600 INTRODUCTION TO DIGITAL LOGIC AND COMPUTER DESIGN. ModelSim Tutorial. Prepared by: Phil Beck 9/8/2008. Voter Function
JEE2600 INTRODUCTION TO DIGITAL LOGIC AND COMPUTER DESIGN ModelSim Tutorial Prepared by: Phil Beck 9/8/2008 Vote 1 Vote 2 Voter Function Pass Vote 3 Pass is only a 1 when two or more of the Vote inputs
More informationVHDL And Synthesis Review
VHDL And Synthesis Review VHDL In Detail Things that we will look at: Port and Types Arithmetic Operators Design styles for Synthesis VHDL Ports Four Different Types of Ports in: signal values are read-only
More informationINTRODUCTION TO CATAPULT C
INTRODUCTION TO CATAPULT C Vijay Madisetti, Mohanned Sinnokrot Georgia Institute of Technology School of Electrical and Computer Engineering with adaptations and updates by: Dongwook Lee, Andreas Gerstlauer
More informationLecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1
Lecture 1: VHDL Quick Start Digital Systems Design Fall 10, Dec 17 Lecture 1 1 Objective Quick introduction to VHDL basic language concepts basic design methodology Use The Student s Guide to VHDL or The
More informationMicroBlaze Tutorial on EDK 10.1 using Sparatan III E Behavioural Simulation of MicroBlaze System
MicroBlaze Tutorial on EDK 10.1 using Sparatan III E Behavioural Simulation of MicroBlaze System Ahmed Elhossini January 24, 2010 1 Introduction 1.1 Objectives This tutorial will demonstrate process of
More informationCSEE W4840 Embedded System Design Lab 1
CSEE W4840 Embedded System Design Lab 1 Stephen A. Edwards Due February 3, 2011 Abstract Learn to use the Altera Quartus development envrionment and the DE2 boards by implementing a small hardware design
More informationTutorial - Using Xilinx System Generator 14.6 for Co-Simulation on Digilent NEXYS3 (Spartan-6) Board
Tutorial - Using Xilinx System Generator 14.6 for Co-Simulation on Digilent NEXYS3 (Spartan-6) Board Shawki Areibi August 15, 2017 1 Introduction Xilinx System Generator provides a set of Simulink blocks
More information