Working SERV cpu
This commit is contained in:
@@ -1,51 +0,0 @@
|
||||
/* serving_ram.v : I/D SRAM for the serving SoC
|
||||
*
|
||||
* ISC License
|
||||
*
|
||||
* Copyright (C) 2020 Olof Kindgren <olof.kindgren@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
`default_nettype none
|
||||
module serving_ram
|
||||
#(//Memory parameters
|
||||
parameter depth = 256,
|
||||
parameter aw = $clog2(depth),
|
||||
parameter memfile = "")
|
||||
(input wire i_clk,
|
||||
input wire [aw-1:0] i_waddr,
|
||||
input wire [7:0] i_wdata,
|
||||
input wire i_wen,
|
||||
input wire [aw-1:0] i_raddr,
|
||||
output reg [7:0] o_rdata);
|
||||
|
||||
reg [7:0] mem [0:depth-1] /* verilator public */;
|
||||
|
||||
always @(posedge i_clk) begin
|
||||
if (i_wen) mem[i_waddr] <= i_wdata;
|
||||
o_rdata <= mem[i_raddr];
|
||||
end
|
||||
|
||||
integer i;
|
||||
initial begin
|
||||
// Fill unused/uninitialized memory with a predefined value
|
||||
for (i = 0; i < depth; i = i + 1)
|
||||
mem[i] = 8'h00; // <- pick your fill value (00, FF, etc.)
|
||||
|
||||
if (|memfile) begin
|
||||
$display("Preloading %m from %s", memfile);
|
||||
$readmemh(memfile, mem);
|
||||
end
|
||||
end
|
||||
endmodule
|
||||
@@ -33,7 +33,7 @@ module tb_serving();
|
||||
serving #(
|
||||
.memfile("../sw/blinky/blinky.hex"),
|
||||
.memsize(8192),
|
||||
.sim(1'b0),
|
||||
.sim(1'b1),
|
||||
.RESET_STRATEGY("MINI"),
|
||||
.WITH_CSR(1)
|
||||
) serv (
|
||||
@@ -50,7 +50,7 @@ module tb_serving();
|
||||
);
|
||||
|
||||
wb_gpio #(
|
||||
.address(32'h80000000)
|
||||
.address(32'h40000000)
|
||||
) gpio (
|
||||
.i_wb_clk(clk),
|
||||
.i_wb_dat(wb_dat),
|
||||
|
||||
Reference in New Issue
Block a user