OpenCores
URL https://opencores.org/ocsvn/mblite/mblite/trunk

Subversion Repositories mblite

[/] [mblite/] [trunk/] [hw/] [core/] [core_wb_adapter.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 takar
----------------------------------------------------------------------------------------------
2
--
3
--      Input file         : core_wb_adapter.vhd
4
--      Design name        : core_wb_adapter.vhd
5
--      Author             : Tamar Kranenburg
6
--      Company            : Delft University of Technology
7
--                         : Faculty EEMCS, Department ME&CE
8
--                         : Systems and Circuits group
9
--
10
--      Description        : Wishbone adapter for the MB-Lite microprocessor. The data output
11
--                           is registered for multicycle transfers. This adapter implements
12
--                           the synchronous Wishbone Bus protocol, Rev3B.
13
--
14
----------------------------------------------------------------------------------------------
15
 
16 8 takar
library ieee;
17
use ieee.std_logic_1164.all;
18
use ieee.std_logic_unsigned.all;
19 2 takar
 
20 8 takar
library mblite;
21
use mblite.config_Pkg.all;
22
use mblite.core_Pkg.all;
23
use mblite.std_Pkg.all;
24 2 takar
 
25 8 takar
entity core_wb_adapter is port
26 2 takar
(
27 8 takar
    dmem_i : out dmem_in_type;
28
    wb_o   : out wb_mst_out_type;
29
    dmem_o : in dmem_out_type;
30
    wb_i   : in wb_mst_in_type
31 2 takar
);
32 8 takar
end core_wb_adapter;
33 2 takar
 
34 8 takar
architecture arch of core_wb_adapter is
35 2 takar
 
36 8 takar
    signal r_cyc_o : std_logic;
37
    signal rin_cyc_o : std_logic;
38
    signal r_data, rin_data : std_logic_vector(CFG_DMEM_WIDTH - 1 downto 0);
39
    signal s_wait : std_logic;
40 2 takar
 
41 8 takar
begin
42 2 takar
 
43
    -- Direct input-output connections
44
    wb_o.adr_o   <= dmem_o.adr_o;
45
    wb_o.sel_o   <= dmem_o.sel_o;
46
    wb_o.we_o    <= dmem_o.we_o;
47
    dmem_i.dat_i <= wb_i.dat_i;
48
 
49
    -- synchronous bus control connections
50 8 takar
    wb_o.cyc_o <= r_cyc_o or wb_i.ack_i;
51 2 takar
    wb_o.stb_o <= r_cyc_o;
52
 
53
    -- asynchronous core enable connection
54 8 takar
    dmem_i.ena_i <= '0' when (dmem_o.ena_o = '1' and rin_cyc_o = '1') or s_wait = '1' else '1';
55 2 takar
    wb_o.dat_o   <= rin_data;
56
 
57
    -- logic for wishbone master
58 8 takar
    wb_adapter_comb: process(wb_i, dmem_o, r_cyc_o, r_data)
59
    begin
60 2 takar
 
61 8 takar
        if wb_i.rst_i = '1' then
62 2 takar
            -- reset bus
63
            rin_data <= r_data;
64
            rin_cyc_o <= '0';
65
            s_wait <= '0';
66 8 takar
        elsif r_cyc_o = '1' and wb_i.ack_i = '1' then
67 2 takar
            -- terminate wishbone cycle
68
            rin_data <= r_data;
69
            rin_cyc_o <= '0';
70
            s_wait <= '0';
71 8 takar
        elsif dmem_o.ena_o = '1' and wb_i.ack_i = '1' then
72 2 takar
            -- wishbone bus is occuppied
73
            rin_data <= r_data;
74
            rin_cyc_o <= '1';
75
            s_wait <= '1';
76 8 takar
        elsif r_cyc_o = '0' and dmem_o.ena_o = '1' and wb_i.ack_i = '0' then
77 2 takar
            -- start wishbone cycle
78
            rin_data <= dmem_o.dat_o;
79
            rin_cyc_o <= '1';
80
            s_wait <= '0';
81 8 takar
        else
82 2 takar
            -- maintain wishbone cycle
83
            rin_data <= r_data;
84
            rin_cyc_o <= r_cyc_o;
85
            s_wait <= '0';
86 8 takar
        end if;
87 2 takar
 
88 8 takar
    end process;
89 2 takar
 
90 8 takar
    wb_adapter_seq: process(wb_i.clk_i)
91
    begin
92
        if rising_edge(wb_i.clk_i) then
93 2 takar
            r_cyc_o <= rin_cyc_o;
94
            r_data <= rin_data;
95 8 takar
        end if;
96
    end process;
97 2 takar
 
98 8 takar
end arch;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.