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

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [platform/] [dbus_monitor.vhd] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 ring0_mipt
---------------------------------------------------------------------
2
-- DBUS monitor
3
--
4
-- Part of the LXP32 test platform
5
--
6
-- Copyright (c) 2016 by Alex I. Kuznetsov
7
--
8
-- Monitors LXP32 data bus transactions, optionally throttles them.
9
--
10
-- Note: regardless of whether this description is synthesizable,
11
-- it was designed exclusively for simulation purposes.
12
---------------------------------------------------------------------
13
 
14
library ieee;
15
use ieee.std_logic_1164.all;
16
 
17
entity dbus_monitor is
18
        generic(
19
                THROTTLE: boolean
20
        );
21
        port(
22
                clk_i: in std_logic;
23
                rst_i: in std_logic;
24
 
25
                wbs_cyc_i: in std_logic;
26
                wbs_stb_i: in std_logic;
27
                wbs_we_i: in std_logic;
28
                wbs_sel_i: in std_logic_vector(3 downto 0);
29
                wbs_ack_o: out std_logic;
30
                wbs_adr_i: in std_logic_vector(31 downto 2);
31
                wbs_dat_i: in std_logic_vector(31 downto 0);
32
                wbs_dat_o: out std_logic_vector(31 downto 0);
33
 
34
                wbm_cyc_o: out std_logic;
35
                wbm_stb_o: out std_logic;
36
                wbm_we_o: out std_logic;
37
                wbm_sel_o: out std_logic_vector(3 downto 0);
38
                wbm_ack_i: in std_logic;
39
                wbm_adr_o: out std_logic_vector(31 downto 2);
40
                wbm_dat_o: out std_logic_vector(31 downto 0);
41
                wbm_dat_i: in std_logic_vector(31 downto 0)
42
        );
43
end entity;
44
 
45
architecture rtl of dbus_monitor is
46
 
47
signal prbs: std_logic;
48
signal cycle: std_logic:='0';
49
 
50
signal cyc_ff: std_logic:='0';
51
signal ack_ff: std_logic:='0';
52
 
53
begin
54
 
55
-- Manage throttling
56
 
57
gen_throttling: if THROTTLE generate
58
        throttle_inst: entity work.scrambler(rtl)
59
                generic map(TAP1=>6,TAP2=>7)
60
                port map(clk_i=>clk_i,rst_i=>rst_i,ce_i=>'1',d_o=>prbs);
61
end generate;
62
 
63
gen_no_throttling: if not THROTTLE generate
64
        prbs<='0';
65
end generate;
66
 
67
-- CPU interface
68
 
69
wbs_ack_o<=wbm_ack_i;
70
wbs_dat_o<=wbm_dat_i when wbm_ack_i='1' else (others=>'-');
71
 
72
-- Interconnect interface
73
 
74
process (clk_i) is
75
begin
76
        if rising_edge(clk_i) then
77
                if rst_i='1' then
78
                        cycle<='0';
79
                elsif prbs='0' and wbs_cyc_i='1' then
80
                        cycle<='1';
81
                elsif wbs_cyc_i='0' then
82
                        cycle<='0';
83
                end if;
84
        end if;
85
end process;
86
 
87
wbm_cyc_o<=wbs_cyc_i and (not prbs or cycle);
88
wbm_stb_o<=wbs_stb_i and (not prbs or cycle);
89
wbm_we_o<=wbs_we_i;
90
wbm_sel_o<=wbs_sel_i;
91
wbm_adr_o<=wbs_adr_i;
92
wbm_dat_o<=wbs_dat_i;
93
 
94
-- Check handshake correctness
95
 
96
process (clk_i) is
97
begin
98
        if rising_edge(clk_i) then
99
                if rst_i='1' then
100
                        cyc_ff<='0';
101
                        ack_ff<='0';
102
                else
103
                        cyc_ff<=wbs_cyc_i;
104
                        ack_ff<=wbm_ack_i;
105
 
106
                        assert wbm_ack_i='0' or (wbs_cyc_i and (not prbs or cycle))='1'
107
                                report "DBUS error: ACK asserted without CYC"
108
                                severity failure;
109
 
110
                        assert not (wbs_cyc_i='0' and cyc_ff='1' and ack_ff/='1')
111
                                report "DBUS error: cycle terminated prematurely"
112
                                severity failure;
113
                end if;
114
        end if;
115
end process;
116
 
117
end architecture;

powered by: WebSVN 2.1.0

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