📄 wave-gen.vhd
字号:
package ROMS is -- a 4x13 ROM called ROM that contains the waveform constant ROM_WIDTH: INTEGER := 4; subtype ROM_WORD is BIT_VECTOR (1 to ROM_WIDTH); subtype ROM_RANGE is INTEGER range 0 to 12; type ROM_TABLE is array (0 to 12) of ROM_WORD; constant ROM: ROM_TABLE := 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 12end ROMS;use work.ROMS.all;entity WAVEFORM is -- Waveform generator port(CLOCK: in BIT; RESET: in BOOLEAN; WAVES: out ROM_WORD);end; architecture BEHAVIOR of WAVEFORM is signal STEP: ROM_RANGE;begin TIMESTEP_COUNTER: process -- Time stepping process begin wait until CLOCK'event and CLOCK = '1'; if RESET then -- Detect reset STEP <= ROM_RANGE'low; -- Restart elsif STEP = ROM_RANGE'high then -- Finished? STEP <= ROM_RANGE'high; -- Hold at last value-- STEP <= ROM_RANGE'low; -- Continuous wave else STEP <= STEP + 1; -- Continue stepping end if; end process TIMESTEP_COUNTER; WAVES <= ROM(STEP);end BEHAVIOR;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -