⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arith_utils.vhd

📁 Cadence的VHDL运算库包
💻 VHD
字号:
--------------------------------------------------------------------------------- Title       : Utility functions-- Project     : VHDL Library of Arithmetic Units--------------------------------------------------------------------------------- File        : arith_utils.vhd-- Author      : Reto Zimmermann  <zimmi@iis.ee.ethz.ch>-- Company     : Integrated Systems Laboratory, ETH Zurich-- Date        : 1997/11/04--------------------------------------------------------------------------------- Copyright (c) 1998 Integrated Systems Laboratory, ETH Zurich--------------------------------------------------------------------------------- Description :-- Package of utility functions used in code for arithmetic units.-------------------------------------------------------------------------------library ieee;use ieee.std_logic_1164.all;-------------------------------------------------------------------------------package arith_utils is    function log2ceil (n : integer) return integer;  function log2floor (n : integer) return integer;end arith_utils;-------------------------------------------------------------------------------package body arith_utils is  -- purpose: computes ceil(log2(n))  function log2ceil (n : integer) return integer is    variable m, p : integer;  begin    m := 0;    p := 1;    for i in 0 to n loop      if p < n then        m := m + 1;        p := p * 2;      end if;    end loop;    return m;  end log2ceil;      -- purpose: computes floor(log2(n))  function log2floor (n : integer) return integer is    variable m, p : integer;  begin    m := -1;    p := 1;    for i in 0 to n loop      if p <= n then        m := m + 1;        p := p * 2;      end if;    end loop;    return m;  end log2floor;    end arith_utils;-------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -