Skip to content

Commit

Permalink
[prim,pwrmgr] Fix depends hierarchy for pwrmgr
Browse files Browse the repository at this point in the history
Ensure packages with constants are at the leaves of the dependency tree,
so other cores may depend on them without creating cycles. Adjust the
pwrmgr_reg core to depend on the pwrmgr_pkg core, with pwrmgr_reg_pkg
moved to the pwrmgr_pkg core.

Also split the mubi RTL implementations from the package with
declarations and standalone utility functions.

Signed-off-by: Alexander Williams <[email protected]>
  • Loading branch information
a-will committed Dec 18, 2024
1 parent 22168a3 commit 3417989
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 15 deletions.
2 changes: 1 addition & 1 deletion hw/ip/prim/prim_mubi.core
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ filesets:
- lowrisc:prim:assert
- lowrisc:prim:buf
- lowrisc:prim:flop
- lowrisc:prim:mubi_pkg
files:
- rtl/prim_mubi_pkg.sv
- rtl/prim_mubi4_sender.sv
- rtl/prim_mubi4_sync.sv
- rtl/prim_mubi4_dec.sv
Expand Down
45 changes: 45 additions & 0 deletions hw/ip/prim/prim_mubi_pkg.core
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
CAPI=2:
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# ------------------- W A R N I N G: A U T O - G E N E R A T E D C O D E !! -------------------//
# PLEASE DO NOT HAND-EDIT THIS FILE. IT HAS BEEN AUTO-GENERATED WITH THE FOLLOWING COMMAND:
#
# util/design/gen-mubi.py
#
name: "lowrisc:prim:mubi_pkg:0.1"
description: "Multibit types and functions"
filesets:
files_rtl:
depend:
- lowrisc:prim:assert
files:
- rtl/prim_mubi_pkg.sv
file_type: systemVerilogSource

files_verilator_waiver:
depend:
# common waivers
- lowrisc:lint:common

files_ascentlint_waiver:
depend:
# common waivers
- lowrisc:lint:common
files:
- lint/prim_mubi.waiver
file_type: waiver

files_veriblelint_waiver:
depend:
# common waivers
- lowrisc:lint:common

targets:
default: &default_target
filesets:
- tool_verilator ? (files_verilator_waiver)
- tool_ascentlint ? (files_ascentlint_waiver)
- tool_veriblelint ? (files_veriblelint_waiver)
- files_rtl
2 changes: 1 addition & 1 deletion hw/ip/prim_generic/prim_generic_flash.core
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: "prim"
filesets:
files_rtl:
depend:
- lowrisc:ip:tlul
- lowrisc:tlul:headers
- lowrisc:prim:ram_1p
- "fileset_partner ? (partner:systems:ast_pkg)"
- "!fileset_partner ? (lowrisc:systems:ast_pkg)"
Expand Down
2 changes: 1 addition & 1 deletion hw/ip/tlul/headers.core
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ filesets:
depend:
- lowrisc:constants:top_pkg
- lowrisc:prim:secded
- lowrisc:prim:mubi
- lowrisc:prim:mubi_pkg
files:
- rtl/tlul_pkg.sv
file_type: systemVerilogSource
Expand Down
1 change: 1 addition & 0 deletions hw/ip_templates/pwrmgr/pwrmgr.core.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ filesets:
depend:
- ${instance_vlnv("lowrisc:ip:pwrmgr_pkg:0.1")}
- ${instance_vlnv("lowrisc:ip:pwrmgr_reg:0.1")}
- lowrisc:ip:rom_ctrl_pkg
- lowrisc:ip:rv_core_ibex_pkg
- lowrisc:ip:pwrmgr_component
file_type: systemVerilogSource
Expand Down
4 changes: 2 additions & 2 deletions hw/ip_templates/pwrmgr/pwrmgr_pkg.core.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ virtual:

