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

Subversion Repositories iso7816_3_master

[/] [iso7816_3_master/] [trunk/] [test/] [ComRxDriverTasks.v] - Blame information for rev 19

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

Line No. Rev Author Line
1 11 acapola
/*
2
Author: Sebastien Riou (acapola)
3
Creation date: 17:16:40 01/09/2011
4 5 acapola
 
5 11 acapola
$LastChangedDate: 2011-02-10 16:40:57 +0100 (Thu, 10 Feb 2011) $
6
$LastChangedBy: acapola $
7
$LastChangedRevision: 14 $
8
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/ComRxDriverTasks.v $
9
 
10
This file is under the BSD licence:
11
Copyright (c) 2011, Sebastien Riou
12
 
13
All rights reserved.
14
 
15
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16
 
17
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19
The names of contributors may not be used to endorse or promote products derived from this software without specific prior written permission.
20
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32 14 acapola
 
33 5 acapola
//wire txRun,txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull;
34
//assign {txRun, txPending, rxRun, rxStartBit, isTx, overrunErrorFlag, frameErrorFlag, bufferFull} = COM_statusOut;
35
 
36
 
37
task privateTaskReceiveByteCore;
38
  begin
39
      wait(txPending==1'b0);//wait start of last tx if any
40
      wait(txRun==1'b0);//wait end of previous transmission if any
41
      wait(bufferFull==1'b1);//wait reception of a byte
42
      @(posedge COM_clk);
43
      nCsDataOut=0;
44
      @(posedge COM_clk);
45
      nCsDataOut=1;
46
        end
47
endtask
48
task receiveByte;
49
output reg [7:0] rxData;
50
        begin
51
                privateTaskReceiveByteCore;
52
                rxData=dataOut;
53
      @(posedge COM_clk);
54
        end
55
endtask
56
task receiveAndCheckByte;
57
  input [7:0] data;
58
  begin
59
      privateTaskReceiveByteCore;
60
      if(data!=dataOut) begin
61
         COM_errorCnt=COM_errorCnt+1;
62
         $display("ERROR %d: Received %x instead of %x",COM_errorCnt, dataOut, data);
63
      end
64
                @(posedge COM_clk);
65
        end
66
endtask
67
 
68 9 acapola
//Higher level tasks
69
task receiveAndCheckHexBytes;
70
        input [16*257:0] bytesString;
71
        integer i;
72
        reg [15:0] byteInHex;
73
        reg [7:0] byteToCheck;
74
begin
75 14 acapola
        i=16*257;
76
        getNextHexByte(bytesString, i, byteToCheck, i);
77
        while(i!=-1) begin
78
                receiveAndCheckByte(byteToCheck);
79
                getNextHexByte(bytesString, i, byteToCheck, i);
80 9 acapola
        end
81
end
82 14 acapola
endtask

powered by: WebSVN 2.1.0

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