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

Subversion Repositories thor

[/] [thor/] [trunk/] [bench/] [rtfSerialTxSim.v] - Blame information for rev 53

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

Line No. Rev Author Line
1 21 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2015  Robert Finch, Stratford
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file is distributed in the hope that it will be useful,      
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//
21
// This core simulates a serial transmitter by outputing a text stream.
22
// ============================================================================
23
//
24
module rtfSerialTxSim(rst,baud16,txd);
25
input rst;
26
input baud16;
27
output txd;
28
 
29
reg [9:0] buff;
30
reg [9:0] buf2;
31
reg [5:0] cnt;
32
reg [3:0]  bitcnt;
33
reg [7:0] msg [0:7];
34
reg [7:0] msgndx;
35
 
36
assign txd = buff[9];
37
 
38
always @(posedge baud16)
39
if (rst) begin
40
    cnt <= 6'd0;
41
    buff <= 10'h3FF;
42
    buf2 <= 10'h3ff;
43
    msg[0] = "H";
44
    msg[1] = "i";
45
    msg[2] = "T";
46
    msg[3] = "h";
47
    msg[4] = "e";
48
    msg[5] = "r";
49
    msg[6] = "e";
50
    msg[7] = " ";
51
    msgndx <= 4'd0;
52
end
53
else begin
54
    cnt <= cnt + 6'd1;
55
    if (cnt==6'd15) begin
56
        cnt <= 6'd0;
57
        bitcnt <= bitcnt + 4'd1;
58
        if (bitcnt==4'd9) begin
59
            bitcnt <= 4'd0;
60
            buff <= buf2;
61
            msgndx <= msgndx + 8'd1;
62
            buf2 <= {1'b0,msg[msgndx],^msg[msgndx]};
63
        end
64
        else
65
            buff <= {buff[8:0],1'b1};
66
    end
67
end
68
 
69
endmodule

powered by: WebSVN 2.1.0

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