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

Subversion Repositories pdp1

[/] [pdp1/] [trunk/] [rtl/] [vhdl/] [testtop.vhd] - Blame information for rev 3

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

Line No. Rev Author Line
1 3 yannv
--------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:
4
--
5
-- Create Date:   00:00:04 08/14/2009
6
-- Design Name:   
7
-- Module Name:   /home/yann/fpga/work/pdp1-3/testtop.vhd
8
-- Project Name:  pdp1-3
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: top
14
-- 
15
-- Dependencies:
16
-- 
17
-- Revision:
18
-- Revision 0.01 - File Created
19
-- Additional Comments:
20
--
21
-- Notes: 
22
-- This testbench has been automatically generated using types std_logic and
23
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
24
-- that these types always be used for the top-level I/O of a design in order
25
-- to guarantee that the testbench will bind correctly to the post-implementation 
26
-- simulation model.
27
--------------------------------------------------------------------------------
28
LIBRARY ieee;
29
USE ieee.std_logic_1164.ALL;
30
USE ieee.std_logic_unsigned.all;
31
USE ieee.numeric_std.ALL;
32
 
33
ENTITY testtop IS
34
END testtop;
35
 
36
ARCHITECTURE behavior OF testtop IS
37
 
38
    -- Component Declaration for the Unit Under Test (UUT)
39
 
40
    COMPONENT top
41
    PORT(
42
         CLK_50M : IN  std_logic;
43
         LED : OUT  std_logic_vector(7 downto 0);
44
         SW : IN  std_logic_vector(3 downto 0);
45
         AWAKE : OUT  std_logic;
46
         SPI_MOSI : OUT  std_logic;
47
         DAC_CS : OUT  std_logic;
48
         SPI_SCK : OUT  std_logic;
49
         DAC_CLR : OUT  std_logic;
50
         DAC_OUT : IN  std_logic;
51
                        RS232_DCE_RXD : IN std_logic;
52
                        RS232_DCE_TXD : OUT std_logic
53
        );
54
    END COMPONENT;
55
 
56
 
57
   --Inputs
58
   signal CLK_50M : std_logic := '0';
59
   signal SW : std_logic_vector(3 downto 0) := (others => '0');
60
   signal DAC_OUT : std_logic := '0';
61
 
62
        --Outputs
63
   signal LED : std_logic_vector(7 downto 0);
64
   signal AWAKE : std_logic;
65
   signal SPI_MOSI : std_logic;
66
   signal DAC_CS : std_logic;
67
   signal SPI_SCK : std_logic;
68
   signal DAC_CLR : std_logic;
69
        signal TXD, RXD : std_logic;
70
 
71
   constant CLK_50M_period : time := 20ns;
72
        constant bittime : time := 8.680555us; --1s/115200;
73
 
74
BEGIN
75
 
76
        -- Instantiate the Unit Under Test (UUT)
77
   uut: top PORT MAP (
78
          CLK_50M => CLK_50M,
79
          LED => LED,
80
          SW => SW,
81
          AWAKE => AWAKE,
82
          SPI_MOSI => SPI_MOSI,
83
          DAC_CS => DAC_CS,
84
          SPI_SCK => SPI_SCK,
85
          DAC_CLR => DAC_CLR,
86
          DAC_OUT => DAC_OUT,
87
                        RS232_DCE_RXD => RXD,
88
                        RS232_DCE_TXD => TXD
89
        );
90
 
91
   -- No clocks detected in port list. Replace CLK_50M below with 
92
   -- appropriate port name 
93
 
94
   CLK_50M_process :process
95
   begin
96
                CLK_50M <= '0';
97
                wait for CLK_50M_period/2;
98
                CLK_50M <= '1';
99
                wait for CLK_50M_period/2;
100
   end process;
101
 
102
 
103
   -- Stimulus process
104
   stim_proc: process
105
   begin
106
                RXD <= '1';
107
      -- hold reset state for 100ms.
108
      wait for 10ms;
109
 
110
                                wait for 16*bittime;
111
                -- TODO: show reply data
112
                RXD <= '0'; wait for bittime;
113
                RXD <= '1'; wait for bittime;
114
                RXD <= '0'; wait for bittime;
115
                RXD <= '1'; wait for bittime;
116
                RXD <= '0'; wait for bittime;
117
                RXD <= '0'; wait for bittime;
118
                RXD <= '0'; wait for bittime;
119
                RXD <= '0'; wait for bittime;
120
                RXD <= '1'; wait for bittime;
121
                RXD <= '1'; wait for bittime;           -- first sixbit 000101
122
                wait for 16*bittime;
123
                RXD <= '0'; wait for bittime;
124
                RXD <= '1'; wait for bittime;
125
                RXD <= '1'; wait for bittime;
126
                RXD <= '1'; wait for bittime;
127
                RXD <= '1'; wait for bittime;
128
                RXD <= '1'; wait for bittime;
129
                RXD <= '1'; wait for bittime;
130
                RXD <= '0'; wait for bittime;
131
                RXD <= '0'; wait for bittime;
132
                RXD <= '1'; wait for bittime;                           -- this byte is not marked as binary data and should be skipped
133
                wait for 16*bittime;
134
                RXD <= '0'; wait for bittime;
135
                RXD <= '0'; wait for bittime;
136
                RXD <= '1'; wait for bittime;
137
                RXD <= '1'; wait for bittime;
138
                RXD <= '0'; wait for bittime;
139
                RXD <= '0'; wait for bittime;
140
                RXD <= '0'; wait for bittime;
141
                RXD <= '0'; wait for bittime;
142
                RXD <= '1'; wait for bittime;
143
                RXD <= '1'; wait for bittime;           -- second sixbit 001100
144
                wait for 16*bittime;
145
                RXD <= '0'; wait for bittime;
146
                RXD <= '0'; wait for bittime;
147
                RXD <= '0'; wait for bittime;
148
                RXD <= '0'; wait for bittime;
149
                RXD <= '1'; wait for bittime;
150
                RXD <= '1'; wait for bittime;
151
                RXD <= '1'; wait for bittime;
152
                RXD <= '0'; wait for bittime;
153
                RXD <= '1'; wait for bittime;
154
                RXD <= '1'; wait for bittime;           -- third sixbit 111000
155
 
156
 
157
      wait for CLK_50M_period*10;
158
 
159
      -- insert stimulus here 
160
 
161
      wait;
162
   end process;
163
 
164
END;

powered by: WebSVN 2.1.0

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