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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [xess/] [xsv_cpld/] [rtl/] [verilog/] [tdm_master_if.v] - Blame information for rev 767

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

Line No. Rev Author Line
1 767 lampret
// synopsys translate_off
2
`include "timescale.v"
3
// synopsys translate_on
4
 
5
module tdm_master_if(clk, rst, tdmfrm, tdmrx, tdmtx,
6
                        din, dout
7
                );
8
 
9
input           clk;
10
input           rst;
11
output          tdmfrm;
12
input           tdmrx;
13
output          tdmtx;
14
 
15
input   [7:0]    din;
16
output  [7:0]    dout;
17
 
18
reg     [2:0]    clk_cnt;
19
reg     [7:0]    dout;
20
reg             tdmtx;
21
 
22
//
23
// Counter for low speed clock and incoming JTAG data slots
24
//
25
always @(posedge clk or posedge rst)
26
        if (rst)
27
                clk_cnt <= #1 3'b000;
28
        else
29
                clk_cnt <= #1 clk_cnt + 1;
30
 
31
//
32
// Frame generation
33
//
34
assign tdmfrm = (clk_cnt == 3'b000) ? 1'b1 : 1'b0;
35
 
36
//
37
// RX Data slot extraction
38
//
39
always @(posedge clk or posedge rst)
40
        if (rst) begin
41
                dout <= #1 8'b0000_0000;
42
        end else
43
        case (clk_cnt[2:0])
44
                3'd0:   dout[0] <= #1 tdmrx;
45
                3'd1:   dout[1] <= #1 tdmrx;
46
                3'd2:   dout[2] <= #1 tdmrx;
47
                3'd3:   dout[3] <= #1 tdmrx;
48
                3'd4:   dout[4] <= #1 tdmrx;
49
                3'd5:   dout[5] <= #1 tdmrx;
50
                3'd6:   dout[6] <= #1 tdmrx;
51
                3'd7:   dout[7] <= #1 tdmrx;
52
        endcase
53
 
54
//
55
// TX Data slot insertion
56
//
57
always @(clk_cnt or din)
58
        case (clk_cnt[2:0])
59
                3'd0:   tdmtx = din[0];
60
                3'd1:   tdmtx = din[1];
61
                3'd2:   tdmtx = din[2];
62
                3'd3:   tdmtx = din[3];
63
                3'd4:   tdmtx = din[4];
64
                3'd5:   tdmtx = din[5];
65
                3'd6:   tdmtx = din[6];
66
                3'd7:   tdmtx = din[7];
67
        endcase
68
 
69
endmodule

powered by: WebSVN 2.1.0

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