Posts

Showing posts from May, 2020

Verilog Code | Datapath and Controller Design | Design 2 | GCD of two numbers

Image
Problem Statement : In the previous blog, we discussed on how data path and control paths can be together designed in complex digital systems. We take up one more design example in this blog to get better understanding of the design procedure . We shall be taking another example, namely that of computing the GCD of two numbers (greatest common divisor , also known as HCF) . Note that the GCD of two numbers is defined as the largest integer that divides both of them. For example if you have one number as 26 one number as 39 and if you compute the GCD of them. GCD will be 13,  because 13 is the largest number which divides 26 as well as 39. Algorithm Designed : The method we follow is the method of repeated subtraction so the algorithm is depicted in this flowchart . Fig 1 : Algorithm being implemented The algorithm i s very simple. If you are given two numbers A and B , for which you are trying to compute the GCD. Then you compare A and B.  If A is less than B,  then subt...

Verilog Code | Datapath and Controller Design | Design 1 | Multiplication by Repeated Addition

Image
What are Data path and Control Paths in Digital domain ? Whenever we are trying to build a complex system , it will consist of a mix of combinational and sequential circuits. In this blog we try to come up with Verilog code for  such complex systems. To begin with a basic idea, we need to understand that in any  complex digital systems, the whole hardware is typically partitioned into two parts, data path and controller part. The data path  consists of the functional units where all the computations are carried out. So essentially a data path will consist of typically some registers to store some data , multiplexers or adders, subtractors, multipliers, counters and similar functional blocks. So in a datapath part there are a lot of hardware and things which are there but we are not specifying or telling exactly what to do with those hardware. All I can tell is that there are three registers,  there is one adder , one subtractor and one counter but I am not specifying...