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

Subversion Repositories mips789

[/] [mips789/] [branches/] [avendor/] [rtl/] [verilog/] [dvc.v] - Blame information for rev 55

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

Line No. Rev Author Line
1 35 mcupro
/******************************************************************
2
 *                                                                *
3
 *    Author: Liwei                                               *
4
 *                                                                *
5
 *    This file is part of the "mips789" project.                 *
6
 *    Downloaded from:                                            *
7
 *    http://www.opencores.org/pdownloads.cgi/list/mips789        *
8
 *                                                                *
9
 *    If you encountered any problem, please contact me via       *
10
 *    Email:mcupro@opencores.org  or mcupro@163.com               *
11
 *                                                                *
12
 ******************************************************************/
13 10 mcupro
 
14 35 mcupro
`include "mips789_defs.v"
15
 
16 10 mcupro
module tmr0 (
17
        input clk,
18
        input clr,
19
        input[31:0] din ,
20
        input ld,
21
        input tmr_en,
22 35 mcupro
        output tmr_req,
23 10 mcupro
        output [31:0] cntr_o
24
    );
25
 
26
    reg [31:0]s_cntr;
27
    reg [31:0]cntr;
28
 
29
    assign cntr_o=cntr;
30
 
31
    always @(posedge clk)
32
        if (ld)
33
            s_cntr<= din;
34
 
35
 
36
    always @(posedge clk)
37
        if (ld)
38
            cntr<=din;
39
        else if (cntr==0)
40
            cntr<=s_cntr;
41
        else if (tmr_en)
42
            cntr<=cntr-1;
43
 
44
    wire w_irq = cntr==0;
45
 
46
    tmr_d itmr_d(
47
              .clr(clr),
48
              .clk(clk),
49
              .d(w_irq),
50
              .q(tmr_req)
51
          );
52
endmodule
53
 
54
 
55
module tmr_d(input clr,input clk,input d,output reg q );
56
 
57 35 mcupro
    always @(posedge clk)
58 10 mcupro
 
59
        if      (clr) q<=0;
60
        else          q<=d|q;
61
 
62
endmodule
63
 
64
module seg7led_cv(
65
        input [7:0] data,
66
        output reg [6:0] seg7led2,
67
        output reg [6:0] seg7led1
68
    );
69
 
70
    always @(*)
71
    begin
72
        seg7led2= seg(data[3:0]) ;
73
        seg7led1= seg(data[7:4]) ;
74
    end
75
 
76
    function [7:0] seg;
77
        input [3:0] addr;
78
        begin
79
            case(addr)
80
                0: seg = 7'b0111111;
81
                1: seg = 7'b0000110;
82
                2: seg = 7'b1011011;
83
                3: seg = 7'b1001111;
84
                4: seg = 7'b1100110;
85
                5: seg = 7'b1101101;
86
                6: seg = 7'b1111100;
87
                7: seg = 7'b0000111;
88
                8: seg = 7'b1111111;
89
                9: seg = 7'b1100111;
90
                10: seg = 7'b1110111;
91
                11: seg = 7'b1111100;
92
                12: seg = 7'b1011000;
93
                13: seg = 7'b1011110;
94
                14: seg = 7'b1111001;
95
                15: seg = 7'b1110001;
96 35 mcupro
                                default  seg = 7'bx;
97 10 mcupro
            endcase
98
        end
99
    endfunction
100
 
101
endmodule

powered by: WebSVN 2.1.0

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