2021-01-15 04:37:51 +00:00
|
|
|
///////////////////////////////////////////
|
2022-08-25 00:03:22 +00:00
|
|
|
// rom_ahb.sv
|
2021-01-15 04:37:51 +00:00
|
|
|
//
|
|
|
|
// Written: David_Harris@hmc.edu 9 January 2021
|
|
|
|
// Modified:
|
|
|
|
//
|
2022-08-25 00:03:22 +00:00
|
|
|
// Purpose: On-chip ROM, external to core
|
2021-01-15 04:37:51 +00:00
|
|
|
//
|
2023-01-14 14:15:35 +00:00
|
|
|
// Documentation: RISC-V System on Chip Design Chapter 6
|
|
|
|
//
|
2023-01-11 23:15:08 +00:00
|
|
|
// A component of the CORE-V-WALLY configurable RISC-V project.
|
2021-01-15 04:37:51 +00:00
|
|
|
//
|
2023-01-10 19:35:20 +00:00
|
|
|
// Copyright (C) 2021-23 Harvey Mudd College & Oklahoma State University
|
2021-01-15 04:37:51 +00:00
|
|
|
//
|
2023-01-10 19:35:20 +00:00
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
2021-01-15 04:37:51 +00:00
|
|
|
//
|
2023-01-10 19:35:20 +00:00
|
|
|
// Licensed under the Solderpad Hardware License v 2.1 (the “License”); you may not use this file
|
|
|
|
// except in compliance with the License, or, at your option, the Apache License version 2.0. You
|
|
|
|
// may obtain a copy of the License at
|
2021-01-15 04:37:51 +00:00
|
|
|
//
|
2023-01-10 19:35:20 +00:00
|
|
|
// https://solderpad.org/licenses/SHL-2.1/
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, any work distributed under the
|
|
|
|
// License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
|
|
// either express or implied. See the License for the specific language governing permissions
|
|
|
|
// and limitations under the License.
|
2022-01-07 12:58:40 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
2021-01-15 04:37:51 +00:00
|
|
|
|
2023-05-26 21:24:12 +00:00
|
|
|
module rom_ahb import cvw::*; #(parameter cvw_t P, BASE=0, RANGE = 65535) (
|
2021-01-30 05:56:12 +00:00
|
|
|
input logic HCLK, HRESETn,
|
2022-08-25 00:23:08 +00:00
|
|
|
input logic HSELRom,
|
2023-05-26 21:24:12 +00:00
|
|
|
input logic [P.PA_BITS-1:0] HADDR,
|
2021-03-18 22:25:12 +00:00
|
|
|
input logic HREADY,
|
|
|
|
input logic [1:0] HTRANS,
|
2023-05-26 21:24:12 +00:00
|
|
|
output logic [P.XLEN-1:0] HREADRom,
|
2022-08-25 00:23:08 +00:00
|
|
|
output logic HRESPRom, HREADYRom
|
2021-01-30 04:43:48 +00:00
|
|
|
);
|
2021-01-15 04:37:51 +00:00
|
|
|
|
2022-06-13 19:37:43 +00:00
|
|
|
localparam ADDR_WIDTH = $clog2(RANGE/8);
|
2023-05-26 21:24:12 +00:00
|
|
|
localparam OFFSET = $clog2(P.XLEN/8);
|
2022-06-09 23:50:43 +00:00
|
|
|
|
2022-08-25 00:23:08 +00:00
|
|
|
// Never stalls
|
|
|
|
assign HREADYRom = 1'b1;
|
|
|
|
assign HRESPRom = 0; // OK
|
2022-06-08 02:06:00 +00:00
|
|
|
|
2022-08-25 00:23:08 +00:00
|
|
|
// single-ported ROM
|
2023-05-26 21:24:12 +00:00
|
|
|
rom1p1r #(ADDR_WIDTH, P.XLEN, P.FPGA)
|
2022-09-20 15:49:14 +00:00
|
|
|
memory(.clk(HCLK), .ce(1'b1), .addr(HADDR[ADDR_WIDTH+OFFSET-1:OFFSET]), .dout(HREADRom));
|
2021-01-15 04:37:51 +00:00
|
|
|
endmodule
|
2022-03-30 16:09:21 +00:00
|
|
|
|