extended testbed to log ethernet TX data
Stefan Schuermans

Stefan Schuermans commited on 2012-03-21 21:42:47
Showing 1 changed files, with 34 additions and 20 deletions.

... ...
@@ -48,37 +48,37 @@ ARCHITECTURE a_testbed OF e_testbed IS
48 48
         );
49 49
 
50 50
     SIGNAL s_clk:           std_logic;
51
+    SIGNAL s_leds:          std_logic_vector(7 DOWNTO 0);
52
+    SIGNAL s_lcd:           t_io_lcd_pins;
53
+    SIGNAL s_uart_loopback: std_logic;
51 54
     SIGNAL s_eth_clk:       std_logic;
52
-    SIGNAL s_eth_rxd:         std_logic_vector(3 DOWNTO 0);
55
+    SIGNAL s_eth_rxd_d:     std_logic_vector(3 DOWNTO 0);
56
+    SIGNAL s_eth_rxd:       std_logic_vector(4 DOWNTO 0);
53 57
     SIGNAL s_eth_rx_dv:     std_logic;
54
-    SIGNAL pin_leds:          std_logic_vector(7 DOWNTO 0);
55
-    SIGNAL pin_lcd:           t_io_lcd_pins;
56
-    SIGNAL pin_uart_loopback: std_logic;
57
-    SIGNAL pin_eth_rxd:       std_logic_vector(4 DOWNTO 0);
58
-    SIGNAL pin_eth_txd:       std_logic_vector(3 DOWNTO 0);
59
-    SIGNAL pin_eth_tx_en:     std_logic;
58
+    SIGNAL s_eth_txd:       std_logic_vector(3 DOWNTO 0);
59
+    SIGNAL s_eth_tx_en:     std_logic;
60 60
 
61 61
 BEGIN
62 62
 
63 63
     system: e_system
64 64
         PORT MAP (
65 65
             clk              => s_clk,
66
-            pin_o_leds       => pin_leds,
67
-            pin_o_lcd        => pin_lcd,
66
+            pin_o_leds       => s_leds,
67
+            pin_o_lcd        => s_lcd,
68 68
             pin_i_switches   => (sw => (OTHERS => '0'), OTHERS => '0'),
69
-            pin_i_uart_rx    => pin_uart_loopback,
70
-            pin_o_uart_tx    => pin_uart_loopback,
69
+            pin_i_uart_rx    => s_uart_loopback,
70
+            pin_o_uart_tx    => s_uart_loopback,
71 71
             pin_i_eth_rx_clk => s_eth_clk,
72
-            pin_i_eth_rxd    => pin_eth_rxd,
72
+            pin_i_eth_rxd    => s_eth_rxd,
73 73
             pin_i_eth_rx_dv  => s_eth_rx_dv,
74 74
             pin_i_eth_crs    => s_eth_rx_dv,
75 75
             pin_i_eth_col    => '0',
76 76
             pin_i_eth_tx_clk => s_eth_clk,
77
-            pin_o_eth_txd    => pin_eth_txd,
78
-            pin_o_eth_tx_en  => pin_eth_tx_en
77
+            pin_o_eth_txd    => s_eth_txd,
78
+            pin_o_eth_tx_en  => s_eth_tx_en
79 79
         );
80 80
 
81
-    pin_eth_rxd <= "0" & s_eth_rxd;
81
+    s_eth_rxd <= "0" & s_eth_rxd_d;
82 82
 
83 83
     p_clk: PROCESS
84 84
     BEGIN
... ...
@@ -100,22 +100,36 @@ BEGIN
100 100
         END LOOP;
101 101
     END PROCESS p_eth_clk;
102 102
 
103
-    p_eth_data: PROCESS
103
+    p_eth_rx_data: PROCESS
104 104
     BEGIN
105
-        s_eth_rxd   <= "0000";
105
+        s_eth_rxd_d <= "0000";
106 106
         s_eth_rx_dv <= '0';
107 107
         WAIT FOR 25 ms;
108 108
         WAIT UNTIL s_eth_clk = '1';
109 109
         WAIT UNTIL s_eth_clk = '0';
110 110
         FOR i IN 0 TO eth_data'length - 1 LOOP
111
-            s_eth_rxd   <= eth_data(i);
111
+            s_eth_rxd_d <= eth_data(i);
112 112
             s_eth_rx_dv <= '1';
113 113
             WAIT UNTIL s_eth_clk = '1';
114 114
             WAIT UNTIL s_eth_clk = '0';
115 115
         END LOOP;
116
-        s_eth_rxd   <= "0000";
116
+        s_eth_rxd_d <= "0000";
117 117
         s_eth_rx_dv <= '0';
118 118
         WAIT;
119
-    END PROCESS p_eth_data;
119
+    END PROCESS p_eth_rx_data;
120
+
121
+    p_eth_tx_data: PROCESS
122
+        VARIABLE l: line;
123
+    BEGIN
124
+        FOR i IN 0 TO eth_data'length - 1 LOOP
125
+            WAIT UNTIL s_eth_clk = '0';
126
+            WAIT UNTIL s_eth_clk = '1';
127
+            IF s_eth_tx_en = '1' THEN
128
+                write(l, "ethernet TX: ");
129
+                write(l, to_integer(unsigned(s_eth_txd)));
130
+                writeline(output, l);
131
+            END IF;
132
+        END LOOP;
133
+    END PROCESS p_eth_tx_data;
120 134
 
121 135
 END ARCHITECTURE a_testbed;
122 136