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

Subversion Repositories iso7816_3_master

[/] [iso7816_3_master/] [trunk/] [sources/] [RxCoreSelfContained.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 acapola
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company: 
4
// Engineer: Sebastien Riou
5
// 
6
// Create Date:    23:57:02 08/31/2010 
7
// Design Name: 
8
// Module Name:    RxCore 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module RxCoreSelfContained(
22
    output [7:0] dataOut,
23
    output overrunErrorFlag,    //new data has been received before dataOut was read
24
    output dataOutReadyFlag,    //new data available
25
    output frameErrorFlag,              //bad parity or bad stop bits
26
    output endOfRx,                             //one cycle pulse: 1 during last cycle of last stop bit
27
    output run,                                 //rx is definitely started, one of the three flag will be set
28
    output startBit,                            //rx is started, but we don't know yet if real rx or just a glitch
29
         input [DIVIDER_WIDTH-1:0] clkPerCycle,
30
         input [CLOCK_PER_BIT_WIDTH-1:0] clocksPerBit,
31
         input stopBit2,//0: 1 stop bit, 1: 2 stop bits
32
         input oddParity, //if 1, parity bit is such that data+parity have an odd number of 1
33
    input msbFirst,  //if 1, bits order is: startBit, b7, b6, b5...b0, parity
34
         input ackFlags,
35
         input serialIn,
36
    input comClk,//not used yet
37
    input clk,
38
    input nReset
39
    );
40
 
41
//parameters to override
42
parameter DIVIDER_WIDTH = 1;
43
parameter CLOCK_PER_BIT_WIDTH = 13;     //allow to support default speed of ISO7816
44
//invert the polarity of the output or not
45
//parameter IN_POLARITY = 1'b0;
46
//parameter PARITY_POLARITY = 1'b1;
47
//default conventions
48
parameter START_BIT = 1'b0;
49
parameter STOP_BIT1 = 1'b1;
50
parameter STOP_BIT2 = 1'b1;
51
 
52
wire [CLOCK_PER_BIT_WIDTH-1:0] bitClocksCounter;
53
wire bitClocksCounterEarlyMatch;
54
wire bitClocksCounterMatch;
55
wire [CLOCK_PER_BIT_WIDTH-1:0] bitClocksCounterCompare;
56
wire bitClocksCounterInc;
57
wire bitClocksCounterClear;
58
wire bitClocksCounterInitVal;
59
Counter #(      .DIVIDER_WIDTH(DIVIDER_WIDTH),
60
                                .WIDTH(CLOCK_PER_BIT_WIDTH),
61
                                .WIDTH_INIT(1))
62
                bitClocksCounterModule(
63
                                .counter(bitClocksCounter),
64
                                .earlyMatch(bitClocksCounterEarlyMatch),
65
                                .match(bitClocksCounterMatch),
66
                                .divider(clkPerCycle),
67
                                .compare(bitClocksCounterCompare),
68
                                .inc(bitClocksCounterInc),
69
                                .clear(bitClocksCounterClear),
70
                                .initVal(bitClocksCounterInitVal),
71
                                .clk(clk),
72
                                .nReset(nReset));
73
 
74
RxCore rxCore (
75
    .dataOut(dataOut),
76
    .overrunErrorFlag(overrunErrorFlag),
77
    .dataOutReadyFlag(dataOutReadyFlag),
78
    .frameErrorFlag(frameErrorFlag),
79
    .endOfRx(endOfRx),
80
    .run(run),
81
    .startBit(startBit),
82
    .clocksPerBit(clocksPerBit),
83
    .stopBit2(stopBit2),
84
    .oddParity(oddParity),
85
    .msbFirst(msbFirst),
86
         .ackFlags(ackFlags),
87
    .serialIn(serialIn),
88
    .clk(clk),
89
    .nReset(nReset),
90
        .bitClocksCounterEarlyMatch(bitClocksCounterEarlyMatch),
91
   .bitClocksCounterMatch(bitClocksCounterMatch),
92
        .bitClocksCounterCompare(bitClocksCounterCompare),
93
        .bitClocksCounterInc(bitClocksCounterInc),
94
        .bitClocksCounterClear(bitClocksCounterClear),
95
        .bitClocksCounterInitVal(bitClocksCounterInitVal)
96
    );
97
 
98
endmodule

powered by: WebSVN 2.1.0

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