Line 14... |
Line 14... |
//// Author(s): ////
|
//// Author(s): ////
|
//// - Simon Teran, simont@opencores.org ////
|
//// - Simon Teran, simont@opencores.org ////
|
//// - Dinesh Annayya, dinesha@opencores.org ////
|
//// - Dinesh Annayya, dinesha@opencores.org ////
|
//// ////
|
//// ////
|
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
|
//// v0.0 - Dinesh A, 5th Jan 2017
|
|
//// 1. Active edge of reset changed from High to Low
|
|
//////////////////////////////////////////////////////////////////////
|
//// ////
|
//// ////
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
//// Copyright (C) 2000 Authors and OPENCORES.ORG ////
|
//// ////
|
//// ////
|
//// 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 ////
|
Line 71... |
Line 74... |
|
|
`include "top_defines.v"
|
`include "top_defines.v"
|
|
|
|
|
module oc8051_ram_top (clk,
|
module oc8051_ram_top (clk,
|
rst,
|
resetn,
|
rd_addr,
|
rd_addr,
|
rd_data,
|
rd_data,
|
wr_addr,
|
wr_addr,
|
bit_addr,
|
bit_addr,
|
wr_data,
|
wr_data,
|
Line 106... |
Line 109... |
// wr (in) write [oc8051_decoder.wr -r]
|
// wr (in) write [oc8051_decoder.wr -r]
|
// bit_data_in (in) bit data input [oc8051_alu.desCy]
|
// bit_data_in (in) bit data input [oc8051_alu.desCy]
|
// bit_data_out (out) bit data output [oc8051_ram_sel.bit_in]
|
// bit_data_out (out) bit data output [oc8051_ram_sel.bit_in]
|
//
|
//
|
|
|
input clk, wr, bit_addr, bit_data_in, rst;
|
input clk, wr, bit_addr, bit_data_in, resetn;
|
input [7:0] wr_data;
|
input [7:0] wr_data;
|
input [7:0] rd_addr, wr_addr;
|
input [7:0] rd_addr, wr_addr;
|
output bit_data_out;
|
output bit_data_out;
|
output [7:0] rd_data;
|
output [7:0] rd_data;
|
|
|
Line 142... |
Line 145... |
assign rd_data = rd_en_r ? wr_data_r: rd_data_m;
|
assign rd_data = rd_en_r ? wr_data_r: rd_data_m;
|
assign rd_en = (rd_addr_m == wr_addr_m) & wr;
|
assign rd_en = (rd_addr_m == wr_addr_m) & wr;
|
|
|
oc8051_ram_256x8_two_bist u_ram_idata(
|
oc8051_ram_256x8_two_bist u_ram_idata(
|
.clk ( clk ),
|
.clk ( clk ),
|
.rst ( rst ),
|
.resetn ( resetn ),
|
.rd_addr ( rd_addr_m ),
|
.rd_addr ( rd_addr_m ),
|
.rd_data ( rd_data_m ),
|
.rd_data ( rd_data_m ),
|
.rd_en ( !rd_en ),
|
.rd_en ( !rd_en ),
|
.wr_addr ( wr_addr_m ),
|
.wr_addr ( wr_addr_m ),
|
.wr_data ( wr_data_m ),
|
.wr_data ( wr_data_m ),
|
Line 160... |
Line 163... |
.scanb_so(scanb_so),
|
.scanb_so(scanb_so),
|
.scanb_en(scanb_en)
|
.scanb_en(scanb_en)
|
`endif
|
`endif
|
);
|
);
|
|
|
always @(posedge clk or posedge rst)
|
always @(posedge clk or negedge resetn)
|
if (rst) begin
|
if (resetn == 1'b0) begin
|
bit_addr_r <= #1 1'b0;
|
bit_addr_r <= #1 1'b0;
|
bit_select <= #1 3'b0;
|
bit_select <= #1 3'b0;
|
end else begin
|
end else begin
|
bit_addr_r <= #1 bit_addr;
|
bit_addr_r <= #1 bit_addr;
|
bit_select <= #1 rd_addr[2:0];
|
bit_select <= #1 rd_addr[2:0];
|
end
|
end
|
|
|
|
|
always @(posedge clk or posedge rst)
|
always @(posedge clk or negedge resetn)
|
if (rst) begin
|
if (resetn == 1'b0) begin
|
rd_en_r <= #1 1'b0;
|
rd_en_r <= #1 1'b0;
|
wr_data_r <= #1 8'h0;
|
wr_data_r <= #1 8'h0;
|
end else begin
|
end else begin
|
rd_en_r <= #1 rd_en;
|
rd_en_r <= #1 rd_en;
|
wr_data_r <= #1 wr_data_m;
|
wr_data_r <= #1 wr_data_m;
|