OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [orp/] [orp_soc/] [rtl/] [verilog/] [mem_if/] [sram_top.v] - Diff between revs 959 and 978

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 959 Rev 978
Line 44... Line 44...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.3  2002/08/14 06:24:43  lampret
 
// Fixed size of generic flash/sram to exactly 2MB
 
//
// Revision 1.2  2002/08/12 05:34:06  lampret
// Revision 1.2  2002/08/12 05:34:06  lampret
// Added SRAM_GENERIC
// Added SRAM_GENERIC
//
//
// Revision 1.1.1.1  2002/03/21 16:55:44  lampret
// Revision 1.1.1.1  2002/03/21 16:55:44  lampret
// First import of the "new" XESS XSV environment.
// First import of the "new" XESS XSV environment.
Line 137... Line 140...
// Internal wires and regs
// Internal wires and regs
//
//
reg     [7:0]           mem [2097151:0];
reg     [7:0]           mem [2097151:0];
wire    [31:0]          adr;
wire    [31:0]          adr;
`ifdef SRAM_GENERIC_REGISTERED
`ifdef SRAM_GENERIC_REGISTERED
reg                     wb_ack_o;
 
reg                     wb_err_o;
reg                     wb_err_o;
reg     [31:0]          wb_dat_o;
reg     [31:0]           prev_adr;
 
reg     [1:0]            delay;
 
`else
 
wire    [1:0]            delay;
`endif
`endif
wire                    wb_err;
wire                    wb_err;
 
 
//
//
// Aliases and simple assignments
// Aliases and simple assignments
//
//
assign wb_err = wb_cyc_i & wb_stb_i & (|wb_adr_i[23:21]);     // If Access to > 2MB (8-bit leading prefix ignored)
assign wb_err = wb_cyc_i & wb_stb_i & (|wb_adr_i[23:21]);     // If Access to > 2MB (8-bit leading prefix ignored)
assign adr = {8'h00, wb_adr_i[23:2], 2'b00};
assign adr = {8'h00, wb_adr_i[23:2], 2'b00};
 
 
`ifdef SRAM_GENERIC_REGISTERED
 
//
//
// Reading from SRAM model
// Reading from SRAM model
//
//
always @(posedge wb_rst_i or posedge wb_clk_i)
 
        if (wb_rst_i)
 
                wb_dat_o <= #1 32'h0000_0000;
 
        else begin
 
                wb_dat_o[7:0] <= #1 mem[adr+3];
 
                wb_dat_o[15:8] <= #1 mem[adr+2];
 
                wb_dat_o[23:16] <= #1 mem[adr+1];
 
                wb_dat_o[31:24] <= #1 mem[adr+0];
 
        end
 
`else
 
assign wb_dat_o[7:0] = mem[adr+3];
assign wb_dat_o[7:0] = mem[adr+3];
assign wb_dat_o[15:8] = mem[adr+2];
assign wb_dat_o[15:8] = mem[adr+2];
assign wb_dat_o[23:16] = mem[adr+1];
assign wb_dat_o[23:16] = mem[adr+1];
assign wb_dat_o[31:24] = mem[adr+0];
assign wb_dat_o[31:24] = mem[adr+0];
`endif
 
 
 
//
//
// Writing to SRAM model
// Writing to SRAM model
//
//
always @(posedge wb_rst_i or posedge wb_clk_i)
always @(posedge wb_rst_i or posedge wb_clk_i)
Line 189... Line 182...
`ifdef SRAM_GENERIC_REGISTERED
`ifdef SRAM_GENERIC_REGISTERED
//
//
// WB Acknowledge
// WB Acknowledge
//
//
always @(posedge wb_clk_i or posedge wb_rst_i)
always @(posedge wb_clk_i or posedge wb_rst_i)
        if (wb_rst_i)
        if (wb_rst_i) begin
                wb_ack_o <= #1 1'b0;
                delay <= #1 2'd3;
        else
                prev_adr <= #1 32'h0000_0000;
                wb_ack_o <= #1 wb_cyc_i & wb_stb_i & !wb_ack_o;
        end
 
        else if (delay && (wb_adr_i == prev_adr) && wb_cyc_i && wb_stb_i)
 
                delay <= #1 delay - 2'd1;
 
        else if (wb_ack_o || (wb_adr_i != prev_adr) || ~wb_stb_i) begin
 
                delay <= #1 2'd3;       // delay ... can range from 3 to 0
 
                prev_adr <= #1 wb_adr_i;
 
        end
`else
`else
assign wb_ack_o = wb_cyc_i & wb_stb_i;
assign delay = 2'd0;
 
`endif
 
 
 
assign wb_ack_o = wb_cyc_i & wb_stb_i & (delay == 2'd0)
 
`ifdef SRAM_GENERIC_REGISTERED
 
        & (wb_adr_i == prev_adr)
`endif
`endif
 
        ;
 
 
`ifdef SRAM_GENERIC_REGISTERED
`ifdef SRAM_GENERIC_REGISTERED
//
//
// WB Error
// WB Error
//
//
Line 211... Line 216...
`else
`else
assign wb_err_o = wb_err;
assign wb_err_o = wb_err;
`endif
`endif
 
 
//
//
// Flash i/f monitor
// SRAM i/f monitor
//
//
// synopsys translate_off
// synopsys translate_off
integer fsram;
integer fsram;
initial fsram = $fopen("sram.log");
initial fsram = $fopen("sram.log");
always @(posedge wb_clk_i)
always @(posedge wb_clk_i)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.