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

Subversion Repositories hdlc

[/] [hdlc/] [tags/] [init/] [CODE/] [RX/] [TB/] [Rx_tb.vhd] - Blame information for rev 17

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
-- Last update : 2000/12/30
10
-- 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
 
37
 
38
 
39
library ieee;
40
use ieee.std_logic_1164.all;
41
use work.hdlc_components_pkg.all;
42
 
43
entity rx_tb_ent is
44
 
45
end rx_tb_ent;
46
 
47
architecture rx_tb_beh of rx_tb_ent is
48
  constant DataStreem : std_logic_vector(88 downto 0) := "11111111011111100100110011011111010001010011111101111000111101001101001011011011001111110";
49
 
50
-- "1_11111110_11111100_10011001_10111110_10001010_01111110_11110001_11101001_10100101_10110110_01111110"
51
 
52
  signal Rxclk_i : std_logic := '0';    -- system clock
53
  signal rst_i   : std_logic := '0';    -- system reset
54
  signal Rx_i    : std_logic;           -- internal Rx serial data
55
 
56
  signal RxData_i      : std_logic_vector(7 downto 0);  -- backend data bus
57
  signal ValidFrame_i  : std_logic;     -- backedn Valid frame signal
58
  signal AbortSignal_i : std_logic;     -- backend abort signal
59
  signal Readbyte_i    : std_logic;     -- backend read byte
60
  signal rdy_i         : std_logic;     -- backend ready signal
61
  signal RxEn_i        : std_logic;     -- receive enable
62
  signal FrameError_i  : std_logic;     -- Frame Error
63
begin  -- rx_tb_beh
64
-------------------------------------------------------------------------------
65
 
66
  Rxclk_i <= not Rxclk_i after 20 ns;
67
 
68
  rst_i <= '0',
69
           '1' after 30 ns;
70
 
71
  RxEn_i <= '1';
72
-------------------------------------------------------------------------------
73
-- purpose: Generate data
74
-- type   : sequential
75
-- inputs : 
76
-- outputs: 
77
--  send_data_proc : process
78
--  begin                               -- process send_data_proc
79
--RxEn_i <= '1';
80
--    Rx_i <= '0';
81
--    wait until rst_i = '1';
82
 
83
 
84
--    for i in 0 to DataStreem'length -1 loop
85
--      wait until Rxclk_i = '0';
86
--      Rx_i <= DataStreem(i);
87
 
88
 
89
--    end loop;                         -- i
90
--  end process send_data_proc;
91
 
92
  -- purpose: Serial interface stimulus
93
  -- type   : sequential
94
  -- inputs : 
95
  -- outputs: 
96
  serial_proc      : process
97
    variable count : integer := 0;      -- Counter
98
  begin  -- process backend_proc
99
 
100
 
101
    wait until Rxclk_i = '0';
102
 
103
    rx_i <= DataStreem(count);
104
 
105
    if count = DataStreem'length-1 then
106
      count := 0;
107
    else
108
      count := count +1;
109
    end if;
110
 
111
  end process serial_proc;
112
-------------------------------------------------------------------------------
113
  -- purpose: Backend stimulus
114
  -- type   : combinational
115
  -- inputs : 
116
  -- outputs: 
117
  backend_proc       : process(rdy_i)
118
    variable counter : integer := 0;    -- Counter
119
  begin  -- process backend_proc
120
    if rdy_i = '1' then
121
      if counter mod 2 = 0 then
122
        Readbyte_i             <= '1' after 60 ns;
123
      else
124
        Readbyte_i             <= '1' after 350 ns;
125
      end if;
126
      counter                  := counter+1;
127
    else
128
      Readbyte_i               <= '0';
129
    end if;
130
 
131
 
132
 
133
  end process backend_proc;
134
 
135
-------------------------------------------------------------------------------
136
 
137
  uut : RxChannel_ent
138
    port map (
139
      Rxclk       => Rxclk_i,
140
      rst         => rst_i,
141
      Rx          => Rx_i,
142
      RxData      => RxData_i,
143
      ValidFrame  => ValidFrame_i,
144
      FrameError  => FrameError_i,
145
      AbortSignal => AbortSignal_i,
146
      Readbyte    => Readbyte_i,
147
      rdy         => rdy_i,
148
      RxEn        => RxEn_i);
149
 
150
 
151
end rx_tb_beh;

powered by: WebSVN 2.1.0

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