filesets:
files_rtl:
depend:
- ${instance_vlnv("lowrisc:ip:pwrmgr_reg")}
% if wait_for_external_reset:
depend:
- lowrisc:ip:rom_ctrl_pkg
% endif
files:
- rtl/pwrmgr_reg_pkg.sv
- rtl/pwrmgr_pkg.sv
file_type: systemVerilogSource

Expand Down
4 changes: 2 additions & 2 deletions hw/ip_templates/pwrmgr/pwrmgr_reg.core.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ virtual:
filesets:
files_rtl:
depend:
- lowrisc:tlul:headers
- lowrisc:ip:tlul
- ${instance_vlnv("lowrisc:ip:pwrmgr_pkg")}
- lowrisc:prim:subreg
- lowrisc:tlul:headers
files:
- rtl/pwrmgr_reg_pkg.sv
- rtl/pwrmgr_reg_top.sv
file_type: systemVerilogSource

Expand Down
1 change: 1 addition & 0 deletions hw/top_darjeeling/ip_autogen/pwrmgr/pwrmgr.core
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ filesets:
depend:
- lowrisc:opentitan:top_darjeeling_pwrmgr_pkg:0.1
- lowrisc:opentitan:top_darjeeling_pwrmgr_reg:0.1
- lowrisc:ip:rom_ctrl_pkg
- lowrisc:ip:rv_core_ibex_pkg
- lowrisc:ip:pwrmgr_component
file_type: systemVerilogSource
Expand Down
2 changes: 1 addition & 1 deletion hw/top_darjeeling/ip_autogen/pwrmgr/pwrmgr_pkg.core
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ virtual:
filesets:
files_rtl:
depend:
- lowrisc:opentitan:top_darjeeling_pwrmgr_reg
- lowrisc:ip:rom_ctrl_pkg
files:
- rtl/pwrmgr_reg_pkg.sv
- rtl/pwrmgr_pkg.sv
file_type: systemVerilogSource

Expand Down
4 changes: 2 additions & 2 deletions hw/top_darjeeling/ip_autogen/pwrmgr/pwrmgr_reg.core
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ virtual:
filesets:
files_rtl:
depend:
- lowrisc:tlul:headers
- lowrisc:ip:tlul
- lowrisc:opentitan:top_darjeeling_pwrmgr_pkg
- lowrisc:prim:subreg
- lowrisc:tlul:headers
files:
- rtl/pwrmgr_reg_pkg.sv
- rtl/pwrmgr_reg_top.sv
file_type: systemVerilogSource

Expand Down
1 change: 1 addition & 0 deletions hw/top_earlgrey/ip_autogen/pwrmgr/pwrmgr.core
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ filesets:
depend:
- lowrisc:opentitan:top_earlgrey_pwrmgr_pkg:0.1
- lowrisc:opentitan:top_earlgrey_pwrmgr_reg:0.1
- lowrisc:ip:rom_ctrl_pkg
- lowrisc:ip:rv_core_ibex_pkg
- lowrisc:ip:pwrmgr_component
file_type: systemVerilogSource
Expand Down
3 changes: 1 addition & 2 deletions hw/top_earlgrey/ip_autogen/pwrmgr/pwrmgr_pkg.core
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ virtual:

filesets:
files_rtl:
depend:
- lowrisc:opentitan:top_earlgrey_pwrmgr_reg
files:
- rtl/pwrmgr_reg_pkg.sv
- rtl/pwrmgr_pkg.sv
file_type: systemVerilogSource

Expand Down
4 changes: 2 additions & 2 deletions hw/top_earlgrey/ip_autogen/pwrmgr/pwrmgr_reg.core
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ virtual:
filesets:
files_rtl:
depend:
- lowrisc:tlul:headers
- lowrisc:ip:tlul
- lowrisc:opentitan:top_earlgrey_pwrmgr_pkg
- lowrisc:prim:subreg
- lowrisc:tlul:headers
files:
- rtl/pwrmgr_reg_pkg.sv
- rtl/pwrmgr_reg_top.sv
file_type: systemVerilogSource

