|
现在在做一个红外线的project.RC5 生成一个信号个给检测器,检测器会产生一组14 bits的数据流(是一组曼彻斯特编码)。想用VHDL做一个解码器。试了很多种方法都失败了,特来寻找高手帮忙解决些这个问题。
- LIBRARY ieee;
- USE ieee.std_logic_1164.all;
- USE ieee.numeric_std.all;
- ENTITY MANC_decoder IS
- GENERIC(
- CLOCK_PERIOD : integer := 200
- );
- PORT(
- --RESET : IN STD_LOGIC;
- --CLK : IN STD_LOGIC;
- MANC_DATA : IN STD_LOGIC;
- DATA_OUT : OUT STD_LOGIC
- );
- END MANC_decoder ;
- ARCHITECTURE rtl OF MANC_decoder IS
- SIGNAL MANC_DATA_INT : STD_LOGIC;
- SIGNAL CLK : STD_LOGIC;
- SIGNAL RESET : STD_LOGIC;
- BEGIN
-
- DATA_OUT <= MANC_DATA_INT;
- RESET_generator: PROCESS
- BEGIN
- RESET <= '1';
- WAIT FOR 200 ns;
- wait until rising_edge(CLK);
- RESET <= '0';
- WAIT;
-
- END PROCESS RESET_generator;
- clock_generator: PROCESS
- BEGIN
- CLK <= '1';
- WAIT FOR (CLOCK_PERIOD/2) * 1 ns;
- CLK <= '0';
- WAIT FOR (CLOCK_PERIOD/2) * 1 ns;
- END PROCESS clock_generator;
- MANC_decoder : PROCESS (RESET,CLK)
- BEGIN
-
- IF (RESET = '1') THEN
- MANC_DATA_INT <= '0';
-
- ELSIF Rising_edge(CLK) THEN
-
- IF (MANC_DATA = '1') THEN
- MANC_DATA_INT <= '0';
- ELSE
- MANC_DATA_INT <= '1';
- END IF;
- --ELSIF (CLK'event AND CLK = '1' AND MANC_DATA = '1' ) THEN
- -- MANC_DATA_INT <= '0';
- --ELSIF (CLK'event AND CLK = '1' AND MANC_DATA = '0' ) THEN
- -- MANC_DATA_INT <= '1';
- --ELSIF (CLK'event AND CLK = '0' AND MANC_DATA = '1' ) THEN
- -- MANC_DATA_INT <= '1';
- --ELSIF (CLK'event AND CLK = '0' AND MANC_DATA = '0' ) THEN
- -- MANC_DATA_INT <= '0';
- -- CASE CLK IS
- -- WHEN '1'=>
- -- IF (MANC_DATA = '1') THEN
- -- MANC_DATA_INT <= '0';
- -- ELSE
- -- MANC_DATA_INT <= '1';
- -- END IF;
- -- WHEN '0'=>
- -- IF (MANC_DATA = '1') THEN
- -- MANC_DATA_INT <= '1';
- -- ELSE
- -- MANC_DATA_INT <= '0';
- -- END IF;
- -- WHEN OTHERS => NULL;
- -- END CASE;
- END IF;
-
- END PROCESS MANC_decoder;
- END ARCHITECTURE rtl;
复制代码
|
|