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

Subversion Repositories iso7816_3_master

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

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

Line No. Rev Author Line
1 3 acapola
`timescale 1ns / 1ps
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
// Company: 
5
// Engineer:
6
//
7
// Create Date:   22:22:43 01/10/2011
8
// Design Name:   HalfDuplexUartIf
9
// Module Name:   dummyCard.v
10
// Project Name:  Uart
11
// Target Device:  
12
// Tool versions:  
13
// Description: 
14
//
15
// Verilog Test Fixture created by ISE for module: HalfDuplexUartIf
16
//
17
// Dependencies:
18
// 
19
// Revision:
20
// Revision 0.01 - File Created
21
// Additional Comments:
22
// 
23
////////////////////////////////////////////////////////////////////////////////
24
 
25
module DummyCard(
26
        input isoReset,
27
        input isoClk,
28
        input isoVdd,
29
        inout isoSio
30
        );
31
 
32
        // Inputs
33
        wire [0:0] clkPerCycle=0;
34
        reg [7:0] dataIn;
35
        reg nWeDataIn;
36
        reg nCsDataOut;
37
        reg nCsStatusOut;
38
 
39
        // Outputs
40
        wire [7:0] dataOut;
41
        wire [7:0] statusOut;
42
        wire serialOut;
43
 
44
 
45
 
46
        // Instantiate the Unit Under Test (UUT)
47
        HalfDuplexUartIf uut (
48
                .nReset(isoReset),
49
                .clk(isoClk),
50
                .clkPerCycle(clkPerCycle),
51
                .dataIn(dataIn),
52
                .nWeDataIn(nWeDataIn),
53
                .dataOut(dataOut),
54
                .nCsDataOut(nCsDataOut),
55
                .statusOut(statusOut),
56
                .nCsStatusOut(nCsStatusOut),
57
                .serialIn(isoSio),
58
                .serialOut(serialOut),
59
                .comClk(comClk)
60
        );
61
 
62
wire txRun,txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull;
63
assign {txRun, txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull} = statusOut;
64
 
65
assign isoSio = isTx ? serialOut : 1'bz;
66
 
67
reg sendAtr;
68
reg [8:0] tsCnt;//counter to start ATR 400 cycles after reset release
69
always @(posedge isoClk, negedge isoReset) begin
70
        if(~isoReset) begin
71
                nWeDataIn<=1'b1;
72
                nCsDataOut<=1'b1;
73
                nCsStatusOut<=1'b1;
74
 
75
                tsCnt<=9'b0;
76
                sendAtr<=1'b1;
77
        end else if(tsCnt!=9'd400) begin
78
                tsCnt <= tsCnt + 1'b1;
79
        end else if(sendAtr) begin
80
                sendAtr<=1'b0;
81
                dataIn<=8'h3B;
82
                nWeDataIn<=1'b0;
83
                @(posedge isoClk)
84
                nWeDataIn<=1'b1;
85
                @(posedge isoClk)//should not be needed
86
                wait(txPending==0);
87
                dataIn<=8'h00;
88
                nWeDataIn<=1'b0;
89
                @(posedge isoClk)
90
                nWeDataIn<=1'b1;
91
        end else begin
92
        end
93
end
94
 
95
endmodule
96
 

powered by: WebSVN 2.1.0

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