CMR Institute of Technology, Bangalore DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
Semester: 04
FUNDAMENTALS OF HDL (10EC45)
Lectures/week: 05
Course Instructor(s): Mr. Sunil Kumar K H, H, Pavankumar N.C Course duration: 29 29 Jan., 2015 2015 – 23 May 2015 2015
Unit 1: INTRODUC INTRODUCTION TION TO HDL
1 2
Explain Explain the behaviou behavioural ral and structural structural descrip description tion types types of HDL prog programm ramming, ing, with with example exampless and keyword keywordss used. Expl Explai ain n the the foll follow owin ing g dat dataa type types: s: i) Physical std_logic and bit_vector in VHDL ii) Nets, parameters and registers in verilog.
3 4
What What is synthe synthesis sis and simulati simulation? on? List List the general general steps steps involved involved.. Write Write the syntax in in VHDL VHDL and verilog verilog for for assigning delay, declaring constant and declaring signals.
5 6 7 8 9
If A, B and C are are three three unsigne unsigned d variables variables with with A = 11110000 11110000,, B = 010111 01011101 01 & C = 00000000 00000000,, find the value value of i) A NAND B, ii) A && C, iii) ~B, iv) A ror 2, v)! B, vi) B << 1. Mention Mention the the different different styles styles of writin writing g the descript description ion using using HDL. HDL. Explain Explain the switch switch level level and mixed mixed type type description by taking example. Mention Mention differen differentt styles styles of descri description ptions. s. Explain Explain mixed mixed type type and mixed mixed language language descript description ion in VHDL VHDL and and verilog.
10 11
How do do you assign assign a delay delay time time to the the signal signal assignm assignment ent statemen statement? t?
12 13 14
Explain the use of data type vectors vectors with dataflow description description of 2 x 2 unsigned combinational combinational array multiplier in VHDL and verilog. What What is is HDL? HDL? Why Why do do you you need need it? it?
15 16 17 18 19 20 21
Compa
22 23
Write switch level level description description in verilog verilog and VHDL for an inverter, inverter, with its circuit circuit diagram. diagram. Unit 2: DATA FLOW FLOW DESCRIPTIONS DESCRIPTIONS
1
Write Write the block diagram diagram of a 4 bit bit ripple ripple carry carry adder adder and and its Boole Boolean an function functions. s. Write Write dataflow dataflow description description in Verilog. Assume 4ns propagation delay for all assignment statements. Draw the simulation waveform.
2 3 4
5 6 7 8
How do you assign a delay time to the signal assignment statement? Explain the dataflow model of 2x1 multiplexer in VHDL and verilog. What do you mean by the data flow style of description? Explain its features with a suitable example. Write a data flow description VHDL for a system that has three 1-bit inputs a(1), a(2) and a(3); and one 1-bit output b. the least significant bit is a(1); and b is 1, only when (a(1)a(2)a(3))=1,3,6,7(in decimal). Otherwise b is 0. Derive a minimized Boolean function of the system and write the dataflow description. With a suitable example, explain the concept of signal declaration. With syntax of CASE statement in VHDL and verilog, discuss its facts. Write a behavioral description of a 4 bit binary counter, in verilog. Explain with an example how the execution of the signal assignment statement takes place in HDL.
9
Write the truth table and derive the Boolean functions after minimization for a full adder with active low enable i.e. if enable is low the sum and carry are the usual outputs. Then write a dataflow description using VHDL and include a delay of 2 ns for any gate including XOR. Obtain the Boolean expressions for a 2-bit comparator. Write the dataflow description in VHDL and verilog.
10
What is a vector? Give an example for VHDL and verilog vector data types
11
With the help of a truth table and K- maps write Boolean expression for a 2- bit magnitude comparator. Write VHDL/verilog code. 12 Draw the block diagram of a 3- bit carry look ahead adder and write data flow description for its Boolean Functions in verilog. Unit 3: BEHAVIORAL DESCRIPTIONS 1 Differentiate between signal and variable assignment statement in VHDL. Write VHDL programs for behavioural description of D-latch using signal signal assignment and variable assignment. 2 Write verilog description for a 4-bit priority encoder. 3
Explain the formats of for-loop statements in VHDL and verilog.
4
Write a VHDL code for D-latch using i) signal assignment statements ii) variable assignment statements. Distinguish between these two types of statements with the help of simulation waveforms. Explain the general format of various loop statements in HDL, with examples.
5 6 7
Write a verilog code to implement a 3-bit binary counter, with active high synchronous clear u 6 using case statement. Explain IF and CASE statements with examples
8
Explain Booth algorithm with a flow chart. Write VHDL or Verilog description for 4x 4- bit Booth algorithm.
9 10
Write VHDL programs for behavioural description of D-latch using signal assignment and variable assignment. Explain the formats of while-loop statements in VHDL and verilog.
11
Explain the general format of various loop statements in VHDL, with examples.
12
Explain the Booth algorithm. VHDL/Verilog description for 4X4 Booth algorithm. Write a behavioural description of half adder in VHDL and Verilog with propagation delay of 5 ns. Discuss the important features of their description in VHDL and Verilog. Distinguish between (i) VHDL IF and VHDL case, (ii) VHDL Next and Exit, (iii) Verilog repeat and forever.
13
UNIT 4: STRUCTURAL DESCRIPTION
1
2 3
Explain the binding in the following, with example: i) Between entity and component in VHDL ii) Between two modules in Verilog Write the HDL programs for N+1 bit magnitude comparator using i) generate and generic in VHDL, ii) generate and parameters in verilog. Write a VHDL structural description for full adder, using two half adders.
4
What is the advantage of structural coding in verilog, compared to structural coding in VHDL?
5
7
Define state machine. Using the state machine concept, showing all the details, design a counter, which counts 0, 2, 3, 5, 7. Write the VHDL code for the same. Explain with suitable examples, how binding is achieved in the VHDL between i) Entity and Architecture ii) Entity and Component iii) Library and Module. Write a structural description using VHDL to implement a 2:1 multiplexer, with active low enable
8
Explain the use of i) Generic statement ii) Parameter iii) Generate statement.
9
What is Binding? Discuss the binding between library and components.
10
Write the HDL description of 2:1 multiplexer with active low enable in VHDL/Verilog, using structural style.
11
Write VHDL and Verilog program for full adder structural description.
12
Explain the execution of process statement.
13
Explain Function mapping with example.
14
Explain synthesis steps.
15
Explain the binding in the following, with example: i) Between entity and component in VHDL, ii) Between two modules in verilog. UNIT 5: PROCEDURES TASKS AND FUNCTIONS, ADVANCED HDL DESCRIPTIONS Explain the use of procedure (in VHDL) and task (in verilog) with description of full adder, using half adders.
6
1 2 3
Explain the file declaration and built in procedures for file handling in VHDL. With declaration syntax of procedure, explain its facts. Write a verilog function to find the larger of the two signed numbers.
4
Give the significance of procedure, task and function. Compare them.
5
6
Write a task to multiply two signed numbers, using the Booth algorithm. Use this task to perform signed vector multiplication, d = a * b, where a is row vector with three elements and b is a column vector with three elements. With declaration syntax of procedure, explain its facts.
7
Write a VHDL code to read a file consisting of four ASCII characters.
8
With declaration syntax of task, explain its facts.
9
Write VHDL & Verilog code to convert a fractional Binary to Real Procedures/Tasks.
10
Write VHDL code to convert unsigned binary vector to integer conversion using Procedure and task.
11
Write a code to convert the unsigned integer to (N=4) binary using procedure.
12
Bring out the differences between functions and procedures.
13
Write a VHDL description of an N bit ripple carry adder using procedure. UNIT 6: MIXED-TYPE DESCRIPTIONS
1
How to attach a package to the VHDL module? Explain with example.
2
What is the need of mixed type description? Write description of 16x8 SRAM in VHDL and verilog.
3
What do you understand by a file in HDL? List out the VHDL procedures for file processing.
4
With syntax, explain the package and the package body.
5
Write VHDL code for the state diagram shown in figure.
6
Explain the file declaration and built in procedures for file handling in VHDL.
7
Write a verilog code to find the largest element of an array.
8
Write a vhdl code for addition of two 5X5 matrices using a package.
9
What is the need of mixed type descriptions? Write description of 16x8 SRAM in VHDL and verilog.
10
Write a VHDL code for subtraction of two 5x5matrices using package.
11
Write a VHDL code for finding greatest of two 5x5matrices using package.
12
Explain the fetch and execute cycles of basic computer for the following operations: Halt, Add,Mult,NAND.
13
14
Write a block diagram and function table of 128x16 static memory. Write a Verilog code. Verify the code by simulation waveform by writing data in memory locations 8,18,46,126 and read the contents of two memory locations 18 and 46. Write HDL code both VHDL and Verilog for finding the greatest element of an array.
15
Explain the implementation of single dimensional and two dimensional arrays in VHDL. UNIT 7: MIXED LANGUAGE DESCRIPTIONS
1
How to invoke a VHDL entity from a verilog module? Explain with example.
2 3
Write a mixed language description of Full adder, explain the invoking of VHDL entity from averilog module Describe all file processing tasks in Verilog. What is the necessity of Mixed-type description?
4
Describe the development of HDL code for VHDL code for an ALU.
5
Assume the following operations - Addition, Multiplication, Division, No operation. How to invoke a VHDL entity from a Verilog module. Explain mixed language description of a JK Flip Flop with a clear pin and write the simulation waveform.
6 7 8 9
Write a mixed language description of a 9 bit adder consisting of three 3 bit carry look ahead adders to show how a verilog module invokes VHDL entity. What are the facts and limitations of mixed language description?
10
Write a mixed language description of a 3-bit adder with zero flag. If the output of the adder is zero, the zero flag is set to 1;otherwise it is set to 0. Write mixed language description of Master Slave D flip flop by invoking VHDL entity from verilog module.
11
Describe full adder using 2 half adders invoking verilog module from VHDL entity.
12
Write a mixed language description of an NAND gate invoking a Verilog module from a VHDL entity.
13
Write a mixed language description of an OR gate invoking a Verilog module from a VHDL entity.
14
Write a mixed language description of an JK flipflop invoking a Verilog module from a VHDL entity.
15
Discuss the differences between mixed language descriptions and mixed type descriptions. UNIT8: SYNTHESIS BASICS
1
Write a flow diagram of synthesis. Explain its steps.
2
Write VHDL code for signal assignment statement y = 2*x + 3. Show the synthesized logic symbol and gate level diagram. Write structural code in verilog using the gate level diagram. Describe synthesis information extraction from entity and module with examples.
3 4
Explain mapping the signal assignment and variable assignment statements to Gate-level with suitable examples.
5
What is Synthesis?
6
Give synthesis information extracted, when the input and output are defined as: i) bit ii) Std_logic_vector.
7 8
Write a behavioral code in VHDL and Verilog for the signal assignment statement Y=X. Explain the mapping to gate level logic diagram. With an example, explain the mapping the function statement in HDL.
9
Discuss some important facts related to synthesis basics.
10
With an example, explain mapping if, if-else, case statements in HDL. Show the synthesized logic symbol and gate level diagram. 11 Draw the gate level synthesis information, extracted from the following verilog code. always@(s,a,b) begin
12
13
14
if(s==1’b1) Y=b; else Y=a; end. Find the gate level mapping for the following verilog code: Module if_st(a,y) Input[2:0]a; Output y; Reg y; always@(a) begin if(a<3’b101) y= 1’b1; else y= 1’b0; end end module. Design the gate level synthesis and write VHDL description for the information given below: INPUTS OUTPUT a b Z 00 0-7 z=b 01 0-7 Z=b+4 10 0-7 Z=b/2 11 XX Z=15 XX 8-15 Z=15 Write a behavioral code in VHDL and Verilog for the signal assignment statement Y=2X. Explain the mapping to a gate level diagram.