make better
This commit is contained in:
parent
fdd6553f11
commit
f2c0935b60
128 changed files with 39530 additions and 530 deletions
27
memory.sv
Normal file
27
memory.sv
Normal file
|
@ -0,0 +1,27 @@
|
|||
module memory #(parameter RAM_SIZE_BYTES = 4096) (
|
||||
input wire clk_in,
|
||||
input wire do_write,
|
||||
input wire [$clog2(RAM_SIZE_BYTES)-1:0] write_address,
|
||||
input wire [7:0] data_in,
|
||||
input wire [$clog2(RAM_SIZE_BYTES)-1:0] read_address,
|
||||
output logic [7:0] data_out/*,
|
||||
input wire [$clog2(RAM_SIZE_BYTES)-1:0] read_address_gfx,
|
||||
output logic [7:0] data_out_gfxA*/
|
||||
);
|
||||
logic [7:0] mem [0:RAM_SIZE_BYTES-1];
|
||||
|
||||
initial begin
|
||||
$readmemh("fontset.bin", mem, 0);
|
||||
$readmemb("rom.bin", mem, 'h200);
|
||||
end
|
||||
|
||||
always_ff @(negedge clk_in) begin
|
||||
if (do_write) begin
|
||||
mem[write_address] <= data_in;
|
||||
end
|
||||
//$display("MEM : Reading address %h (%h)", read_address, mem[read_address]);
|
||||
data_out <= mem[read_address];
|
||||
//data_out_gfx <= mem[read_address_gfx];
|
||||
end
|
||||
endmodule
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue