cvw/src/uncore/rom_ahb.sv

52 lines
1.9 KiB
Systemverilog
Raw Normal View History

2021-01-15 04:37:51 +00:00
///////////////////////////////////////////
// rom_ahb.sv
2021-01-15 04:37:51 +00:00
//
// Written: David_Harris@hmc.edu 9 January 2021
// Modified:
//
// Purpose: On-chip ROM, external to core
2021-01-15 04:37:51 +00:00
//
// Documentation: RISC-V System on Chip Design
2023-01-14 14:15:35 +00:00
//
2023-01-11 23:15:08 +00:00
// A component of the CORE-V-WALLY configurable RISC-V project.
// https://github.com/openhwgroup/cvw
2021-01-15 04:37:51 +00:00
//
// Copyright (C) 2021-23 Harvey Mudd College & Oklahoma State University
2021-01-15 04:37:51 +00:00
//
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
2021-01-15 04:37:51 +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
//
// 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.
////////////////////////////////////////////////////////////////////////////////////////////////
2021-01-15 04:37:51 +00:00
module rom_ahb import cvw::*; #(parameter cvw_t P,
2023-11-13 23:20:26 +00:00
parameter BASE=0, RANGE = 65535, PRELOAD = 0) (
2023-06-15 17:13:15 +00:00
input logic HCLK, HRESETn,
input logic HSELRom,
input logic [P.PA_BITS-1:0] HADDR,
input logic HREADY,
input logic [1:0] HTRANS,
output logic [P.XLEN-1:0] HREADRom,
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-06-15 17:13:15 +00:00
localparam OFFSET = $clog2(P.XLEN/8);
2022-06-09 23:50:43 +00:00
// Never stalls
assign HREADYRom = 1'b1;
assign HRESPRom = 1'b0; // OK
2022-06-08 02:06:00 +00:00
// single-ported ROM
2023-11-13 23:20:26 +00:00
rom1p1r #(ADDR_WIDTH, P.XLEN, PRELOAD)
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