Monday, February 18, 2013

Necessity of Hardware Description Language

Introduction:


    HDL stands for Hardware Description Language. Many of us knew whats the use of HDL and how to design and model a digital circuit. But most of us doesnt know  why actually  this HDL is used,I mean many of us doesn't know the necessity of the HDL and why this HDL came into existence. In addition to these, most of the  programmers assume that both HDL and programming language are same. But there exists some differences between them. And also one thing most of the books on HDL  explains us the  syntax of the various constructs present in the language, different styles of architecture writing, in depth explanation of the complicated  concepts of HDL. But the answers for the above mentioned fundamental questions are not found in most of the books.

Necessity of the HDL:


    Before going to necessity of the HDL, first we should know the concept of Modular Design. What the concept of modular design states is that a complex task  can be divided into many small tasks called as Modules and finally the complex big task is achieved by integrating all the small modules together. This concept is  the foundation on which whole of the HDL is developed.
    Now we can think of the necessity of the HDL. Basically HDL is used to design the digital modules for Integrated Circuit(IC Chips). Hopefully as we all knew the structure of the circuit inside the IC chip is very complex. So designing that complex circuit structure in IC in one circuit is very tedious task. Assume we  have designed such an complex circuit in one circuit, then debugging for errors in the circuit, if any found during simulation, is another difficult task. Future enhancements and any extensions for such type of circuits for sure it will be a nightmare for circuit designers. In order to make the work of circuit designers
simpler HDL is developed.
    The main aim of the HDL is to make process of designing an circuit as much simpler as possible there by assisiting circuit designers. How HDL achieves this task is by using the approach of modular design. So basically what HDL does is that a complex big circuit is divided into many smaller circuits called Modules.  After dividing, using HDL each module is assigned a smaller task, its input and output signals are defined. This process is done for all modules. Finally a hardware description of the entire is available which is used by the circuit designers to design the complex circuit in terms of small modules. Hence HDL is the standard  way of describing the structure of a complex circuit.
    Normally HDL is used in designing complex digital circuits like Integrated Circuit Chips, Digital Data Memory Devices, Motherboard and so on. Some of the available basic digital circuits includes universal gates, full and half adder, full subtractor, multiplexer, de-multiplexer, encoder, decoder, flip flops. So all  the complex digital circuits can be realized in terms of the basic modules listed above. In other words we can say, any complex digital circuit can be divided into number of basic modules.
    Consider the designing of a complex digital circuit such as 8085 processor, what HDL basically does is dividing the complex circuit of 8085 into basic digital  modules (in other words, realizing the complex circuit of 8085 in terms of basic digital modules), defining the input and output signals (in other words task of  each basic module is defined). After these, the main role of HDL is that the interconnection between these smaller modules are defined in such a way that the  complex  structure of the digital circuit is achieved. At last, the final HDL description of the digital circuit is used as a reference while designing the circuit.
   

Differences between HDL and programming language:


    Finally coming to the difference between HDL and programming language, there are some small differences. Firstly, the HDL is extensively used in the  pre-manufacturing stage of the ICs and the programming language is used on manufactured and tested ICs. Secondly the HDL is basically used to describe the  hardware structure of the IC whereas the programming language is used to achieve a task from IC.

An Example:
            Let me take a simple example to explain the importance of HDL. Let us assume a Full Adder and a 4-bit Parallel Adder. As we all know a full adder has three inputs and one output. It takes two data bits and one carry input bit as input data, adds them and generates one sum bit and one carry out bit as output bits. The block diagram of a full adder is as shown below:
                                                          Figure: Block diagram of a full adder
The data bits are a,b and carry input bit is Cin. Cout is the carry out bit. Full adder adds the bits ‘a’ and ‘b’ along with ‘Cin’ and generates ‘Sum’ and ‘Cout’ as output bits. Hence the hardware description of a Full adder consists of three input signals and two output signal.
The truth table of  Full adder is:
a
b
Cin
Sum
Cout
0
0
0
0
0
0
0
1
1
0
0
1
0
1
0
0
1
1
0
1
1
0
0
1
0
1
0
1
0
1
1
1
0
0
1
1
1
1
1
1
Looking at the truth table of Full adder, the equation for Sum is
Sum =  (a.(b`).(Cin`)) + ((a`).b.(Cin`)) + ((a`).(b`).Cin) + (a.b.Cin) = (a xor b) xor Cin
And the equation for Cout is
Cout = (a.b) + (b.Cin) + (Cin.a)
Where
. is Logical AND operation
+ is Logical OR operation
` is the Logical NOT operation
The Structure of a Full Adder is:

                                                Figure: Structure of a Full Adder

Now consider a 4-bit parallel adder, whose block diagram is as shown below:
                                              Figure: Block diagram of a 4-bit Parallel adder
Basically what a 4-bit Parallel adder does is it two sets of 4-bit data all at one time, adds them and generates a 4-bit sum and a carry out at one shot. Hence the name parallel adder. An overview of how an 4-bit parallel adder works is as given below: let a(0-3) and b(0-3) be 4-bit data set and S(0-3) be the 4-bit sum and Cout be the carry out.
a(0) + b(0) à S(0), c(1)
a(1) + b(1)+c(1) à  S(1), c(2)
a(2) + b(2) + c(2) à S(2), c(3)
a(3) +  b(3) + c(3) à S(3), c4 = Cout.
The meaning of the above equations are to generate a sum bit and a carry out bit, the carry out generated in the additon of previous bit is taken as carry input of next stage. For the initial bit, the carry input is taken as zero.
By comparing the functionalities of a Full adder and 4-bit Parallel adder, the function of the latter is quite complex and so is the structure of the circuit. Assuming that 4-bit parallel adder is realized in one circuit model, its a quite complicated task and the structure of such a circuit is also quite complex. Hence we need to make the complex circuit of 4-bit parallel adder as much simpler as possible. Looking at the functionality of the 4-bit parallel adder, it can be toought  four full adders connected in cascade. Now the role of an HDL here is to define the input and output signals for each full adder and also to define the interconnection patterns between the full adders in a standard way inorder to achieve the reqired function of 4-bit full adder. This hardware description is used by the circuit designers, who comes next in the process of IC manufacturing, to design the complex circuits in simpler manner.
The simpler structure of 4-bit parallel adder is: 

                                           Figure: Simpler structure of a 4-bit Parallel adder
The simpler structure of 4-bit parallel adder consists of four full adders connected in cascade. The hardware description of 4-bit parallel adder consists of two sets of 4-bit data, a(0-3) and b(0-3), a carry input bit Cin as input signals and 4-bit sum  s(0-3), carry out Cout as output signals. In addition to these we have three signals c(1-3), intermediate carry, as interconnecting signals, which are both input signal to the next bit addition and output signal of the previous bit addition.
One thing we should remember that as the number functions performed by the circuit increases, it is quite obvious that the complexity of the circuit also increases. So don’t think of necessity of HDL to small circuits like 4-bit parallel circuit. I have given this simple example just to make you to understand that as the number functions performed by the circuit increases, the complexity of the circuit also increases. But if we think of designing multiple tasks performing cicuits like processor chips, microcontroller chips, digital memory devices such as RAM, Hard disks so on, motherboard circuits, definitely we find the necessity of HDL since structure of these circuits are quite complicated. And also one thing if the structure of the digital circuit is simpler, we will not find much the necessity of HDL. Basically HDL is developed to make the process of designing circuits which are having highly complicated structures easier.




No comments:

Post a Comment