PROM

To make it easier to configure RISC5 processors with different memory capacities and layouts, the PROM gets a parameterised name of the file containing the boot loader code.

module PROM #(parameter MemFileName = "BootLoad.mem") (
  input clk,
  input [8:0] adr,
  output reg [31:0] data
);

  localparam FileLocation = "../memfiles/";
  localparam FilePath = {FileLocation, MemFileName};
  
  reg [31:0] mem [511:0];

  initial $readmemh(FilePath, mem);
  always @(posedge clk) data <= mem[adr];
endmodule

Now the PROM can be instantiated in the top file like so to load the boot loader for 512k total RAM, with 64k of heap and 32k of stack space, appropriate for the A7-100:

PROM #(.MemFileName("BootLoad-512-64-32.mem")) prom (.adr(adr[10:2], .data(romout), .clk(~clkcpu));

For the A7-35:

PROM #(.MemFileName("BootLoad-192-32-32.mem")) prom (.adr(adr[10:2], .data(romout), .clk(~clkcpu));

Of course, BootLoad.mod needs to be compiled upfront for each different memory configuration, renamed, and placed into the memfiles directory. Using a descriptive name for the memory file is also helpful to avoid having a plethora of prom.mem files around with no quick clue what config they define.