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

📄 div_by_n.tdf

📁 里面包含15个altera的IP核的源代码,包括I2C
💻 TDF
字号:
TITLE "div_by_n Frequency Divider Module"; 
-- Version 2.0, January 29, 1998
-- Copyright Rune Baeverrud, 1996-1998
-- You may use or distribute this function freely,
-- provided you do not remove this copyright notice.
-- If you have questions or comments, feel free to
-- contact me by email at r@acte.no 
-- World Wide WEB: http://www.acte.no/freecore

PARAMETERS
(
  DIVISOR = 2
);

CONSTANT NUM_BITS = CEIL(LOG2(DIVISOR));
CONSTANT DIVISOR_MINUS_ONE = DIVISOR - 1;

INCLUDE "lpm_counter";
INCLUDE "lpm_compare";

SUBDESIGN div_by_n
(
  SysClk           : INPUT;
  cnt_en           : INPUT = VCC;
  sclr             : INPUT = GND;
  Every_N          : OUTPUT;
  q[NUM_BITS-1..0] : OUTPUT;
)

VARIABLE
  counter          : LPM_COUNTER WITH (LPM_WIDTH = NUM_BITS);
  max_cnt          : NODE;
  Deglitch         : DFF;

BEGIN
  ASSERT (DIVISOR > 1)
	REPORT "Value of DIVISOR parameter (%) must be equal to or greater than 2"
      DIVISOR
	SEVERITY ERROR;

  ASSERT
    REPORT "div_by_n module will operate internally using % bits."
      NUM_BITS
    SEVERITY INFO;

  max_cnt = LPM_COMPARE(DIVISOR_MINUS_ONE, counter.q[],,)
            WITH (LPM_WIDTH = NUM_BITS,
                  ONE_INPUT_IS_CONSTANT = "YES")
            RETURNS (.aeb);
 
  counter.clock  = SysClk;
  counter.cnt_en = cnt_en;
  counter.sclr   = (max_cnt AND cnt_en) OR sclr;

  Deglitch     = max_cnt AND cnt_en;
  Deglitch.clk = SysClk;
  Every_n      = Deglitch;

  q[] = counter.q[];
END;



⌨️ 快捷键说明

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