source: FPGA/FAD/FACT_FAD_TB_lib/hdl/w5300_emulator_beha.vhd@ 228

Last change on this file since 228 was 215, checked in by dneise, 14 years ago
initial commit (2nd part): only VHDL and UCF files were commited.
  • Property svn:executable set to *
File size: 2.2 KB
Line 
1--
2-- VHDL Architecture FACT_FAD_TB_lib.w5300_emulator.beha
3--
4-- Created:
5-- by - FPGA_Developer.UNKNOWN (EEPC8)
6-- at - 07:51:36 04.02.2010
7--
8-- using Mentor Graphics HDL Designer(TM) 2008.1 (Build 17)
9--
10LIBRARY ieee;
11USE ieee.std_logic_1164.all;
12USE ieee.std_logic_arith.all;
13USE ieee.std_logic_unsigned.all;
14LIBRARY FACT_FAD_lib;
15USE FACT_FAD_lib.fad_definitions.all;
16
17entity w5300_emulator is
18 port(
19 addr : in std_logic_vector(9 downto 0);
20 data : inout std_logic_vector(15 downto 0);
21 rd : in std_logic;
22 wr : in std_logic
23 );
24end entity w5300_emulator;
25
26architecture beha of w5300_emulator is
27
28 signal open_done : std_logic_vector(7 downto 0) := (others => '0');
29 signal data_temp : std_logic_vector(15 downto 0);
30
31 signal RSR_0, RSR_1 : std_logic_vector (15 downto 0);
32 signal FIFOR_CNT : integer := 0;
33
34begin
35
36 data <= data_temp when (rd = '0') else (others => 'Z');
37 data_temp <= data when (wr = '0') else (others => 'Z');
38
39 set_proc : process
40 begin
41 RSR_0 <= X"0000";
42 RSR_1 <= X"0000";
43 wait for 250 us;
44 RSR_1 <= X"0001";
45 wait for 2 ms;
46 RSR_1 <= X"0002";
47 wait;
48 end process set_proc;
49
50 w5300_proc : process (addr)
51 begin
52 for i in 0 to 7 loop
53 if (addr = conv_integer(W5300_S0_SSR) + i * 64) then
54 if (open_done(i) = '0') then
55 data_temp <= X"0013";
56 open_done(i) <= '1';
57 else
58 data_temp <= X"0017";
59 end if;
60 elsif (addr = conv_integer(W5300_S0_TX_FSR) + i * conv_integer(W5300_S_INC)) then
61 data_temp <= X"0000";
62 elsif (addr = conv_integer(W5300_S0_TX_FSR + 2) + i * conv_integer(W5300_S_INC)) then
63 data_temp <= X"3C00";
64 elsif (addr = conv_integer(W5300_S0_RX_RSR)) then
65 data_temp <= RSR_0;
66 elsif (addr = conv_integer(W5300_S0_RX_RSR) + 2) then
67 data_temp <= RSR_1;
68 elsif (addr = conv_integer(W5300_S0_RX_FIFOR)) then
69 if (FIFOR_CNT = 0) then
70 data_temp <= X"A000";
71 FIFOR_CNT <= 1;
72 elsif (FIFOR_CNT = 1) then
73 data_temp <= X"0500";
74 FIFOR_CNT <= 2;
75 elsif (FIFOR_CNT = 2) then
76 data_temp <= X"0000";
77 end if;
78 else
79 null;
80 end if;
81 end loop;
82 end process w5300_proc;
83
84
85end architecture beha;
86
Note: See TracBrowser for help on using the repository browser.