OpenCores
URL https://opencores.org/ocsvn/loadbalancer/loadbalancer/trunk

Subversion Repositories loadbalancer

[/] [loadbalancer/] [trunk/] [TABLE/] [div_binary.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 atalla
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
 
6
 
7
entity div_binary is
8
Port (
9
 
10
ina : in std_logic_vector (11 downto 0);
11
inb: in std_logic_vector (11 downto 0);
12
quot: out std_logic_vector (11 downto 0)
13
);
14
 
15
end div_binary;
16
 
17
architecture Behavioral of div_binary is
18
 
19
signal a,b: integer range 0 to 65535;
20
begin
21
 
22
a <= CONV_INTEGER(ina);
23
b <= CONV_INTEGER(inb);
24
process (a,b)
25
 
26
variable temp1,temp2: integer range 0 to 65535;
27
variable y : std_logic_vector (11 downto 0);
28
begin
29
temp1:=a;
30
temp2:=b;
31
for i in 11 downto 0 loop
32
if (temp1>temp2 * 2**i) then
33
y(i):= '1';
34
temp1:= temp1- temp2 * 2**i;
35
else y(i):= '0';
36
end if;
37
end loop;
38
quot<= y;
39
--quot<= conv_integer (y); 
40
end process;
41
 
42
 
43
end Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.