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

Subversion Repositories hdlc

[/] [hdlc/] [trunk/] [CODE/] [TX/] [tb/] [tx_tb.vhd] - Blame information for rev 8

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

Line No. Rev Author Line
1 8 khatib
-------------------------------------------------------------------------------
2
-- Title      :  Tx Channel test bench
3
-- Project    :  HDLC controller
4
-------------------------------------------------------------------------------
5
-- File        : tx_tb.vhd
6
-- Author      : Jamil Khatib  (khatib@ieee.org)
7
-- Organization: OpenIPCore Project
8
-- Created     :2001/01/16
9
-- Last update: 2001/01/26
10
-- Platform    : 
11
-- Simulators  : Modelsim 5.3XE/Windows98
12
-- Synthesizers: 
13
-- Target      : 
14
-- Dependency  : ieee.std_logic_1164
15
--
16
-------------------------------------------------------------------------------
17
-- Description:  Transmit Channel test bench
18
-------------------------------------------------------------------------------
19
-- Copyright (c) 2000 Jamil Khatib
20
-- 
21
-- This VHDL design file is an open design; you can redistribute it and/or
22
-- modify it and/or implement it after contacting the author
23
-- You can check the draft license at
24
-- http://www.opencores.org/OIPC/license.shtml
25
 
26
-------------------------------------------------------------------------------
27
-- Revisions  :
28
-- Revision Number :   1
29
-- Version         :   0.1
30
-- Date            :   16 Jan 2001
31
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
32
-- Desccription    :   Created
33
-- ToOptimize      :
34
-- Bugs            :   
35
-------------------------------------------------------------------------------
36
 
37
library ieee;
38
use ieee.std_logic_1164.all;
39
 
40
library hdlc;
41
use hdlc.hdlc_components_pkg.all;
42
 
43
entity tx_tb_ent is
44
 
45
end tx_tb_ent;
46
 
47
architecture tx_tb_beh of tx_tb_ent is
48
  type streem is array (0 to 3) of std_logic_vector(7 downto 0);
49
  constant dataStreem : streem := ("10010110", "11111111", "01101101", "10010011");
50
 
51
  signal TxClk        : std_logic := '0';  -- System clock
52
  signal rst_n        : std_logic := '0';  -- system reset
53
  signal TXEN         : std_logic;      -- TX enable
54
  signal TX           : std_logic;      -- Transmit serial data
55
  signal ValidFrame   : std_logic := '0';  -- ValidFrame
56
  signal AbortFrame   : std_logic;      -- Abort Frame
57
  signal AbortedTrans : std_logic;      -- Aborted transmission
58
  signal WriteByte    : std_logic := '0';  -- Backend Write byte
59
  signal rdy          : std_logic;      -- Backend Ready
60
  signal TxData       : std_logic_vector(7 downto 0);  -- Backend data bus
61
 
62
begin  -- tx_tb_beh
63
 
64
  uut : TxChannel_ent
65
    port map (
66
      TxClk        => TxClk,
67
      rst_n        => rst_n,
68
      TXEN         => TXEN,
69
      Tx           => Tx,
70
      ValidFrame   => ValidFrame,
71
      AbortFrame   => AbortFrame,
72
      AbortedTrans => AbortedTrans,
73
      WriteByte    => WriteByte,
74
      rdy          => rdy,
75
      TxData       => TxData);
76
 
77
-------------------------------------------------------------------------------
78
 
79
  Txclk <= not Txclk after 20 ns;
80
 
81
  rst_n <= '0',
82
           '1' after 30 ns;
83
 
84
  TxEn <= '1';                          --,
85
--          '0' after 960 ns,
86
--          '1' after 1280 ns;
87
 
88
  AbortFrame <= '0';
89
 
90
-------------------------------------------------------------------------------
91
  -- purpose: Serial Interface
92
  -- type   : sequential
93
  -- inputs : TxClk, rst
94
  -- outputs: 
95
  Serial_Interface   : process (TxClk, rst_n)
96
    variable output  : std_logic_vector(7 downto 0) := "00000000";
97
                                                           -- Output regieter
98
    variable counter : integer                      := 0;  -- Counter
99
 
100
  begin  -- process Serial Interface
101
    if rst_n = '0' then                 -- asynchronous reset (active low)
102
 
103
      output  := (others => '0');
104
      Counter := 0;
105
 
106
    elsif TxClk'event and TxClk = '1' then  -- rising clock edge
107
 
108
      output  := TX & output(7 downto 1);
109
      Counter := Counter +1;
110
 
111
      if counter = 7 then
112
        counter := 0;
113
      end if;
114
 
115
    end if;
116
  end process Serial_Interface;
117
-----------------------------------------------------------------------------
118
 
119
-- purpose: Backend process
120
-- type   : combinational
121
-- inputs : 
122
-- outputs: 
123
  backend_proc       : process
124
    variable counter : integer := 6;    -- counter
125
 
126
  begin  -- process backend_proc
127
 
128
    for i in 0 to dataStreem'length-1 loop
129
 
130
      if counter = 6 then
131
        ValidFrame <= '0' after 330 ns,
132
                      '1' after 640 ns;
133
        counter    := 0;
134
      end if;
135
 
136
      wait until rdy = '1';
137
 
138
      WriteByte <= '1' after 30 ns;
139
 
140
      TxData <= dataStreem(i);
141
 
142
      counter := counter +1;
143
 
144
      wait until rdy = '0';
145
      WriteByte <= '0' after 10 ns;
146
 
147
    end loop;  -- i
148
 
149
  end process backend_proc;
150
--Used to check the Abort Condition
151
--  WriteByte <= '1' after 730 ns,
152
--               '0' after 750 ns,
153
--               '1' after 1310 ns,
154
--               '0' after 1340 ns,
155
--               '1' after 1980 ns,
156
--               '0' after 2000 ns;
157
end tx_tb_beh;

powered by: WebSVN 2.1.0

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