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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [sparc/] [pci_test.vhd] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
 
2
 
3
 
4
 
5
----------------------------------------------------------------------------
6
--  This file is a part of the LEON-FT VHDL model
7
--  Copyright (C) 1999  European Space Agency (ESA)
8
--  ALL RIGHTS RESERVED
9
--
10
--  This file is the property of ESA and may not be distributed
11
--  or used without the written authorisation of ESA.
12
--
13
 
14
 
15
LIBRARY IEEE;
16
USE IEEE.STD_LOGIC_1164.ALL;
17
USE IEEE.STD_LOGIC_ARITH.ALL;
18
USE IEEE.STD_LOGIC_UNSIGNED."-";
19
USE IEEE.STD_LOGIC_UNSIGNED."+";
20
use work.amba.all;
21
use work.leon_iface.all;
22
 
23
entity pci_test is
24
   port(
25
 
26
      rst           : in std_logic;
27
      clk           : in std_logic;
28
 
29
      ahbmi     : in  ahb_mst_in_type;
30
      ahbmo     : out ahb_mst_out_type;
31
      ahbsi     : in  ahb_slv_in_type;
32
      ahbso     : out ahb_slv_out_type
33
);
34
 
35
end;
36
 
37
architecture behav of pci_test is
38
 
39
begin
40
 
41
  slave : process (clk)
42
  variable mo : ahb_mst_out_type;
43
  variable so : ahb_slv_out_type;
44
  variable sst : natural := 0;
45
  variable mst : natural := 0;
46
  variable saddr, maddr : std_logic_vector(31 downto 0);
47
  variable mcount : std_logic_vector(9 downto 0);
48
  variable swrite, ssel, mstart, mwrite : std_logic;
49
  variable cnt : integer := 0;
50
  begin
51
   if clk = '1' then
52
    if ahbsi.hsel = '1' then
53
      ssel := '1'; saddr := ahbsi.haddr; swrite := ahbsi.hwrite;
54
    else ssel := '0'; end if;
55
    if ssel = '1' then
56
      if swrite = '1' then
57
        case saddr(3 downto 2) is
58
        when "00" => maddr := ahbsi.hwdata;
59
        when "01" => mcount := ahbsi.hwdata(9 downto 0);
60
                     mstart := ahbsi.hwdata(12);
61
                     mwrite := ahbsi.hwdata(13);
62
        when others =>
63
        end case;
64
      else
65
        case saddr(3 downto 2) is
66
        when "00" =>
67
        when others =>
68
        end case;
69
      end if;
70
    end if;
71
 
72
    case mst is
73
    when 0 =>
74
      if mstart = '1' then
75
        mo.hbusreq := '1';
76
        if (ahbmi.hready and ahbmi.hgrant) = '1' then
77
          mst := 1; mo.htrans := HTRANS_NONSEQ;
78
        end if;
79
      end if;
80
    when 1 =>
81
      if ahbmi.hready = '1' then
82
        mcount := mcount -1; maddr := maddr + 4;
83
        if mcount /= "0000000000" then
84
          mo.htrans := HTRANS_SEQ;
85
        else
86
          mo.htrans := HTRANS_IDLE; mo.hbusreq := '0'; mst := 0; mstart := '0';
87
          mst := 2; mo.htrans := HTRANS_BUSY; cnt := 20;
88
        end if;
89
      end if;
90
    when 2 =>
91
      if ahbmi.hready = '1' then
92
        mo.htrans := HTRANS_IDLE;
93
        mst := 0;
94
        cnt := cnt -1;
95
        if cnt = 0 then mst := 3; end if;
96
--        if mcount /= "0000000000" then
97
--          mo.htrans := HTRANS_SEQ;
98
--        else
99
--          mo.htrans := HTRANS_IDLE; mo.hbusreq := '0'; mst := 0; mstart := '0';
100
--        end if;
101
      end if;
102
    when 3 =>
103
      if ahbmi.hready = '1' then
104
        mst := 1;
105
        if mcount /= "0000000000" then
106
          mo.htrans := HTRANS_SEQ;
107
        else
108
          mo.htrans := HTRANS_IDLE; mo.hbusreq := '0'; mst := 0; mstart := '0';
109
        end if;
110
      end if;
111
    when others =>
112
    end case;
113
 
114
    mo.hwdata := maddr;
115
    mo.haddr := maddr; mo.hwrite := mwrite;
116
 
117
    if rst = '0' then
118
      sst := 0; mst := 0;
119
      so.hrdata := (others => '0'); so.hready := '1';
120
      so.hresp  := (others => '0'); so.hsplit := (others => '0');
121
      mo.hbusreq := '0'; mo.hlock := '0'; mo.htrans := HTRANS_IDLE;
122
      mo.haddr := (others => '0'); mo.hwrite := '0'; mo.hburst := HBURST_INCR;
123
      mo.hprot := (others => '0'); mo.hwdata := (others => '0');
124
      mo.hsize := "010";
125
 
126
      mstart := '0'; maddr := (others => '0'); maddr(30) := '1';
127
      mwrite := '0'; mcount := "0000000000";
128
    end if;
129
    ahbso <= so; ahbmo <= mo;
130
   end if;
131
  end process;
132
 
133
end;

powered by: WebSVN 2.1.0

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