|
|
|
|
|
|
|
|
|
|
|
|
ROM, EPROM, EEPROM
|
|
|
|
|
|
|
|
|
|
|
|
ROM/EPROM - Loading from File
|
|
|
|
|
|
1 //===========================================
2 // Function : ROM using readmemh
3 // Coder : Deepak Kumar Tala
4 // Date : 31-Oct-2005
5 //===========================================
6 module rom_using_file (
7 input wire [7:0] address , // Address input
8 output wire [7:0] data , // Data output
9 input wire read_en , // Read Enable
10 input wire ce // Chip Enable
11 );
12
13 reg [7:0] mem [0:255] ;
14
15 assign data = (ce && read_en) ? mem[address] : 8'b0;
16
17 initial begin
18 $readmemb("memory.list", mem); // memory_list is memory file
19 end
20
21 endmodule
You could download file sv_examples here
|
|
|
|
|
|
You can find the rom model and testbench here and memory_list file here. |
|
|
|
|
|
rom_using_case
|
|
|
|
|
|
1 //===========================================
2 // Function : ROM using case
3 // Coder : Deepak Kumar Tala
4 // Date : 31-Oct-2005
5 //===========================================
6 module rom_using_case (
7 input wire [7:0] address , // Address input
8 output reg [7:0] data , // Data output
9 input wire read_en , // Read Enable
10 input wire ce // Chip Enable
11 );
12
13 always_comb
14 begin
15 case (address)
16 0 : data = 10;
17 1 : data = 55;
18 2 : data = 244;
19 3 : data = 0;
20 4 : data = 1;
21 5 : data = 8'hff;
22 6 : data = 8'h11;
23 7 : data = 8'h1;
24 8 : data = 8'h10;
25 9 : data = 8'h0;
26 10 : data = 8'h10;
27 11 : data = 8'h15;
28 12 : data = 8'h60;
29 13 : data = 8'h90;
30 14 : data = 8'h70;
31 15 : data = 8'h90;
32 endcase
33 end
34
35 endmodule
You could download file sv_examples here
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Copyright © 1998-2014 |
Deepak Kumar Tala - All rights reserved |
Do you have any Comment? mail me at:deepak@asic-world.com
|
|