LIBRARY IEEE; USE IEEE.std_logic_1164.ALL; ----------------------------------------------- --minimal dcsboard srg design --connects the srg with the avalon and a clock divider --v03 with write control... --only one register w/a hamming --09.06.2006 Jens Steckert ----------------------------------------------- --Entity ----------------------------------------------- entity scomm is --connections to the outside world port ( --input DATA : in std_logic_vector(31 downto 0); clk : in std_logic; rst_n : in std_logic; write_n : in std_logic; --write control, takes data only when negative... --controlled by avalon bus... --output SERIAL_OUT : out std_logic;--serial output (1 channel) STROBE : out std_logic ; --common strobe clkout : out std_logic --common serial clock ); end scomm; -------------------------------------------------------------- --Architecture -------------------------------------------------------------- architecture a of scomm is --shiftregister parin serial out component shreg_parin is generic(N : Integer := 24); port( rst_n : in std_logic; PARIN : in std_logic_vector(N downto 1); CLK : in std_logic; VALID : in std_logic; SDOUT : out std_logic; SSTR : out std_logic; sclk : out std_logic ); end component; component fdiv is port( rst_n : in std_logic; clk_in : in std_logic; clk_out : out std_logic ); end component; --global clock buffer for the 10kHz main clock signal component global is port(a_in : in std_logic; a_out : out std_logic ); end component; ----------------------- --signal definitions... ----------------------- signal serout : std_logic;--serial data for 1 ch signal CLK_i10k : std_logic:= '0'; --internal clock, not amplified signal clk_i10kg : std_logic:= '0'; --internal clock, after global buffer -- amplified to drive whole design signal strobe_i : std_logic; signal reset_i : std_logic; signal valid_i : std_logic:= '1'; signal clkspare : std_logic:= '0'; signal writebuffer : std_logic_vector(31 downto 0);--. --. ---------------------------------------------------- --portmapping and connecting the logical blocks ---------------------------------------------------- begin --if bus sets the write_n signal low the data input will be written into --the writebuffer register. writeproc: process (clk) begin if clk'event and clk ='1' then --rising clock edge if write_n = '0' then writebuffer <= data; end if; end if; end process; outproc: process(clk_i10kg, rst_n) begin reset_i <= rst_n; clkout <= clkspare; ------changed serial_out <= serout; strobe <= strobe_i; end process; psreg: shreg_parin generic map(N => 32) port map( --inputs rst_n => reset_i, parin => writebuffer, clk => clk_i10kg, valid => valid_i, --outputs sstr => strobe_i, sdout => serout, sclk => clkspare ); fdiv40: fdiv port map( rst_n => reset_i, clk_in =>clk, --fast clock from avalon bus... clk_out => clk_i10k --slow clock for srg ); glob: global port map( a_in => clk_i10k, a_out => clk_i10kg ); end;