From 6e9c009250dafcae09120f8b394132635eed39cd Mon Sep 17 00:00:00 2001 From: Olof Kindgren Date: Mon, 12 Dec 2016 08:38:42 +0100 Subject: [PATCH] Make boot ROM contents configurable through top-level parameter --- processor/docs/example/computer.v | 7 +++++-- processor/docs/example/rom.v | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/processor/docs/example/computer.v b/processor/docs/example/computer.v index b63f31d..f2302ed 100644 --- a/processor/docs/example/computer.v +++ b/processor/docs/example/computer.v @@ -1,6 +1,9 @@ `timescale 1ns / 1ps -module computer( +module computer #( + parameter bootrom_file = "example.hex" +) +( `ifdef VERILATOR input clk, input reset @@ -123,7 +126,7 @@ module computer( .wb_dat_o() ); - rom rom( + rom #(.bootrom_file(bootrom_file)) rom( .A(xadr[11:3]), .Q(romQ), .STB(STB) diff --git a/processor/docs/example/rom.v b/processor/docs/example/rom.v index 1686fde..6b8f594 100644 --- a/processor/docs/example/rom.v +++ b/processor/docs/example/rom.v @@ -1,6 +1,9 @@ `timescale 1ns / 1ps -module rom( +module rom #( + parameter bootrom_file = "" +) +( input [11:3] A, // Address output [63:0] Q, // Data output input STB // True if ROM is being accessed. @@ -10,7 +13,7 @@ module rom( assign Q = STB ? results : 0; initial begin - $readmemh("example.hex", contents); + $readmemh(bootrom_file, contents); end endmodule