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

📄 smart-gen.vhd

📁 design compile synthesis user guide
💻 VHD
字号:
package ROMS is   -- a 4x13 ROM called W_ROM containing the waveform  constant W_ROM_WIDTH: INTEGER := 4;  subtype W_ROM_WORD is BIT_VECTOR (1 to W_ROM_WIDTH);  subtype W_ROM_RANGE is INTEGER range 0 to 12;  type W_ROM_TABLE is array (0 to 12) of W_ROM_WORD;  constant W_ROM: W_ROM_TABLE := W_ROM_TABLE'(    "1100",   -- time step 0    "1100",   -- time step 1    "0100",   -- time step 2    "0000",   -- time step 3    "0110",   -- time step 4    "0101",   -- time step 5    "0111",   -- time step 6    "1100",   -- time step 7    "0100",   -- time step 8    "0000",   -- time step 9    "0110",   -- time step 10    "0101",   -- time step 11    "0111");  -- time step 12  -- a 7x13 ROM called D_ROM containing the delays  subtype D_ROM_WORD is INTEGER range 0 to 100;  subtype D_ROM_RANGE is INTEGER range 0 to 12;  type D_ROM_TABLE is array (0 to 12) of D_ROM_WORD;  constant D_ROM: D_ROM_TABLE := D_ROM_TABLE'(      1,80,5,1,1,1,1,20,5,1,1,1,1);end ROMS;use work.ROMS.all;entity WAVEFORM is        -- Smart Waveform Generator  port(CLOCK: in BIT;       RESET: in BOOLEAN;       WAVES: out W_ROM_WORD);end;architecture BEHAVIOR of WAVEFORM is  signal STEP, NEXT_STEP: W_ROM_RANGE;  signal DELAY: D_ROM_WORD;begin   -- Determine the value of the next time step  NEXT_STEP <= W_ROM_RANGE'high when                    STEP = W_ROM_RANGE'high               else                  STEP + 1;   -- Keep track of which time step we are in  TIMESTEP_COUNTER: process  begin    wait until CLOCK'event and CLOCK = '1';    if RESET then             -- Detect reset      STEP <= 0;              -- Restart waveform    elsif DELAY = 1 then      STEP <= NEXT_STEP;      -- Continue stepping    else      null;          -- Wait for DELAY to count down;    end if;          -- do nothing here  end process;  -- Count the delay between time steps.  DELAY_COUNTER: process  begin    wait until CLOCK'event and CLOCK = '1';    if RESET then             -- Detect reset      DELAY <= D_ROM(0);      -- Restart    elsif DELAY = 1 then      -- Have we counted down?      DELAY <= D_ROM(NEXT_STEP);  -- Next delay value    else      DELAY <= DELAY - 1;   -- decrement DELAY counter    end if;  end process;  WAVES <= W_ROM(STEP);     -- Output waveform valueend BEHAVIOR;

⌨️ 快捷键说明

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