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

Subversion Repositories lateq

[/] [lateq/] [trunk/] [hdl_various_types/] [src/] [ex1_trees_pkg.vhd] - Rev 4

Go to most recent revision | Compare with Previous | Blame | View Log

-------------------------------------------------------------------------------
-- Title      : ex1_trees_pkg package for example1
-- Project    : 
-------------------------------------------------------------------------------
-- File       : ex1_trees_pkg.vhd
-- Author     : Wojciech M. Zabolotny ( wzab01<at>gmail.com )
-- Company    :
-- License    : BSD
-- Created    : 2013-11-01
-- Last update: 2015-09-24
-- Platform   : 
-- Standard   : VHDL'93/02
-------------------------------------------------------------------------------
-- Description: Package with definitions needed to create the hierarhical
--              block for finding the maximum element and hierarchical adder
-------------------------------------------------------------------------------
-- Copyright (c) 2014 
-------------------------------------------------------------------------------
-- Revisions  :
-- Date        Version  Author  Description
-- 2013-11-01  1.0      WZab    Created
-------------------------------------------------------------------------------
 
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use std.textio.all;
library work;
use work.lateq_pkg.all;
use work.ex1_pkg.all;
 
package ex1_trees_pkg is
 
  -- Constant and type for the "Max Finder" part
  constant EX1_NOF_INS_IN_CMP : integer := 3;  -- number of inputs in a single comparator
  type T_EX1_CMP_INS is array (0 to EX1_NOF_INS_IN_CMP-1) of T_SINGLE_DATA_WITH_POS;
 
  -- Constant and type for the "Adder" part
  constant EX1_NOF_INS_IN_ADD : integer := 2;  -- number of inputs in a single adder
  type T_EX1_ADD_INS is array (0 to EX1_NOF_INS_IN_ADD-1) of T_CALC_DATA_MRK;
 
 
 
  function ex1_nof_stages (
    constant n_of_all_ins : integer;
    constant n_of_ins     : integer)
    return integer;
 
end package ex1_trees_pkg;
 
package body ex1_trees_pkg is
 
  -- The function returns number of stages needed to find the
  -- maximum element in a tree of comparators
  function ex1_nof_stages (
    constant n_of_all_ins : integer;
    constant n_of_ins     : integer)
    return integer is
    variable res  : integer := 0;
    variable nins : integer := 1;
  begin  -- function ex1_nof_stages
    nins := 1;
    while nins < n_of_all_ins loop
      nins := nins * n_of_ins;
      res  := res + 1;
    end loop;
    return res;
  end function ex1_nof_stages;
 
end package body ex1_trees_pkg;
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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