OpenCores
URL https://opencores.org/ocsvn/sdhc-sc-core/sdhc-sc-core/trunk

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpRs232/] [unitRs232Tx/] [src/] [tbRs232Tx-Bhv-ea.vhdl] - Blame information for rev 185

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 164 rkastl
-- SDHC-SC-Core
2
-- Secure Digital High Capacity Self Configuring Core
3 86 rkastl
-- 
4 170 rkastl
-- (C) Copyright 2010, Rainer Kastl
5
-- All rights reserved.
6 164 rkastl
-- 
7 170 rkastl
-- Redistribution and use in source and binary forms, with or without
8
-- modification, are permitted provided that the following conditions are met:
9
--     * Redistributions of source code must retain the above copyright
10
--       notice, this list of conditions and the following disclaimer.
11
--     * Redistributions in binary form must reproduce the above copyright
12
--       notice, this list of conditions and the following disclaimer in the
13
--       documentation and/or other materials provided with the distribution.
14
--     * Neither the name of the <organization> nor the
15
--       names of its contributors may be used to endorse or promote products
16
--       derived from this software without specific prior written permission.
17 164 rkastl
-- 
18 170 rkastl
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  "AS IS" AND
19
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
-- DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
22
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 164 rkastl
-- 
29
-- File        : tbRs232Tx-Bhv-ea.vhdl
30
-- Owner       : Rainer Kastl
31
-- Description : Testbench for Rs232 Transmitter
32
-- Links       : Rs232Tx-Rtl-ea.vhdl
33
-- 
34 86 rkastl
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
use work.Global.all;
39
use work.Rs232.all;
40
 
41
entity tbRs232Tx is
42
end entity tbRs232Tx;
43
 
44
architecture Bhv of tbRs232Tx is
45
 
46
        constant cClkFrequency : natural := 25E6;
47
        constant cBaudRate     : natural := 9600;
48
        constant cResetTime    : time    := 1 sec / cClkFrequency * 3;
49
 
50
        signal Clk         : std_ulogic := cActivated;
51
        signal nResetAsync : std_ulogic := cnActivated;
52
        signal iRs232Tx    : aiRs232Tx;
53
        signal oRs232Tx    : aoRs232Tx;
54
        signal Finished    : std_ulogic := cInactivated;
55
 
56
begin
57
 
58
        Clk <=  not Clk after 1 sec / cClkFrequency / 2 when Finished = cInactivated;
59
        nResetAsync <= cnInactivated after cResetTime;
60
 
61
        Stimuli : process is
62
        begin
63
                iRs232Tx.Transmit      <= cActivated;
64
                iRs232Tx.Data          <= (others => '-');
65
                iRs232Tx.DataAvailable <= cInactivated;
66
 
67
                wait for cResetTime;
68
 
69
                wait for 1 us;
70
 
71
                iRs232Tx.Data          <= X"5A";
72
                iRs232Tx.DataAvailable <= cActivated;
73
 
74
                wait until (Clk = cActivated and oRs232Tx.DataWasRead = cActivated);
75
 
76
                iRs232Tx.DataAvailable <= cInactivated;
77
 
78
                wait until Clk = cActivated;
79
                wait until Clk = cActivated;
80
 
81
                iRs232Tx.Data          <= X"7E";
82
                iRs232Tx.DataAvailable <= cActivated;
83
 
84
                wait until (Clk = cActivated and oRs232Tx.DataWasRead = cActivated);
85
 
86
                iRs232Tx.Data <= X"96";
87
 
88
                wait until Clk = cActivated;
89
 
90
                wait until (Clk = cActivated and oRs232Tx.DataWasRead = cActivated);
91
 
92
                iRs232Tx.DataAvailable <= cInactivated;
93
 
94
                wait for 500 us;
95
 
96
                iRs232Tx.Data          <= X"97";
97
                iRs232Tx.DataAvailable <= cActivated;
98
 
99
                wait until (Clk = cActivated and oRs232Tx.DataWasRead = cActivated);
100
 
101
                iRs232Tx.DataAvailable <= cInactivated;
102
                iRs232Tx.Transmit      <= cInactivated;
103
 
104
                wait for 5 ms;
105
 
106
                Finished <= cActivated;
107
 
108
                wait;
109
        end process Stimuli;
110
 
111
        StrobeGen_Rs232 : entity work.StrobeGen
112
        generic map (
113
                gClkFrequency    => cClkFrequency,
114
                gStrobeCycleTime => 1 sec / cBaudRate)
115
        port map (
116
                iClk         => Clk,
117
                inResetAsync => nResetAsync,
118
                oStrobe      => iRs232Tx.BitStrobe);
119
 
120
        DUT: entity work.Rs232Tx
121
        generic map (
122
                gDataBitWidth => 8
123
        )
124
        port map (
125
                iClk         => Clk,
126
                inResetAsync => nResetAsync,
127
                iRs232Tx     => iRs232Tx,
128
                oRs232Tx     => oRs232Tx
129
        );
130
 
131
end architecture Bhv;
132
 

powered by: WebSVN 2.1.0

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