- -------------------------------------------------------------------------------
- -- Title : Global Project Package
- -- Project : Audio Signal Processing
- -------------------------------------------------------------------------------
- -- $Id: Global-p.vhd,v 1.7 2003/12/01 19:51:06 pfaff Mod $
- -------------------------------------------------------------------------------
- -- Author : Copyright 2003: Markus Pfaff
- -- Standard : Using VHDL'93
- -- Simulation : Model Technology Modelsim
- -- Synthesis : Exemplar Leonardo
- -------------------------------------------------------------------------------
- -- Description:
- --
- -------------------------------------------------------------------------------
- library ieee;
- use ieee.std_logic_1164.all;
- use ieee.numeric_std.all;
- package Global is
- -----------------------------------------------------------------------------
- -- Definitions that are not project specific.
- -----------------------------------------------------------------------------
- -- Avoid the traps of inverted logic and make the code more text like by
- -- reducing numbers.
- constant cActivated : std_ulogic := '1';
- constant cInactivated : std_ulogic := '0';
- -- Now the same for inverted logic.
- constant cnActivated : std_ulogic := '0';
- constant cnInactivated : std_ulogic := '1';
- -- constants for unitEdgeDetector
- constant cDetectRisingEdge : natural := 0;
- constant cDetectFallingEdge : natural := 1;
- constant cDetectAnyEdge : natural := 2;
- -----------------------------------------------------------------------------
- -- Project specific definitions that will typically exist for every project.
- -----------------------------------------------------------------------------
- -- Reset polarity
- -- This constant is not used in this project. Instead a low active reset
- -- is used.
- -- constant cResetActive : std_ulogic := cnActivated;
- ------------------------------------------------------------------------------
- -- Function Definitions
- ------------------------------------------------------------------------------
- -- function log2 returns the logarithm of base 2 as an integer
- function LogDualis(cNumber : natural) return natural;
- end Global;
- package body Global is
- -- Function LogDualis returns the logarithm of base 2 as an integer.
- -- Although the implementation of this function was not done with synthesis
- -- efficiency in mind, the function has to be synthesizable, because it is
- -- often used in static calcualions.
- function LogDualis(cNumber : natural) return natural is
- variable vClimbUp : natural := 1;
- variable vResult : natural;
- begin
- while vClimbUp < cNumber loop
- vClimbUp := vClimbUp * 2;
- vResult := vResult+1;
- end loop;
- return vResult;
- end LogDualis;
- end Global;
Undefined
By: global-p.vhd | Date: Mar 20 2008 09:55 | Format: None | Expires: never | Size: 2.83 KB | Hits: 1295
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago