Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Division Algorithm

Reply
Thread Tools

Division Algorithm

 
 
Gurka Gurka is offline
Junior Member
Join Date: Jul 2008
Posts: 1
 
      07-29-2008
Hi everybody, i've made a division algorithm using the restoration algorithm for division. I has 0 errors, but it doesn't seem to work as it should. In the simulation it doesn't start with the "inicialization" values I gave to it (red color), is correct to do this? Thank you very much for your time






The other question is about the rotation on the same vector (green)
sROTADO(8 downto 0)<=(sROTADO(7 downto 0) & sROTADO();
Is there any problem with this "overwriting" on the same signal?, thank you a lot and sorry for my english! Im from Argentina!

library IEEE;
use IEEE.Std_Logic_1164.all;
use IEEE.Std_Logic_arith.all;
use IEEE.Std_Logic_unsigned.all;



entity DIVISION is
port( clk:in std_logic;
DIVIDENDO:in std_logic_vector (3 downto 0);
DIVISOR:in std_logic_vector (3 downto 0); COCIENTEut std_logic_vector (3 downto 0);
RESTOut std_logic_vector (3 downto 0));
end DIVISION;


architecture FUNC of DIVISION is

signal sCONTADOR: integer;
signal sROTADO:std_logic_vector (8 downto 0);
signal sRESTA:std_logic_vector (4 downto 0);


begin


ROTARYRESTARrocess(clk)
begin


if (clk'event and clk='1') then
sROTADO<= ("00000" & DIVIDENDO);
sCONTADOR<=0;


if sCONTADOR<=4 then
sROTADO(8 downto 0)<=(sROTADO(7 downto 0) & sROTADO(); sRESTA(4 downto 0)<= (sROTADO(8 downto 4) - ('0' & DIVISOR));

if sRESTA(4)='1' then sROTADO(0)<='0';
sCONTADOR<=sCONTADOR+1;
elsif sRESTA(4)='0' then sROTADO(0)<='1';
sROTADO(8 downto 4)<= sRESTA(4 downto 0);
sCONTADOR<=sCONTADOR+1;
end if;

else
COCIENTE<=sROTADO(3 downto 0);
RESTO<=sROTADO(7 downto 4);
end if;
end if;
end process ROTARYRESTAR;


end FUNC;
 
Reply With Quote
 
 
 
 
jeppe jeppe is offline
Senior Member
Join Date: Mar 2008
Location: Denmark
Posts: 346
 
      07-29-2008
Hi
Seams you like to make a sequential division.
Hope you will find this link useful.
http://jjmk.dk/MMMI/Lessons/06_Arith...sion/Index.htm

your welcome
Jeppe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
fastest complex division algorithm axr0284 VHDL 3 10-01-2012 01:14 PM
division by 7 without using division operator krypto.wizard@gmail.com C Programming 94 02-09-2007 06:57 AM
Filtered Back Projection Algorithm (FBP Algorithm) Bapaiah Katepalli VHDL 1 06-23-2006 04:50 PM
Key generation algorithm and Cipher algorithm Ahmed Moustafa Java 0 11-15-2003 06:35 AM
will Synposys Design Compiler support division by two's power and integer rounding? walala VHDL 12 09-14-2003 03:49 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57