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/] [ramByte.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
module byteRam (clk, reset, byteRamEn, byteRamRw, byteRamIn, byteRamAddr, byteRamOut);
45
 
46
                input clk, reset, byteRamEn, byteRamRw;
47
                input [`byteRamLen-1:0] byteRamIn;
48
                input [`byteRamAddrLen-1:0] byteRamAddr;
49
 
50
                output [`byteRamLen-1:0] byteRamOut;
51
 
52
                reg [`byteRamLen-1:0] byteRam [`byteRamDepth-1:0];
53
                reg [`byteRamLen-1:0] byteRamOut;
54
 
55
 
56
                always @ (posedge clk or posedge reset)
57
                begin
58
 
59
                        if (reset)
60
                        begin
61
                                byteRamOut = `byteRamLen'b0;
62 8 maheshpalv
                                $write ("\nmodule byteRam is reset      ");
63 3 maheshpalv
                        end
64
 
65
                        else
66
                        begin
67
 
68
                        if (byteRamEn)
69
                        begin
70
 
71
                                if (byteRamRw)          // read operation
72
                                begin
73
                                        byteRamOut = byteRam[byteRamAddr];
74 8 maheshpalv
//                                      $write ("\nreading byte RAM : module byteRam    ");
75 3 maheshpalv
                                end
76
 
77
 
78
                                else                                    // write operation
79
                                begin
80
                                        byteRam[byteRamAddr] = byteRamIn;
81 8 maheshpalv
//                                      $write ("\nwriting to byte RAM  :       module byteRam  ");
82 3 maheshpalv
                                end
83
 
84
                        end
85
 
86
                        else                    // if Enable = 0
87
                        begin
88
 
89
                                byteRamOut = `byteRamLen'bz;
90
 
91
                        end
92
 
93
                        end             // end else of reset
94
 
95
                end     // end always
96
 
97
endmodule

powered by: WebSVN 2.1.0

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