Expand Down
2 changes: 1 addition & 1 deletion util/design/data/prim_mubi.core.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ filesets:
- lowrisc:prim:assert
- lowrisc:prim:buf
- lowrisc:prim:flop
- lowrisc:prim:mubi_pkg
files:
- rtl/prim_mubi_pkg.sv
% for n in range(1, n_max_nibbles+1):
- rtl/prim_mubi${4*n}_sender.sv
- rtl/prim_mubi${4*n}_sync.sv
Expand Down
45 changes: 45 additions & 0 deletions util/design/data/prim_mubi_pkg.core.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
CAPI=2:
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# ------------------- W A R N I N G: A U T O - G E N E R A T E D C O D E !! -------------------//
# PLEASE DO NOT HAND-EDIT THIS FILE. IT HAS BEEN AUTO-GENERATED WITH THE FOLLOWING COMMAND:
#
# util/design/gen-mubi.py
#
name: "lowrisc:prim:mubi_pkg:0.1"
description: "Multibit types and functions"
filesets:
files_rtl:
depend:
- lowrisc:prim:assert
files:
- rtl/prim_mubi_pkg.sv
file_type: systemVerilogSource

files_verilator_waiver:
depend:
# common waivers
- lowrisc:lint:common

files_ascentlint_waiver:
depend:
# common waivers
- lowrisc:lint:common
files:
- lint/prim_mubi.waiver
file_type: waiver

files_veriblelint_waiver:
depend:
# common waivers
- lowrisc:lint:common

targets:
default: &default_target
filesets:
- tool_verilator ? (files_verilator_waiver)
- tool_ascentlint ? (files_ascentlint_waiver)
- tool_veriblelint ? (files_veriblelint_waiver)
- files_rtl
3 changes: 3 additions & 0 deletions util/design/mubi/prim_mubi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from mako.template import Template # type: ignore

MUBI_PKG_TPL_PATH = "util/design/data/prim_mubi_pkg.sv.tpl"
MUBI_PKG_CORE_TPL_PATH = "util/design/data/prim_mubi_pkg.core.tpl"
MUBI_CORE_TPL_PATH = "util/design/data/prim_mubi.core.tpl"
MUBI_SENDER_TPL_PATH = "util/design/data/prim_mubi_sender.sv.tpl"
MUBI_SYNC_TPL_PATH = "util/design/data/prim_mubi_sync.sv.tpl"
Expand All @@ -15,6 +16,7 @@
MUBI_SW_ASM_TPL_PATH = "util/design/data/multibits_asm.h.tpl"

MUBI_PKG_OUT_PATH = "hw/ip/prim/rtl/prim_mubi_pkg.sv"
MUBI_PKG_CORE_OUT_PATH = "hw/ip/prim/prim_mubi_pkg.core"
MUBI_CORE_OUT_PATH = "hw/ip/prim/prim_mubi.core"
MUBI_SENDER_OUT_PATH = "hw/ip/prim/rtl/prim_mubi{}_sender.sv"
MUBI_SYNC_OUT_PATH = "hw/ip/prim/rtl/prim_mubi{}_sync.sv"
Expand Down Expand Up @@ -60,6 +62,7 @@ def gen() -> None:

tpls = [
(MUBI_PKG_TPL_PATH, MUBI_PKG_OUT_PATH),
(MUBI_PKG_CORE_TPL_PATH, MUBI_PKG_CORE_OUT_PATH),
(MUBI_CORE_TPL_PATH, MUBI_CORE_OUT_PATH),
(MUBI_SW_TPL_PATH, MUBI_SW_OUT_PATH),
(MUBI_SW_ASM_TPL_PATH, MUBI_SW_ASM_OUT_PATH),
Expand Down

0 comments on commit 3417989

Please sign in to comment.