Computer Science, asked by syedkhurrath, 4 months ago

verilog code for nikilam sutra?
please give me correct answer I rrequest
or else suggest a book which I should refer r a link anything

Answers

Answered by zoharameen88
0

Explanation:

Hello guys , i have recently worked on vedic multipliers and have referred few papers too to implement it. I want to make this project open to everyone so that you can build your own Vedic multipliers and compare the results.Previously i have written about 2x2 bit Vedic multipliers which you can refer back again. We will start by designing a 2x2 multipliers and will develop a 16x16 multipliers. Once we are done with this we will proceed to build a MAC unit. A complete module which has 16x16 multiplier/MAC/ADD-SUB will be our end design

2X2 multiplier:

Design:

Figure illustrates the steps to to multiply two 2 bit numbers (design detail). Converting the above figure to a hardware equivalent we have 3 and gates which will act as 2 bit multipliers and two half adders to add the products to get the final product. Here is the hardware detail of the multiplier

Where "a" and "b" are two numbers to be multiplied and "q" is the product. With this design we are now ready to code this in verilog easily using and gates and HA(half adders). To make the design more modular we try to write code for HA first and then instantiate it to have the final product.

Code:


zoharameen88: Nikhilam Sutra stipulates subtraction of a number from the nearest power of 100 ie 10,100,1000,etc. ... Nikhilam Sutra in Vedic Mathematics can be used as shortcuts to multiply numbers, divide numbers in faster approach. In English it is translated as All from 9 and last from 10.
zoharameen88: I have a photo but I'm unable to post it in comments section
zoharameen88: it's a complete nikhilam sutra
Answered by MdAnas4jun2006
0
Answer

Design and implementation of 16 Bit Vedic Arithmetic Unit
Hello guys , i have recently worked on vedic multipliers and have referred few papers too to implement it. I want to make this project open to everyone so that you can build your own Vedic multipliers and compare the results.Previously i have written about 2x2 bit Vedic multipliers which you can refer back again. We will start by designing a 2x2 multipliers and will develop a 16x16 multipliers. Once we are done with this we will proceed to build a MAC unit. A complete module which has 16x16 multiplier/MAC/ADD-SUB will be our end design


2X2 multiplier:
Design:

Figure illustrates the steps to to multiply two 2 bit numbers (design detail). Converting the above figure to a hardware equivalent we have 3 and gates which will act as 2 bit multipliers and two half adders to add the products to get the final product. Here is the hardware detail of the multiplier



Where "a" and "b" are two numbers to be multiplied and "q" is the product. With this design we are now ready to code this in verilog easily using and gates and HA(half adders). To make the design more modular we try to write code for HA first and then instantiate it to have the final product.








Code:



4X4 multiplier:
Design:

Using 4 such 2x2 multipliers and 3 adders we can built 4x4 bit multipliers as shown in the design. Proper instantiating of the 2x2 multipliers and adders. We have to first write code for 4bit and 6 bit adders. Its your choice to choose your adders. If in case you want to have better performance you can replace these normal adders with CSA or compressors. For a simpler design we have used the "+" operator which is supported by the XST synthesis tool which by default selects a low hardware adder. This architecture follows wallace tree which reduces the addition levels from 3 to just 2 stages as shown. Arrangement of the adders and the addition is explained from the figure shown below:


Code:




Link for the coupons : Here
8X8 multiplier:
Design:

similar to the previous design of 4x4 multiplier , we need 4 such 4x4 multipliers to develop 8x8 multipliers. Here we need to first design 8bit and 12 bit adders and by proper instantiating of the module and connections as shown in the figure we have designed a 8x8 bit multiplier. At this point of time its necessary for you to even verify the RTL code and check if the hardware is as per your design. PlanAhead tool by xilinx gives better view of the hardware design with design elaborate option(will explain this in my next posts). Refer the addition tree diagram to know the process for 8x8 multiplier:



Code:


16x16 multiplier:
Design:



Follow the same steps as in case of previous multipliers and develop 16x16 multipliers. Refer the adder tree diagram below :


code:



Here is the test bench for 16x16 vedic multipliers :



Simulation results:






RTL:






















MAC design:

TO being with MAC design we have to first design a accumulator which adds two number . One of which is the output of the previous stage and the other is the output from the multiplier module. Figure below shows the implementation design for mac.














It can be seen from the block diagram that the accumulator module has one input( we have designed this module be be synchronous so we have used Clock as second input). Few more control signals are required to clear(clr) the ACC unit and enable signal(en) to initiate the process of accumulation. We replace the MUL unit shown in the diagram above with out 16x16 multiplier module. Here is the code for MAC unit

code:


Simulation results :



This module cane be further devloped to convert the top module into ALU by designing your own adder/substractor and making this as the top module. please let me know if there is anything you did not understand. We are happy to help. Thank you.










Note: Replace the modules with name "add_N_bit" with a N bit adder. You can use your own adder in place of this module like csa/cla etc. If speed is not of major concern for your design use the "+" operator to create the adder modules.

RTL:


syedkhurrath: can u atleast reply
zoharameen88: ??
zoharameen88: any doubt ?
syedkhurrath: yeah
syedkhurrath: I need proper for nikilam sutra
syedkhurrath: c o d e
zoharameen88: check I answered in my answer's comment section
syedkhurrath: c o d e part is not displaying
syedkhurrath: I can only see matter
syedkhurrath: no c o d e and simulation
Similar questions