BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
fe7741d
Branches
Tags
master
mips_sys
io
cyc_cnt.vhd
read peripherals with one cycle delay - as for memory
Stefan Schuermans
commited
fe7741d
at 2012-02-12 19:10:11
cyc_cnt.vhd
Blame
History
Raw
LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.NUMERIC_STD.ALL; ENTITY e_io_cyc_cnt IS PORT ( rst: IN std_logic; clk: IN std_logic; o_rd_data: OUT std_logic_vector(31 DOWNTO 0); i_wr_data: IN std_logic_vector(31 DOWNTO 0); i_wr_en: IN std_logic ); END ENTITY e_io_cyc_cnt; ARCHITECTURE a_io_cyc_cnt OF e_io_cyc_cnt IS SIGNAL n_cnt: std_logic_vector(31 DOWNTO 0); SIGNAL r_cnt: std_logic_vector(31 DOWNTO 0) := (OTHERS => '0'); BEGIN p_write: PROCESS(r_cnt, i_wr_data, i_wr_en) BEGIN IF i_wr_en = '1' THEN n_cnt <= i_wr_data; ELSE n_cnt <= std_logic_vector(unsigned(r_cnt) + to_unsigned(1, 32)); END IF; END PROCESS p_write; p_sync: PROCESS(rst, clk) BEGIN IF rst = '1' THEN r_cnt <= (OTHERS => '0'); ELSIF rising_edge(clk) THEN r_cnt <= n_cnt; END IF; END PROCESS p_sync; p_read: PROCESS(rst, clk) BEGIN IF rst = '1' THEN o_rd_data <= (OTHERS => '0'); ELSIF rising_edge(clk) THEN o_rd_data <= r_cnt; END IF; END PROCESS p_read; END ARCHITECTURE a_io_cyc_cnt;