From f122fa70e30a7d7744b38fa22bd1d5aa949e8277 Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Thu, 24 Dec 2020 09:22:34 +0100 Subject: prepare makefile infrastructure for writing examples --- models/flash_memory.v | 9 +++++++-- models/soc_with_peripherals.v | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'models') diff --git a/models/flash_memory.v b/models/flash_memory.v index 3b6c659..43d6c99 100644 --- a/models/flash_memory.v +++ b/models/flash_memory.v @@ -63,8 +63,13 @@ module W25Q16BV_flash parameter memory_size = 1024 * 1024 * 2; /* 2 megabytes */ reg [7:0] memory [memory_size - 1 : 0]; - initial - $readmemh(INITIAL_CONTENTS_FILE, memory, 0, BYTES_TO_INITIALIZE - 1); + + generate + if (BYTES_TO_INITIALIZE) begin + initial + $readmemh(INITIAL_CONTENTS_FILE, memory, 0, BYTES_TO_INITIALIZE - 1); + end + endgenerate always @ (posedge sck) begin if (!powered_up && power_up_time + power_up_wait_time < $time) begin diff --git a/models/soc_with_peripherals.v b/models/soc_with_peripherals.v index 975c002..40ee341 100644 --- a/models/soc_with_peripherals.v +++ b/models/soc_with_peripherals.v @@ -9,8 +9,10 @@ module soc_with_peripherals #( - parameter FONT_FILE = "../design/font.mem", - parameter EMBEDDED_ROM_FILE = "../design/rom.mem", + parameter DESIGN_DIR = "../../design/", + parameter FONT_FILE = {DESIGN_DIR, "font.mem"}, + parameter EMBEDDED_ROM_WORDS_COUNT = "error, rom words count not given", + parameter EMBEDDED_ROM_FILE = {DESIGN_DIR, "rom.mem"}, parameter SPI_ROM_WORDS_COUNT = 0, parameter SPI_ROM_FILE = "/dev/zero" ) @@ -79,6 +81,7 @@ module soc_with_peripherals soc #( .FONT_FILE(FONT_FILE), + .ROM_WORDS_COUNT(EMBEDDED_ROM_WORDS_COUNT), .ROM_FILE(EMBEDDED_ROM_FILE) ) soc ( -- cgit v1.2.3