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 4

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

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

powered by: WebSVN 2.1.0

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