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

Subversion Repositories instruction_list_pipelined_processor_with_peripherals

[/] [instruction_list_pipelined_processor_with_peripherals/] [trunk/] [hdl/] [pgmCounter.v] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 maheshpalv
////////////////////////////////////////////////////////////////////////////////////////////////
2
////                                                                                                                    ////
3
////                                                                                                                    ////
4
////    This file is part of the project                                                                                        ////
5
////    "instruction_list_pipelined_processor_with_peripherals"                                                         ////
6
////                                                                                                                    ////
7
////  http://opencores.org/project,instruction_list_pipelined_processor_with_peripherals        ////
8
////                                                                                                                    ////
9
////                                                                                                                    ////
10
////                             Author:                                                                                ////
11
////                            - Mahesh Sukhdeo Palve                                                                                                  ////
12
////                                                                                                                                                                            ////
13
////////////////////////////////////////////////////////////////////////////////////////////////
14
////////////////////////////////////////////////////////////////////////////////////////////////
15
////                                                                                                                                                                            ////
16
////                                                                                                                                                            ////
17
////                                                                                                                    ////
18
////                                    This source file may be used and distributed without                    ////
19
////                                    restriction provided that this copyright statement is not               ////
20
////                                    removed from the file and that any derivative work contains             ////
21
////                                    the original copyright notice and the associated disclaimer.            ////
22
////                                                                                                                    ////
23
////                                    This source file is free software; you can redistribute it              ////
24
////                                    and/or modify it under the terms of the GNU Lesser General              ////
25
////                                    Public License as published by the Free Software Foundation;            ////
26
////                                    either version 2.1 of the License, or (at your option) any              ////
27
////                                    later version.                                                          ////
28
////                                                                                                                    ////
29
////                                    This source is distributed in the hope that it will be                  ////
30
////                                    useful, but WITHOUT ANY WARRANTY; without even the implied              ////
31
////                                    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR                 ////
32
////                                    PURPOSE.  See the GNU Lesser General Public License for more            ////
33
////                                    details.                                                                ////
34
////                                                                                                                    ////
35
////                                    You should have received a copy of the GNU Lesser General               ////
36
////                                    Public License along with this source; if not, download it              ////
37
////                                    from http://www.opencores.org/lgpl.shtml                                ////
38
////                                                                                                                    ////
39
////////////////////////////////////////////////////////////////////////////////////////////////
40 3 maheshpalv
 
41
`include "timescale.v"
42
`include "defines.v"
43
 
44
 
45
module pgmCounter (clk, reset, branch, pcIn, pcOut);
46
 
47
        input clk, reset, branch;
48 7 maheshpalv
        input [`instAddrLen-1:0] pcIn;
49 3 maheshpalv
 
50 7 maheshpalv
        output [`instAddrLen-1:0] pcOut;
51 3 maheshpalv
 
52 9 maheshpalv
        reg [`instAddrLen-1:0] pcOut = `instAddrLen'b0;
53 3 maheshpalv
 
54 9 maheshpalv
        always @ (posedge clk)
55 3 maheshpalv
        begin
56
 
57
                if (reset)
58
                begin
59 9 maheshpalv
                        pcOut = `instAddrLen'b0;
60 8 maheshpalv
                        $write ("\nprogram counter module is reset. Starting at address 00h     ");
61 3 maheshpalv
                end
62
 
63
                else
64
                begin
65
 
66
                        if(branch)
67
                        begin
68 9 maheshpalv
                                pcOut = pcIn;
69 8 maheshpalv
                                $write ("\nbranching at address %h", pcIn);
70 3 maheshpalv
                        end
71
                        else
72
                        begin
73 9 maheshpalv
                                pcOut = pcOut + 1'b1;
74 3 maheshpalv
                        end
75
                end
76
        end     // end always
77
 
78
 
79
endmodule

powered by: WebSVN 2.1.0

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