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

📄 tormenta2.vhd

📁 This a SOFTWARE pbx DRIVER
💻 VHD
📖 第 1 页 / 共 2 页
字号:
-- Tormenta2 -- PCI Telephony Interface Card -- VHDL for Xilinx Part-- version 1.4, 10/10/2002.-- Copyright (c) 2001-2002, Jim Dixon. ---- Jim Dixon <jim@lambdatel.com>-- Mark Spencer <mark@linux-support.net>---- This program is free software, and the design, schematics, layout,-- and artwork for the hardware on which it runs is free, and all are-- distributed under the terms of the GNU General Public License.---- Thanks to Mark and the gang at Linux Support Services for the contribution-- of the initial buffering code.------ The A4 die of the Dallas 21Q352 chip has a bug in it (well, it has several actually,-- but this is the one that effects us the most) where when you have it in IBO mode-- (where all 4 framers are combined into 1 8.192 Mhz backplane), the receive data-- comes out of the chip late. So late, in fact, that its an entire HALF clock cycle -- off. So what we had to do is have a separate RSYSCLK signal (which was the TSYSCLK-- signal inverted) and a separate RSYNC signal (which corresponds to the RSYSCLK inverted-- signal as opposed to the TSYSCLK) that was 1/2 clock cycle early, so that the data comes-- out at the correct time. library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity tormenta2 is    Port ( -- GCK0 signal (Local bus clock)			  CLK : in std_logic;-- GCK1 signal 8.192 Mhz clock from mk1574 and drives SYSCLK's on Dallas chip		     CLK8192 : in std_logic;-- Tx Framing Pulse to Dallas chip           TSSYNC : out std_logic;-- Rx Framing Pulse to Dallas chip           RSYNC : out std_logic;-- 8 Khz square wave for input to mk1574 (RCLKO divided by 193)           KHZ8000 : out std_logic;-- RSER from Dallas chip (received serial data)           RSER : in std_logic;-- TSER to Dallas chip (transmitted serial data)           TSER : out std_logic;-- RCLK output to Dallas chip (TCLK)  (1.544 Mhz)           RCLKO : out std_logic;-- RCLK 1-4 are RCLK inputs from SCT's, 0 is 1.544 Mhz oscillator           RCLK : in std_logic_vector(4 downto 0);--           LCLK is tied to GCK0, so you dont specify it here.--			    CCLK, CPROGRAM, and CDONE are tied to dedicated pins, so you dont either.-- Local bus Data Bus           D : inout std_logic_vector(31 downto 0);-- Local bus Address Bus           ADDR : in std_logic_vector(11 downto 2);-- Local bus Byte Enable lines (also BE0 is A0 and BE1 is A1 for 8 bit operations)           BE : in std_logic_vector(3 downto 0);-- Local bus "WR" signal           WR : in std_logic;-- Local bus "RD" signal           RD : in std_logic;-- Local bus READY signal out (also Configuration BUSY signal)           READY : out std_logic;-- Local bus INTerrupt signal           INT : out std_logic;-- Chip selects for Dallas chip SCT's 1 thru 4           CS : out std_logic_vector(4 downto 1);-- Dallas chip WRite signal           DWR : out std_logic;-- Dallas chip ReaD signal           DRD : out std_logic;-- Dallas chip INTerrupt signal in           DINT : in std_logic;-- LED's output			  LEDS : out std_logic_vector(7 downto 0);-- Board ID input			  BOARDID : in std_logic_vector(3 downto 0);-- TEST pins			  TEST1 : inout std_logic;			  TEST2 : inout std_logic;			  TEST3 : inout std_logic;			  TEST4 : inout std_logic;-- BTERM output			  BTERM : out std_logic;-- MASTER output			  MASTER : out std_logic;-- XSYNCIN input			  XSYNCIN: in std_logic;-- XSYNCOUT output			  XSYNCOUT: out std_logic);end tormenta2;architecture behavioral of tormenta2 iscomponent RAMB4_S1_S16   port (    ADDRA: IN std_logic_vector(11 downto 0);	 ADDRB: IN std_logic_vector(7 downto 0);	 DIA:	  IN std_logic_vector(0 downto 0);	 DIB:	  IN std_logic_vector(15 downto 0);	 WEA:   IN std_logic;	 WEB:   IN std_logic;	 CLKA:  IN std_logic;	 CLKB:  IN std_logic;	 RSTA:  IN std_logic;	 RSTB:  IN std_logic;	 ENA:   IN std_logic;	 ENB:   IN std_logic;	 DOA:   OUT std_logic_vector(0 downto 0);	 DOB:   OUT std_logic_vector(15 downto 0));END component;-- Counter for wait state/Dallas generatorsignal waitcnt : std_logic_vector(2 downto 0);-- Global countersignal counter:	std_logic_vector(13 downto 0);-- Local copy of Global countersignal lcounter:	std_logic_vector(13 downto 0);-- Position in a given buffersignal position:  std_logic_vector(11 downto 0);-- Latched buffer positionsignal lposition:  std_logic_vector(11 downto 0);-- dbuf represents the buffer that is currently being-- operated upon by the T1 part, while not dbuf represents-- the buffer that the bus side is operating withsignal dbuf:	std_logic;-- Lathed dbuf signalsignal ldbuf:	std_logic;-- Which ram of the buffer we are currently operating with-- (0 = top, 1 = bottom)signal ramno: 	std_logic;-- Latched ramno signalsignal lramno: 	std_logic;-- Serial output from first upper 16-bit memorysignal txqt1out: std_logic;-- Serial output from second upper 16-bit memorysignal txqt2out: std_logic;-- Serial output from first lower 16-bit memorysignal txqb1out: std_logic;-- Serial output from second lower 16-bit memorysignal txqb2out: std_logic;-- Parallel output from first 32-bits of memorysignal rxq1out: std_logic_vector(31 downto 0);-- Parallel output from second 32-bits of memorysignal rxq2out: std_logic_vector(31 downto 0);-- Ground bus for unnecessary inputssignal gndbus: std_logic_vector(15 downto 0);-- RWR: Write enable for ramsignal RWR: std_logic;-- RRD: Read enable for ramsignal RRD: std_logic;-- Local version of 1.544 Mhz clock to be outputsignal lclk: std_logic;-- 8khz countersignal cnt193: std_logic_vector(7 downto 0);-- Which of the received clocks to propagatesignal clkreg: std_logic_vector(2 downto 0);-- First Control registersignal ctlreg: std_logic_vector(7 downto 0);-- Second Control registersignal ctlreg1: std_logic_vector(7 downto 0);-- Status registersignal statreg: std_logic_vector(2 downto 0);-- LED registersignal ledreg: std_logic_vector(7 downto 0);-- LED cycle countersignal ledcnt: std_logic_vector(1 downto 0);-- Signal actually driving Rx buffers (after Rxserial loopback mux)signal xrser: std_logic;-- Signal actually driven by Tx buffers (before Txserial loopback mux)signal xtser: std_logic;signal tssync_local: std_logic;signal rsync_reva: std_logic;-- Register definitions:-- Write:-- 0xC00 -- clkreg (sync source) 0=free run, 1=span 1, 2=span 2, 3=span 3, 4=span 4, 5=external.-- 0xC01 -- ctlreg as follows:--	bit 0 - Interrupt Enable--   bit 1 - Drives "TEST1" signal ("Interrupt" outbit)--	bit 2 - Dallas Interrupt Enable (Allows DINT signal to drive INT)--	bit 3 - Enable External Synronization Drive (MASTER signal).--	bit 4 - Select E1 Divisor Mode (0 for T1, 1 for E1)--   bit 5 - Remote serial loopback (When set to 1, TSER is driven from RSER)--	bit 6 - Local serial loopback (When set to 1, Rx buffers are driven from Tx buffers)--   bit 7 - Interrupt Acknowledge (set to 1 to acknowledge interrupt)-- 0xC02 -- LED register as follows:--	bit 0 - Span 1 Green-- 	bit 1 - Span 1 Red--	bit 2 - Span 2 Green--	bit 3 - Span 2 Red--	bit 4 - Span 3 Green--	bit 5 - Span 3 Red-- 	bit 6 - Span 4 Green-- 	bit 7 - Span 4 Red--	NOTE: turning on both red and green yields yellow.-- 0xC03 -- TEST2, writing to bit 0 drives TEST2 pin.-- 0xC04 -- ctlreg1 as follows:--	bit 0 - Non-REV.A Timing mode (set for REV. B Dallas chip and higher)---- Read:-- 0xC00 -- statreg as follows:--	bit 0 - Interrupt Enabled--	bit 1 - Interrupt Active-- 	bit 2 - Dallas Chip Interrupt Active-- 0xC01 -- boardid as follows:--   bits 0-3 Board ID bits 0-3 (from rotary dip switch)	begin	-- Create statreg for user to be able to read	statreg(0) <= ctlreg(0);  -- Interrupt enable status	statreg(2) <= not DINT;   -- Dallas chip interrupt request	-- Tie INT signal to bit in statreg	INT <= statreg(1) or ((not DINT) and ctlreg(2));	MASTER <= ctlreg(3); -- Control Bit to enable External Sync Driver	TEST1 <= ctlreg(1); -- Reflect "Interrupt" Outbit	TEST3 <= statreg(1); -- Reflect Interrupt Status	TEST4 <= RSER;	BTERM <= '1';	-- Leave this not enabled for now.	-- Which ram we read into is from the 5th LSB of the counter	ramno <= lcounter(4);	-- Which buffer we're using is the most significant 	dbuf <= lcounter(13);	-- Our position is the bottom 4 bits, inverted, and then	-- the skip one, and then the next 8 bits.	position(3 downto 0) <= not lcounter(3 downto 0);	position(11 downto 4) <= lcounter(12 downto 5);	gndbus <= "0000000000000000";	txqt1: RAMB4_S1_S16 port map (		ADDRA => position,				-- Where are we in transmission 		ADDRB => ADDR(9 downto 2),	-- Address into our 16-bit words		DIA(0) => '0',					-- We never write from the serial side		DIB => D(31 downto 16),		-- Top 16-bits of data bus		WEA => '0',						-- Never write from serial side		WEB => not WR,					-- Write when requested		CLKA => CLK8192,				-- Clock output at 8.192 Mhz		CLKB => RWR,					-- Clock input when asked to by PCI bus		ENA => '1',						-- Always enable output		ENB => dbuf,					-- Enable when dbuf is set.		DOA(0) => txqt1out,			-- Serial output to be MUXed		RSTA => '0',					-- No need for silly reset		RSTB => '0'		);	txqt2: RAMB4_S1_S16 port map (		ADDRA => position,				-- Where are we in transmission 		ADDRB => ADDR(9 downto 2),	-- Address into our 16-bit words		DIA(0) => '0',					-- We never write from the serial side		DIB => D(31 downto 16),		-- Top 16-bits of data bus		WEA => '0',						-- Never write from serial side		WEB => not WR,					-- Write when requested		CLKA => CLK8192,				-- Clock output at 8.192 Mhz		CLKB => RWR,					-- Clock input when asked to by PCI bus		ENA => '1',						-- Always enable output		ENB => not dbuf,				-- Take input from user when not in use.		DOA(0) => txqt2out,			-- Serial output to be MUXed		RSTA => '0',					-- No need for silly reset		RSTB => '0'		);	txqb1: RAMB4_S1_S16 port map (		ADDRA => position,				-- Where are we in transmission 		ADDRB => ADDR(9 downto 2),	-- Address into our 16-bit words		DIA(0) => '0',					-- We never write from the serial side		DIB => D(15 downto 0),		-- Top 16-bits of data bus		WEA => '0',						-- Never write from serial side		WEB => not WR,					-- Write when requested		CLKA => CLK8192,				-- Clock output at 8.192 Mhz		CLKB => RWR,					-- Clock input when asked to by PCI bus		ENA => '1',						-- Always enable output		ENB => dbuf,					-- Enable input when not in use		DOA(0) => txqb1out,			-- Serial output to be MUXed		RSTA => '0',					-- No need for silly reset		RSTB => '0'		);	txqb2: RAMB4_S1_S16 port map (		ADDRA => position,			-- Where are we in transmission 		ADDRB => ADDR(9 downto 2),	-- Address into our 16-bit words		DIA(0) => '0',					-- We never write from the serial side		DIB => D(15 downto 0),		-- Top 16-bits of data bus		WEA => '0',						-- Never write from serial side		WEB => not WR,						-- Write when requested		CLKA => CLK8192,				-- Clock output at 8.192 Mhz		CLKB => RWR,					-- Clock input when asked to by PCI bus		ENA => '1',						-- Always enable output		ENB => not dbuf,				-- Enable when dbuf is set.		DOA(0) => txqb2out,				-- Serial output to be MUXed		RSTA => '0',					-- No need for silly reset		RSTB => '0'		);	rxqt1: RAMB4_S1_S16 port map (		ADDRA => lposition,			-- Where to put the next sample		ADDRB => ADDR(9 downto 2),	-- Addressable output		DIA(0) => XRSER,					-- Input from serial from T1		DIB => gndbus,						-- Never input from bus		WEA => not lramno,   -- Enable writing when we're in the top		WEB => '0',		CLKA => not CLK8192,				-- Clock input from T1		CLKB => RRD,				-- Clock output from bus		ENA => not ldbuf,				-- Enable when we're the selected buffer		ENB => '1',						-- Always enable output (it gets MUXed)		DOB => rxq1out(31 downto 16), -- Data output to MUX		RSTA => '0',		RSTB => '0'		);		rxqt2: RAMB4_S1_S16 port map (		ADDRA => lposition,			-- Where to put the next sample		ADDRB => ADDR(9 downto 2),	-- Addressable output		DIA(0) => XRSER,				-- Input from serial from T1		DIB => gndbus,					-- Never input from bus		WEA => not lramno,				-- Enable writing when we're in the top		WEB => '0',		CLKA => not CLK8192,				-- Clock input from T1		CLKB => RRD,				-- Clock output from bus		ENA => ldbuf,					-- Enable when we're the selected buffer		ENB => '1',						-- Always enable output (it gets MUXed)		DOB => rxq2out(31 downto 16), -- Data output to MUX

⌨️ 快捷键说明

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