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

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [verify/] [lxp32/] [src/] [platform/] [dbus_monitor.vhd] - Diff between revs 2 and 6

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 2 Rev 6
---------------------------------------------------------------------
---------------------------------------------------------------------
-- DBUS monitor
-- DBUS monitor
--
--
-- Part of the LXP32 test platform
-- Part of the LXP32 test platform
--
--
-- Copyright (c) 2016 by Alex I. Kuznetsov
-- Copyright (c) 2016 by Alex I. Kuznetsov
--
--
-- Monitors LXP32 data bus transactions, optionally throttles them.
-- Monitors LXP32 data bus transactions, optionally throttles them.
--
--
-- Note: regardless of whether this description is synthesizable,
-- Note: regardless of whether this description is synthesizable,
-- it was designed exclusively for simulation purposes.
-- it was designed exclusively for simulation purposes.
---------------------------------------------------------------------
---------------------------------------------------------------------
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
 
 
entity dbus_monitor is
entity dbus_monitor is
        generic(
        generic(
                THROTTLE: boolean
                THROTTLE: boolean
        );
        );
        port(
        port(
                clk_i: in std_logic;
                clk_i: in std_logic;
                rst_i: in std_logic;
                rst_i: in std_logic;
 
 
                wbs_cyc_i: in std_logic;
                wbs_cyc_i: in std_logic;
                wbs_stb_i: in std_logic;
                wbs_stb_i: in std_logic;
                wbs_we_i: in std_logic;
                wbs_we_i: in std_logic;
                wbs_sel_i: in std_logic_vector(3 downto 0);
                wbs_sel_i: in std_logic_vector(3 downto 0);
                wbs_ack_o: out std_logic;
                wbs_ack_o: out std_logic;
                wbs_adr_i: in std_logic_vector(31 downto 2);
                wbs_adr_i: in std_logic_vector(31 downto 2);
                wbs_dat_i: in std_logic_vector(31 downto 0);
                wbs_dat_i: in std_logic_vector(31 downto 0);
                wbs_dat_o: out std_logic_vector(31 downto 0);
                wbs_dat_o: out std_logic_vector(31 downto 0);
 
 
                wbm_cyc_o: out std_logic;
                wbm_cyc_o: out std_logic;
                wbm_stb_o: out std_logic;
                wbm_stb_o: out std_logic;
                wbm_we_o: out std_logic;
                wbm_we_o: out std_logic;
                wbm_sel_o: out std_logic_vector(3 downto 0);
                wbm_sel_o: out std_logic_vector(3 downto 0);
                wbm_ack_i: in std_logic;
                wbm_ack_i: in std_logic;
                wbm_adr_o: out std_logic_vector(31 downto 2);
                wbm_adr_o: out std_logic_vector(31 downto 2);
                wbm_dat_o: out std_logic_vector(31 downto 0);
                wbm_dat_o: out std_logic_vector(31 downto 0);
                wbm_dat_i: in std_logic_vector(31 downto 0)
                wbm_dat_i: in std_logic_vector(31 downto 0)
        );
        );
end entity;
end entity;
 
 
architecture rtl of dbus_monitor is
architecture rtl of dbus_monitor is
 
 
signal prbs: std_logic;
signal prbs: std_logic;
signal cycle: std_logic:='0';
signal cycle: std_logic:='0';
 
 
 
signal cyc_ff: std_logic:='0';
 
signal ack_ff: std_logic:='0';
 
 
begin
begin
 
 
-- Manage throttling
-- Manage throttling
 
 
gen_throttling: if THROTTLE generate
gen_throttling: if THROTTLE generate
        throttle_inst: entity work.scrambler(rtl)
        throttle_inst: entity work.scrambler(rtl)
                generic map(TAP1=>6,TAP2=>7)
                generic map(TAP1=>6,TAP2=>7)
                port map(clk_i=>clk_i,rst_i=>rst_i,ce_i=>'1',d_o=>prbs);
                port map(clk_i=>clk_i,rst_i=>rst_i,ce_i=>'1',d_o=>prbs);
end generate;
end generate;
 
 
gen_no_throttling: if not THROTTLE generate
gen_no_throttling: if not THROTTLE generate
        prbs<='0';
        prbs<='0';
end generate;
end generate;
 
 
-- CPU interface
-- CPU interface
 
 
wbs_ack_o<=wbm_ack_i;
wbs_ack_o<=wbm_ack_i;
wbs_dat_o<=wbm_dat_i when wbm_ack_i='1' else (others=>'-');
wbs_dat_o<=wbm_dat_i when wbm_ack_i='1' else (others=>'-');
 
 
-- Interconnect interface
-- Interconnect interface
 
 
process (clk_i) is
process (clk_i) is
begin
begin
        if rising_edge(clk_i) then
        if rising_edge(clk_i) then
                if rst_i='1' then
                if rst_i='1' then
                        cycle<='0';
                        cycle<='0';
                elsif prbs='0' and wbs_cyc_i='1' then
                elsif prbs='0' and wbs_cyc_i='1' then
                        cycle<='1';
                        cycle<='1';
                elsif wbs_cyc_i='0' then
                elsif wbs_cyc_i='0' then
                        cycle<='0';
                        cycle<='0';
                end if;
                end if;
        end if;
        end if;
end process;
end process;
 
 
wbm_cyc_o<=wbs_cyc_i and (not prbs or cycle);
wbm_cyc_o<=wbs_cyc_i and (not prbs or cycle);
wbm_stb_o<=wbs_stb_i and (not prbs or cycle);
wbm_stb_o<=wbs_stb_i and (not prbs or cycle);
wbm_we_o<=wbs_we_i;
wbm_we_o<=wbs_we_i;
wbm_sel_o<=wbs_sel_i;
wbm_sel_o<=wbs_sel_i;
wbm_adr_o<=wbs_adr_i;
wbm_adr_o<=wbs_adr_i;
wbm_dat_o<=wbs_dat_i;
wbm_dat_o<=wbs_dat_i;
 
 
assert not rising_edge(clk_i) or wbm_ack_i='0' or (wbs_cyc_i and (not prbs or cycle))='1'
-- Check handshake correctness
 
 
 
process (clk_i) is
 
begin
 
        if rising_edge(clk_i) then
 
                if rst_i='1' then
 
                        cyc_ff<='0';
 
                        ack_ff<='0';
 
                else
 
                        cyc_ff<=wbs_cyc_i;
 
                        ack_ff<=wbm_ack_i;
 
 
 
                        assert wbm_ack_i='0' or (wbs_cyc_i and (not prbs or cycle))='1'
        report "DBUS error: ACK asserted without CYC"
        report "DBUS error: ACK asserted without CYC"
        severity failure;
                                severity failure;
 
 
 
                        assert not (wbs_cyc_i='0' and cyc_ff='1' and ack_ff/='1')
 
                                report "DBUS error: cycle terminated prematurely"
 
                                severity failure;
 
                end if;
 
        end if;
 
end process;
 
 
end architecture;
end architecture;
 
 

powered by: WebSVN 2.1.0

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