Line 1... |
Line 1... |
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
--
|
--
|
-- The Wishbone master module.
|
-- The Wishbone master module.
|
--
|
--
|
-- $Id: wb_master.vhd,v 1.3 2005-05-08 10:36:07 arniml Exp $
|
-- $Id: wb_master.vhd,v 1.4 2005-05-10 22:36:23 arniml Exp $
|
--
|
--
|
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org)
|
-- Copyright (c) 2005, Arnim Laeuger (arniml@opencores.org)
|
--
|
--
|
-- All rights reserved
|
-- All rights reserved
|
--
|
--
|
Line 113... |
Line 113... |
|
|
signal wr_s,
|
signal wr_s,
|
rd_s : boolean;
|
rd_s : boolean;
|
|
|
signal adr_q : std_logic_vector(23 downto 0);
|
signal adr_q : std_logic_vector(23 downto 0);
|
|
signal wb_dat_q : std_logic_vector( 7 downto 0);
|
|
|
begin
|
begin
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Select signal generation
|
-- Select signal generation
|
Line 137... |
Line 138... |
--
|
--
|
seq: process (res_i, xtal_i)
|
seq: process (res_i, xtal_i)
|
begin
|
begin
|
if res_i = res_active_c then
|
if res_i = res_active_c then
|
adr_q <= (others => '0');
|
adr_q <= (others => '0');
|
|
wb_dat_q <= (others => '0');
|
state_q <= IDLE;
|
state_q <= IDLE;
|
|
|
elsif xtal_i'event and xtal_i = clk_active_c then
|
elsif xtal_i'event and xtal_i = clk_active_c then
|
-- Address register -----------------------------------------------------
|
-- Address register -----------------------------------------------------
|
-- update lowest address byte
|
-- update lowest address byte
|
Line 154... |
Line 156... |
-- set adr2 part
|
-- set adr2 part
|
if wr_s and sel_adr2_s then
|
if wr_s and sel_adr2_s then
|
adr_q(word_t'length*3 - 1 downto word_t'length*2) <= db_bus_i;
|
adr_q(word_t'length*3 - 1 downto word_t'length*2) <= db_bus_i;
|
end if;
|
end if;
|
|
|
|
-- Data from peripheral has to be saved ---------------------------------
|
|
if wb_ack_i = '1' then
|
|
wb_dat_q <= wb_dat_i;
|
|
end if;
|
|
|
-- FSM state ------------------------------------------------------------
|
-- FSM state ------------------------------------------------------------
|
state_q <= state_s;
|
state_q <= state_s;
|
|
|
end if;
|
end if;
|
end process seq;
|
end process seq;
|
Line 225... |
Line 232... |
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
db_bus_o <= adr_q(word_t'length*2 - 1 downto word_t'length)
|
db_bus_o <= adr_q(word_t'length*2 - 1 downto word_t'length)
|
when sel_adr1_s else
|
when sel_adr1_s else
|
adr_q(word_t'length*3 - 1 downto word_t'length*2)
|
adr_q(word_t'length*3 - 1 downto word_t'length*2)
|
when sel_adr2_s else
|
when sel_adr2_s else
|
wb_dat_i;
|
wb_dat_q;
|
|
|
|
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
-- Output mapping
|
-- Output mapping
|
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
wb_adr_o <= adr_q;
|
wb_adr_o <= adr_q;
|
wb_dat_o <= db_bus_i;
|
wb_dat_o <= db_bus_i;
|
wb_we_o <= '1'
|
wb_we_o <= '1'
|
when wr_s else
|
when wr_s and sel_wb_s else
|
'0';
|
'0';
|
|
|
end rtl;
|
end rtl;
|
|
|
|
|
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
-- File History:
|
-- File History:
|
--
|
--
|
-- $Log: not supported by cvs2svn $
|
-- $Log: not supported by cvs2svn $
|
|
-- Revision 1.3 2005/05/08 10:36:07 arniml
|
|
-- simplify address range:
|
|
-- - configuration range
|
|
-- - Wishbone range
|
|
--
|
-- Revision 1.2 2005/05/06 18:54:03 arniml
|
-- Revision 1.2 2005/05/06 18:54:03 arniml
|
-- assign default for state_s
|
-- assign default for state_s
|
--
|
--
|
-- Revision 1.1 2005/05/05 19:49:03 arniml
|
-- Revision 1.1 2005/05/05 19:49:03 arniml
|
-- initial check-in
|
-- initial check-in
|