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

Subversion Repositories hdlc

[/] [hdlc/] [trunk/] [CODE/] [RX/] [TB/] [Rx_tb.vhd] - Blame information for rev 5

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

Line No. Rev Author Line
1 2 khatib
-------------------------------------------------------------------------------
2
-- Title      :  Rx Channel test bench
3
-- Project    :  HDLC controller
4
-------------------------------------------------------------------------------
5
-- File        : Rx_tb.vhd
6
-- Author      : Jamil Khatib  (khatib@ieee.org)
7
-- Organization: OpenIPCore Project
8
-- Created     : 2000/12/30
9 5 khatib
-- Last update: 2001/01/12
10 2 khatib
-- Platform    : 
11
-- Simulators  : Modelsim 5.3XE/Windows98
12
-- Synthesizers: 
13
-- Target      : 
14
-- Dependency  : ieee.std_logic_1164
15
--
16
-------------------------------------------------------------------------------
17
-- Description:  receive 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            :   30 Dec 2000
31
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
32
-- Desccription    :   Created
33
-- ToOptimize      :   Add an input procedure to insert data pattern
34
-- Bugs            :  
35
-------------------------------------------------------------------------------
36 5 khatib
-- Revisions  :
37
-- Revision Number :   2
38
-- Version         :   0.2
39
-- Date            :   12 Jan 2001
40
-- Modifier        :   Jamil Khatib (khatib@ieee.org)
41
-- Desccription    :   Rx Enable and delayed Read tests are added
42
-- ToOptimize      :   Add an input procedure to insert data pattern
43
-- Bugs            :  
44
-------------------------------------------------------------------------------
45 2 khatib
 
46
 
47
 
48
library ieee;
49
use ieee.std_logic_1164.all;
50
use work.hdlc_components_pkg.all;
51
 
52
entity rx_tb_ent is
53
 
54
end rx_tb_ent;
55
 
56
architecture rx_tb_beh of rx_tb_ent is
57
  constant DataStreem : std_logic_vector(88 downto 0) := "11111111011111100100110011011111010001010011111101111000111101001101001011011011001111110";
58
 
59
-- "1_11111110_11111100_10011001_10111110_10001010_01111110_11110001_11101001_10100101_10110110_01111110"
60
 
61
  signal Rxclk_i : std_logic := '0';    -- system clock
62
  signal rst_i   : std_logic := '0';    -- system reset
63
  signal Rx_i    : std_logic;           -- internal Rx serial data
64
 
65
  signal RxData_i      : std_logic_vector(7 downto 0);  -- backend data bus
66
  signal ValidFrame_i  : std_logic;     -- backedn Valid frame signal
67
  signal AbortSignal_i : std_logic;     -- backend abort signal
68
  signal Readbyte_i    : std_logic;     -- backend read byte
69
  signal rdy_i         : std_logic;     -- backend ready signal
70
  signal RxEn_i        : std_logic;     -- receive enable
71
  signal FrameError_i  : std_logic;     -- Frame Error
72
begin  -- rx_tb_beh
73
-------------------------------------------------------------------------------
74
 
75
  Rxclk_i <= not Rxclk_i after 20 ns;
76
 
77
  rst_i <= '0',
78
           '1' after 30 ns;
79
 
80 5 khatib
  RxEn_i <= '1',
81
            '0' after 960 ns,
82
            '1' after 1280 ns;
83 2 khatib
-------------------------------------------------------------------------------
84
 
85
  -- purpose: Serial interface stimulus
86
  -- type   : sequential
87
  -- inputs : 
88
  -- outputs: 
89
  serial_proc      : process
90
    variable count : integer := 0;      -- Counter
91
  begin  -- process backend_proc
92
 
93
 
94
    wait until Rxclk_i = '0';
95
 
96
    rx_i <= DataStreem(count);
97
 
98
    if count = DataStreem'length-1 then
99
      count := 0;
100
    else
101
      count := count +1;
102
    end if;
103
 
104
  end process serial_proc;
105
-------------------------------------------------------------------------------
106
  -- purpose: Backend stimulus
107
  -- type   : combinational
108
  -- inputs : 
109
  -- outputs: 
110
  backend_proc       : process(rdy_i)
111
    variable counter : integer := 0;    -- Counter
112
  begin  -- process backend_proc
113
    if rdy_i = '1' then
114 5 khatib
      -- Counter is used to generate Readbyte signal at different delays
115
      if not((counter > 20) and (counter < 40)) then
116 2 khatib
        Readbyte_i             <= '1' after 60 ns;
117 5 khatib
      elsif(counter mod 2 = 0) then
118
        -- data bits will be lost in this case
119
        Readbyte_i             <= '1' after 350 ns;
120 2 khatib
      else
121 5 khatib
        Readbyte_i             <= '1' after 60 ns;
122 2 khatib
      end if;
123
      counter                  := counter+1;
124
    else
125
      Readbyte_i               <= '0';
126
    end if;
127
 
128
 
129
 
130
  end process backend_proc;
131
 
132
-------------------------------------------------------------------------------
133
 
134
  uut : RxChannel_ent
135
    port map (
136
      Rxclk       => Rxclk_i,
137
      rst         => rst_i,
138
      Rx          => Rx_i,
139
      RxData      => RxData_i,
140
      ValidFrame  => ValidFrame_i,
141
      FrameError  => FrameError_i,
142
      AbortSignal => AbortSignal_i,
143
      Readbyte    => Readbyte_i,
144
      rdy         => rdy_i,
145
      RxEn        => RxEn_i);
146
 
147
 
148
end rx_tb_beh;

powered by: WebSVN 2.1.0

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