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 62... |
Line 62... |
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
/* verilator lint_off MULTIDRIVEN */
|
/* verilator lint_off MULTIDRIVEN */
|
reg [(WIDTH - 1):0] ram [((2<< (SIZE-1)) - 1):0] /*verilator public*/;
|
reg [(WIDTH - 1):0] ram [((2<< (SIZE-1)) - 1):0] /*verilator public*/;
|
/* verilator lint_on MULTIDRIVEN */
|
/* verilator lint_on MULTIDRIVEN */
|
|
|
reg [(SIZE - 1):0] rd_addr_a;
|
reg [(SIZE - 1):0] rd_addr_a_q;
|
reg [(SIZE - 1):0] rd_addr_b;
|
reg [(SIZE - 1):0] rd_addr_b_q;
|
|
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
// Processes
|
// Processes
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
always @ (posedge aclk_i)
|
always @ (posedge aclk_i)
|
begin
|
begin
|
if (awr_i == 1'b1)
|
if (awr_i == 1'b1)
|
ram[aadr_i] <= adat_i;
|
ram[aadr_i] <= adat_i;
|
rd_addr_a <= aadr_i;
|
rd_addr_a_q <= aadr_i;
|
end
|
end
|
always @ (posedge bclk_i)
|
always @ (posedge bclk_i)
|
begin
|
begin
|
if (bwr_i == 1'b1)
|
if (bwr_i == 1'b1)
|
ram[badr_i] <= bdat_i;
|
ram[badr_i] <= bdat_i;
|
rd_addr_b <= badr_i;
|
rd_addr_b_q <= badr_i;
|
end
|
end
|
|
|
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
// Combinatorial
|
// Combinatorial
|
//-------------------------------------------------------------------
|
//-------------------------------------------------------------------
|
assign adat_o = ram[rd_addr_a];
|
assign adat_o = ram[rd_addr_a_q];
|
assign bdat_o = ram[rd_addr_b];
|
assign bdat_o = ram[rd_addr_b_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
|