hw/ip/prim/abstract/prim_rom.sv Cov: 69.7%
1: // Copyright lowRISC contributors.
2: // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3: // SPDX-License-Identifier: Apache-2.0
4:
5: // TODO: This module is a hard-coded stopgap to select an implementation of an
6: // "abstract module". This module is to be replaced by generated code.
7:
8: `ifndef PRIM_DEFAULT_IMPL
9: `define PRIM_DEFAULT_IMPL prim_pkg::ImplGeneric
10: `endif
11: module prim_rom #(
12: parameter prim_pkg::impl_e Impl = `PRIM_DEFAULT_IMPL,
13: parameter int Width = 32,
14: parameter int Depth = 2048, // 8kB default
15: parameter int Aw = $clog2(Depth)
16: ) (
17: input clk_i,
18: input rst_ni,
19: input [Aw-1:0] addr_i,
20: input cs_i,
21: output logic [Width-1:0] dout_o,
22: output logic dvalid_o
23: );
24:
25: import prim_pkg::*;
26:
27: if (Impl == ImplGeneric) begin: gen_mem_generic
28: prim_generic_rom #(
29: .Width(Width),
30: .Depth(Depth)
31: ) u_impl_generic (
32: .clk_i,
33: .rst_ni,
34: .addr_i,
35: .cs_i,
36: .dout_o,
37: .dvalid_o
38: );
39: end else if (Impl == ImplXilinx) begin: gen_rom_xilinx
40: prim_xilinx_rom #(
41: .Width(Width),
42: .Depth(Depth)
43: ) u_impl_generic (
44: .clk_i,
45: .addr_i,
46: .cs_i,
47: .dout_o,
48: .dvalid_o
49: );
50: end else begin : gen_rom_unsupported_impl
51: // TODO: Find code that works across tools and causes a compile failure
52: end
53:
54: endmodule
55: