Line 1... |
Line 1... |
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
|
// AltOR32
|
|
// Alternative Lightweight OpenRisc
|
|
// V2.0
|
|
// Ultra-Embedded.com
|
|
// Copyright 2011 - 2013
|
|
//
|
|
// Email: admin@ultra-embedded.com
|
|
//
|
|
// License: LGPL
|
|
//-----------------------------------------------------------------
|
|
//
|
|
// Copyright (C) 2011 - 2013 Ultra-Embedded.com
|
|
//
|
|
// This source file may be used and distributed without
|
|
// restriction provided that this copyright statement is not
|
|
// removed from the file and that any derivative work contains
|
|
// the original copyright notice and the associated disclaimer.
|
|
//
|
|
// This source file is free software; you can redistribute it
|
|
// and/or modify it under the terms of the GNU Lesser General
|
|
// Public License as published by the Free Software Foundation;
|
|
// either version 2.1 of the License, or (at your option) any
|
|
// later version.
|
|
//
|
|
// This source is distributed in the hope that it will be
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the GNU Lesser General Public License for more
|
|
// details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General
|
|
// Public License along with this source; if not, write to the
|
|
// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
// Boston, MA 02111-1307 USA
|
|
//-----------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------
|
// Module: ram - dual port block RAM
|
// Module: ram - dual port block RAM
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
module ram
|
module ram
|
(
|
(
|
// Port A
|
// Port A
|
input clka_i /*verilator public*/,
|
input clka_i /*verilator public*/,
|
input ena_i /*verilator public*/,
|
input rsta_i /*verilator public*/,
|
input [3:0] wea_i /*verilator public*/,
|
input stba_i /*verilator public*/,
|
|
input wea_i /*verilator public*/,
|
|
input [3:0] sela_i /*verilator public*/,
|
input [31:2] addra_i /*verilator public*/,
|
input [31:2] addra_i /*verilator public*/,
|
input [31:0] dataa_i /*verilator public*/,
|
input [31:0] dataa_i /*verilator public*/,
|
output [31:0] dataa_o /*verilator public*/,
|
output [31:0] dataa_o /*verilator public*/,
|
|
output reg acka_o /*verilator public*/,
|
|
|
// Port B
|
// Port B
|
input clkb_i /*verilator public*/,
|
input clkb_i /*verilator public*/,
|
input enb_i /*verilator public*/,
|
input rstb_i /*verilator public*/,
|
input [3:0] web_i /*verilator public*/,
|
input stbb_i /*verilator public*/,
|
|
input web_i /*verilator public*/,
|
|
input [3:0] selb_i /*verilator public*/,
|
input [31:2] addrb_i /*verilator public*/,
|
input [31:2] addrb_i /*verilator public*/,
|
input [31:0] datab_i /*verilator public*/,
|
input [31:0] datab_i /*verilator public*/,
|
output [31:0] datab_o /*verilator public*/
|
output [31:0] datab_o /*verilator public*/,
|
|
output reg ackb_o /*verilator public*/
|
);
|
);
|
|
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
// Params
|
// Params
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
Line 28... |
Line 71... |
|
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
// Instantiation
|
// Instantiation
|
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
|
|
|
wire [3:0] wr_a = {4{stba_i}} & {4{wea_i}} & sela_i;
|
|
wire [3:0] wr_b = {4{stbb_i}} & {4{web_i}} & selb_i;
|
|
|
ram_dp8
|
ram_dp8
|
#(
|
#(
|
.WIDTH(8),
|
.WIDTH(8),
|
.SIZE(SIZE)
|
.SIZE(SIZE)
|
)
|
)
|
Line 39... |
Line 85... |
(
|
(
|
.aclk_i(clka_i),
|
.aclk_i(clka_i),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.adat_o(dataa_o[7:0]),
|
.adat_o(dataa_o[7:0]),
|
.adat_i(dataa_i[7:0]),
|
.adat_i(dataa_i[7:0]),
|
.awr_i(wea_i[0]),
|
.awr_i(wr_a[0]),
|
|
|
.bclk_i(clkb_i),
|
.bclk_i(clkb_i),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.bdat_o(datab_o[7:0]),
|
.bdat_o(datab_o[7:0]),
|
.bdat_i(datab_i[7:0]),
|
.bdat_i(datab_i[7:0]),
|
.bwr_i(web_i[0])
|
.bwr_i(wr_b[0])
|
);
|
);
|
|
|
ram_dp8
|
ram_dp8
|
#(
|
#(
|
.WIDTH(8),
|
.WIDTH(8),
|
Line 59... |
Line 105... |
(
|
(
|
.aclk_i(clka_i),
|
.aclk_i(clka_i),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.adat_o(dataa_o[15:8]),
|
.adat_o(dataa_o[15:8]),
|
.adat_i(dataa_i[15:8]),
|
.adat_i(dataa_i[15:8]),
|
.awr_i(wea_i[1]),
|
.awr_i(wr_a[1]),
|
|
|
.bclk_i(clkb_i),
|
.bclk_i(clkb_i),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.bdat_o(datab_o[15:8]),
|
.bdat_o(datab_o[15:8]),
|
.bdat_i(datab_i[15:8]),
|
.bdat_i(datab_i[15:8]),
|
.bwr_i(web_i[1])
|
.bwr_i(wr_b[1])
|
);
|
);
|
|
|
ram_dp8
|
ram_dp8
|
#(
|
#(
|
.WIDTH(8),
|
.WIDTH(8),
|
Line 79... |
Line 125... |
(
|
(
|
.aclk_i(clka_i),
|
.aclk_i(clka_i),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.adat_o(dataa_o[23:16]),
|
.adat_o(dataa_o[23:16]),
|
.adat_i(dataa_i[23:16]),
|
.adat_i(dataa_i[23:16]),
|
.awr_i(wea_i[2]),
|
.awr_i(wr_a[2]),
|
|
|
.bclk_i(clkb_i),
|
.bclk_i(clkb_i),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.bdat_o(datab_o[23:16]),
|
.bdat_o(datab_o[23:16]),
|
.bdat_i(datab_i[23:16]),
|
.bdat_i(datab_i[23:16]),
|
.bwr_i(web_i[2])
|
.bwr_i(wr_b[2])
|
);
|
);
|
|
|
ram_dp8
|
ram_dp8
|
#(
|
#(
|
.WIDTH(8),
|
.WIDTH(8),
|
Line 99... |
Line 145... |
(
|
(
|
.aclk_i(clka_i),
|
.aclk_i(clka_i),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.aadr_i(addra_i[SIZE+2-1:2]),
|
.adat_o(dataa_o[31:24]),
|
.adat_o(dataa_o[31:24]),
|
.adat_i(dataa_i[31:24]),
|
.adat_i(dataa_i[31:24]),
|
.awr_i(wea_i[3]),
|
.awr_i(wr_a[3]),
|
|
|
.bclk_i(clkb_i),
|
.bclk_i(clkb_i),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.badr_i(addrb_i[SIZE+2-1:2]),
|
.bdat_o(datab_o[31:24]),
|
.bdat_o(datab_o[31:24]),
|
.bdat_i(datab_i[31:24]),
|
.bdat_i(datab_i[31:24]),
|
.bwr_i(web_i[3])
|
.bwr_i(wr_b[3])
|
);
|
);
|
|
|
|
// AckA
|
|
always @(posedge clka_i or posedge rsta_i)
|
|
begin
|
|
if (rsta_i == 1'b1)
|
|
begin
|
|
acka_o <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
acka_o <= stba_i;
|
|
end
|
|
end
|
|
|
|
// AckB
|
|
always @(posedge clkb_i or posedge rstb_i)
|
|
begin
|
|
if (rstb_i == 1'b1)
|
|
begin
|
|
ackb_o <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
ackb_o <= stbb_i;
|
|
end
|
|
end
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|