division.division_arc Architecture Reference

Division by constant power of two. More...

Inheritance diagram for division.division_arc:

Inheritance graph
[legend]
Collaboration diagram for division.division_arc:

Collaboration graph
[legend]

List of all members.


Functions

integer  safe_div ( A: in integer )
 make sure divisor is a power of two

Processes

div  ( CLK )
 Division.

Constants

c_divisor  integer := safe_div ( DIVISOR )
 divisor


Detailed Description

Division by constant power of two.

This entity divides an unsigned input of 14 bits by a constant that needs to be a power of two (otherwise XST can't infer a division by arithmetic shift). Output value is latched.

Definition at line 52 of file division.vhd.


Member Function Documentation

[Process]
div ( CLK )

Division.

Definition at line 84 of file division.vhd.

00084   div : process (CLK)
00085   begin  -- process div
00086     if CLK'event and CLK = '1' then     -- rising clock edge
00087       if RES = '1' then
00088         C <= (others => '0');
00089       else
00090         C <= A / c_divisor;
00091       end if;
00092     end if;
00093   end process div;

[Function]
integer safe_div ( A in integer )

make sure divisor is a power of two

Definition at line 55 of file division.vhd.

00055   function safe_div (
00056     A : integer)
00057     return integer is
00058     variable Ai  : integer;
00059     variable ret : integer := 2;
00060   begin  -- safe_div
00061     Ai := A;
00062     while 0 < 1 loop
00063       if Ai < 2 then
00064         ret := 2;
00065         exit;
00066       else
00067         if Ai mod 2 /= 0 then
00068           Ai := Ai - 1;
00069         else
00070           ret := Ai;
00071           exit;
00072         end if;
00073       end if;
00074     end loop;
00075     return ret;
00076   end safe_div;


Member Data Documentation

c_divisor integer := safe_div ( DIVISOR ) [Constant]

divisor

Definition at line 79 of file division.vhd.


The documentation for this class was generated from the following file:

Author: M.Niegl
Generated on Tue Nov 4 00:51:12 2008 for BCM-AAA by doxygen 1.5.7.1-20081012