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

Subversion Repositories iso7816_3_master

[/] [iso7816_3_master/] [trunk/] [test/] [HexStringConversion.v] - Diff between revs 14 and 15

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 14 Rev 15
Line 1... Line 1...
/*
/*
Author: Sebastien Riou (acapola)
Author: Sebastien Riou (acapola)
Creation date: 17:16:40 01/09/2011
Creation date: 17:16:40 01/09/2011
 
 
$LastChangedDate: 2011-02-10 16:40:57 +0100 (Thu, 10 Feb 2011) $
$LastChangedDate: 2011-02-13 16:20:10 +0100 (Sun, 13 Feb 2011) $
$LastChangedBy: acapola $
$LastChangedBy: acapola $
$LastChangedRevision: 14 $
$LastChangedRevision: 15 $
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/HexStringConversion.v $
$HeadURL: file:///svn/iso7816_3_master/iso7816_3_master/trunk/test/HexStringConversion.v $
 
 
This file is under the BSD licence:
This file is under the BSD licence:
Copyright (c) 2011, Sebastien Riou
Copyright (c) 2011, Sebastien Riou
 
 
Line 53... Line 53...
                end
                end
        end
        end
endfunction
endfunction
 
 
task getNextHexByte;
task getNextHexByte;
input [8*3*257:0] bytesString;
input [8*3*(256+5+1+2):0] bytesString;
input integer indexIn;
input integer indexIn;
output reg [7:0] byteOut;
output reg [7:0] byteOut;
output integer indexOut;
output integer indexOut;
reg [15:0] byteInHex;
reg [15:0] byteInHex;
begin
begin
Line 77... Line 77...
                indexOut=-1;
                indexOut=-1;
        end
        end
end
end
endtask
endtask
 
 
 No newline at end of file
 No newline at end of file
 
task hexStringToBytes;
 
input [8*3*(256+5+1+2):0] bytesString;
 
output reg [8*(256+5+1+2):0] bytesOut;
 
output integer nBytes;
 
integer i;
 
reg [7:0] newByte;
 
begin
 
        nBytes=0;
 
        i=8*3*(256+5+1+2);
 
        //$display("bytesString: %x",bytesString);
 
        getNextHexByte(bytesString, i, newByte, i);
 
        while(i!=-1) begin
 
                //$display("i: %d, nBytes: %d, newByte: %x",i, nBytes, newByte);
 
                bytesOut[nBytes*8+:8]=newByte;
 
                nBytes=nBytes+1;
 
                getNextHexByte(bytesString, i, newByte, i);
 
        end
 
end
 
endtask
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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