Line 8... |
Line 8... |
// Email: admin@ultra-embedded.com
|
// Email: admin@ultra-embedded.com
|
//
|
//
|
// License: LGPL
|
// License: LGPL
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
//
|
//
|
// Copyright (C) 2011 - 2013 Ultra-Embedded.com
|
// Copyright (C) 2011 - 2014 Ultra-Embedded.com
|
//
|
//
|
// This source file may be used and distributed without
|
// This source file may be used and distributed without
|
// restriction provided that this copyright statement is not
|
// restriction provided that this copyright statement is not
|
// removed from the file and that any derivative work contains
|
// removed from the file and that any derivative work contains
|
// the original copyright notice and the associated disclaimer.
|
// the original copyright notice and the associated disclaimer.
|
Line 53... |
Line 53... |
|
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
// Registers
|
// Registers
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
reg [(WIDTH - 1):0] ram [((2<< (SIZE-1)) - 1):0] /*verilator public*/;
|
reg [(WIDTH - 1):0] ram [((2<< (SIZE-1)) - 1):0] /*verilator public*/;
|
reg [(SIZE - 1):0] rd_addr;
|
reg [(SIZE - 1):0] rd_addr_q;
|
|
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
// Processes
|
// Processes
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
always @ (posedge clk_i)
|
always @ (posedge clk_i)
|
begin
|
begin
|
if (wr_i == 1'b1)
|
if (wr_i == 1'b1)
|
ram[adr_i] <= dat_i;
|
ram[adr_i] <= dat_i;
|
rd_addr <= adr_i;
|
rd_addr_q <= adr_i;
|
end
|
end
|
|
|
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
// Combinatorial
|
// Combinatorial
|
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
assign dat_o = ram[rd_addr];
|
assign dat_o = ram[rd_addr_q];
|
|
|
|
//-----------------------------------------------------------------
|
|
// Init Memory
|
|
//-----------------------------------------------------------------
|
|
`ifdef ALTOR32_CLEAR_RAM
|
|
integer i;
|
|
initial
|
|
begin
|
|
for (i=0;i<((2<< (SIZE-1)) - 1);i=i+1)
|
|
begin
|
|
ram[i] = 0;
|
|
end
|
|
end
|
|
`endif
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|