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

Subversion Repositories iso7816_3_master

[/] [iso7816_3_master/] [trunk/] [test/] [TxCoreTestBench.v] - Blame information for rev 3

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

Line No. Rev Author Line
1 2 acapola
`timescale 1ns / 1ps
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
// Company: 
5
// Engineer: Sebastien Riou
6
//
7
// Create Date:   22:53:00 08/29/2010
8
// Design Name:   TxCore
9 3 acapola
// Module Name:   tb_TxCore.v
10 2 acapola
// Project Name:  Uart
11
// Target Device:  
12
// Tool versions:  
13
// Description: 
14
//
15
// Verilog Test Fixture created by ISE for module: TxCore
16
//
17
// Dependencies:
18
// 
19
// Revision:
20
// Revision 0.01 - File Created
21
// Additional Comments:
22
// 
23
////////////////////////////////////////////////////////////////////////////////
24
 
25
module tb_TxCore;
26
parameter PARITY        = 1;
27
parameter CLK_PERIOD = 10;//should be %2
28
        // Inputs
29
        reg [7:0] dataIn;
30
        reg loadDataIn;
31
        reg [12:0] clocksPerBit;
32
        reg stopBit2;
33
        wire oddParity=0; //if 1, parity bit is such that data+parity have an odd number of 1
34
   wire msbFirst=0;  //if 1, bits will be send in the order startBit, b7, b6, b5...b0, parity
35
        reg clk;
36
        reg nReset;
37
 
38
        // Outputs
39
        wire serialOut;
40
        wire run;
41
        wire full;
42
   wire stopBits;
43
 
44
        // Instantiate the Unit Under Test (UUT)
45
        TxCore #(.PARITY_POLARITY(PARITY)) uut (
46
                .serialOut(serialOut),
47
                .run(run),
48
                .full(full),
49
      .stopBits(stopBits),
50
                .dataIn(dataIn),
51
                .clocksPerBit(clocksPerBit),
52
                .stopBit2(stopBit2),
53
                .oddParity(oddParity),
54
      .msbFirst(msbFirst),
55
           .loadDataIn(loadDataIn),
56
                .clk(clk),
57
                .nReset(nReset)
58
        );
59
 
60
        //test bench signals
61
        reg tbClock;
62
        reg tbBitCounter;
63
 
64
        initial begin
65
                tbClock=0;
66
                tbBitCounter=0;
67
                // Initialize Inputs
68
                dataIn = 0;
69
                loadDataIn = 0;
70
                clocksPerBit = 8;
71
                stopBit2=0;
72
                clk = 0;
73
                nReset = 0;
74
                #(CLK_PERIOD*10);
75
                nReset = 1;
76
                #(CLK_PERIOD*10);
77
                // Add stimulus here
78
                dataIn = 8'b1000_0000;
79
                loadDataIn = 1;
80
                wait(full==1);
81
                wait(full==0);
82
                //loadDataIn=0;
83
                dataIn = 8'b0111_1111;
84
                //loadDataIn = 1;
85
                wait(full==1);
86
                wait(full==0);
87
                loadDataIn=0;
88
        end
89
 
90
        initial begin
91
                // timeout
92
                #10000;
93
                $finish;
94
        end
95
 
96
        always
97
                #1      tbClock =  ! tbClock;
98
        always
99
                #(CLK_PERIOD/2) clk =  ! clk;
100
 
101
endmodule
102
 

powered by: WebSVN 2.1.0

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