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 5

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 5 acapola
         output wire stopBit,                           //rx is over but still in stop bits
31 4 acapola
         input wire [DIVIDER_WIDTH-1:0] clkPerCycle,
32
         input wire [CLOCK_PER_BIT_WIDTH-1:0] clocksPerBit,
33
         input wire stopBit2,//0: 1 stop bit, 1: 2 stop bits
34
         input wire oddParity, //if 1, parity bit is such that data+parity have an odd number of 1
35
    input wire msbFirst,  //if 1, bits order is: startBit, b7, b6, b5...b0, parity
36
         input wire ackFlags,
37
         input wire serialIn,
38
    input wire comClk,//not used yet
39
    input wire clk,
40
    input wire nReset
41 2 acapola
    );
42
 
43
//parameters to override
44
parameter DIVIDER_WIDTH = 1;
45
parameter CLOCK_PER_BIT_WIDTH = 13;     //allow to support default speed of ISO7816
46
//invert the polarity of the output or not
47
//parameter IN_POLARITY = 1'b0;
48
//parameter PARITY_POLARITY = 1'b1;
49
//default conventions
50
parameter START_BIT = 1'b0;
51
parameter STOP_BIT1 = 1'b1;
52
parameter STOP_BIT2 = 1'b1;
53
 
54
wire [CLOCK_PER_BIT_WIDTH-1:0] bitClocksCounter;
55
wire bitClocksCounterEarlyMatch;
56
wire bitClocksCounterMatch;
57
wire [CLOCK_PER_BIT_WIDTH-1:0] bitClocksCounterCompare;
58
wire bitClocksCounterInc;
59
wire bitClocksCounterClear;
60 4 acapola
wire bitClocksCounterInitVal;
61
wire dividedClk;
62 2 acapola
Counter #(      .DIVIDER_WIDTH(DIVIDER_WIDTH),
63
                                .WIDTH(CLOCK_PER_BIT_WIDTH),
64
                                .WIDTH_INIT(1))
65
                bitClocksCounterModule(
66
                                .counter(bitClocksCounter),
67
                                .earlyMatch(bitClocksCounterEarlyMatch),
68 4 acapola
                                .match(bitClocksCounterMatch),
69
                                .dividedClk(dividedClk),
70 2 acapola
                                .divider(clkPerCycle),
71
                                .compare(bitClocksCounterCompare),
72
                                .inc(bitClocksCounterInc),
73
                                .clear(bitClocksCounterClear),
74
                                .initVal(bitClocksCounterInitVal),
75
                                .clk(clk),
76
                                .nReset(nReset));
77
 
78
RxCore rxCore (
79
    .dataOut(dataOut),
80
    .overrunErrorFlag(overrunErrorFlag),
81
    .dataOutReadyFlag(dataOutReadyFlag),
82
    .frameErrorFlag(frameErrorFlag),
83
    .endOfRx(endOfRx),
84
    .run(run),
85 5 acapola
    .startBit(startBit),
86
    .stopBit(stopBit),
87 2 acapola
    .clocksPerBit(clocksPerBit),
88
    .stopBit2(stopBit2),
89
    .oddParity(oddParity),
90
    .msbFirst(msbFirst),
91
         .ackFlags(ackFlags),
92
    .serialIn(serialIn),
93
    .clk(clk),
94
    .nReset(nReset),
95
        .bitClocksCounterEarlyMatch(bitClocksCounterEarlyMatch),
96
   .bitClocksCounterMatch(bitClocksCounterMatch),
97
        .bitClocksCounterCompare(bitClocksCounterCompare),
98
        .bitClocksCounterInc(bitClocksCounterInc),
99
        .bitClocksCounterClear(bitClocksCounterClear),
100
        .bitClocksCounterInitVal(bitClocksCounterInitVal)
101
    );
102
 
103
endmodule

powered by: WebSVN 2.1.0

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