📄 pcm.vhd.bak
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity PCM is
Port(
Reset :in std_logic;
PCLK :in std_logic;
S_Data :in std_logic;
FSYNC :in std_logic;
Slot :in std_logic_vector(7 downto 0);--可以最大256个时隙,固定抓某个时隙
PCM_Data :out std_logic_vector(7 downto 0);
L_Data :out std_logic --上升沿锁存
);
end entity;
architecture ART_PCM of PCM is
-- signal MaxSlot :std_logic_vector(7 downto 0); --根据PCLK求出当前PCM总线最大的Slot数
-- signal PCLK_8 :std_logic;
begin
----------------------------------
-- Process(Reset, PCLK)
-- variable count :std_logic_vector(2 downto 0);
-- begin
-- if Reset = '0' then
-- count := "000";
-- elsif PCLK'event and PCLK = '1' then
-- count := count + 1;
-- PCLK_8 <= count(2);
-- end if;
-- end process;
---------------------------------
-- Process(Reset, PCLK_8)
-- variable count :std_logic_vector(7 downto 0);
-- variable start :std_logic;
-- begin
-- if Reset = '0' then
-- count := (others => '0');
-- start := '0';
-- elsif PCLK_8'event and PCLK_8 = '1' then
-- if FSYNC = '1' then
-- if start = '1' then
-- MaxSlot <= count;
-- end if;
-- count := "00000000";
-- start := not start;
-- else count := count + 1;
-- end if;
-- end if;
-- end process;
--------------------------------------------
Process(Reset, PCLK, FSYNC)
variable Chunnel :std_logic_vector(7 downto 0);--当前Slot
variable Count :std_logic_vector(2 downto 0);--记下通道内时钟
variable databuf :std_logic_vector(7 downto 0); --pcmdata
variable lastFsync :std_logic;
begin
if Reset = '0' then
PCM_Data <= (others =>'0');
databuf := (others =>'0');
Count := (others =>'0');
Chunnel := (others =>'0');
lastFsync := '0';
L_Data <= '0';
elsif PCLK'event and PCLK = '0' then --下降沿采集数据
if Chunnel = Slot + 1 and Count = "000" then
PCM_Data <= databuf;
L_Data <= '1';
end if;
if FSYNC = '1' and lastFsync = '0' then
Count := "000";
Chunnel := "00000000";
L_Data <= '0';
else
databuf := databuf(6 downto 0) & S_Data;--MSB first
if Count = "111" then
Chunnel := Chunnel + 1;
end if;
Count := Count + 1;
end if;
lastFsync := FSYNC;
end if;
end process;
-----------------------------------------------------
end ART_PCM;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -