[pwrmgr] Re-do pwrmgr templating with fusesoc --flag

- No longer require parsing dependencies
- Top vs Ip selection is now done in the core file that actually is switched

Signed-off-by: Timothy Chen <timothytim@google.com>

Minor fix for stray comment

Signed-off-by: Timothy Chen <timothytim@google.com>

[pwrmgr] updates for template

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/pwrmgr/pwrmgr.core b/hw/ip/pwrmgr/pwrmgr.core
index f1bd731..e2b7583 100644
--- a/hw/ip/pwrmgr/pwrmgr.core
+++ b/hw/ip/pwrmgr/pwrmgr.core
@@ -8,9 +8,15 @@
 filesets:
   files_rtl:
     depend:
-      - lowrisc:ip:pwrmgr_component
-      - lowrisc:ip:pwrmgr_only_reg
+      - lowrisc:ip:tlul
       - lowrisc:ip:pwrmgr_pkg
+    files:
+      - rtl/pwrmgr.sv
+      - rtl/pwrmgr_cdc.sv
+      - rtl/pwrmgr_slow_fsm.sv
+      - rtl/pwrmgr_fsm.sv
+      - rtl/pwrmgr_wake_info.sv
+    file_type: systemVerilogSource
 
   files_verilator_waiver:
     depend:
diff --git a/hw/ip/pwrmgr/pwrmgr_component.core b/hw/ip/pwrmgr/pwrmgr_component.core
deleted file mode 100644
index 9034b53..0000000
--- a/hw/ip/pwrmgr/pwrmgr_component.core
+++ /dev/null
@@ -1,24 +0,0 @@
-CAPI=2:
-# Copyright lowRISC contributors.
-# Licensed under the Apache License, Version 2.0, see LICENSE for details.
-# SPDX-License-Identifier: Apache-2.0
-name: "lowrisc:ip:pwrmgr_component:0.1"
-description: "Power manager comopnents"
-
-filesets:
-  files_rtl:
-    depend:
-      - lowrisc:ip:tlul
-      - lowrisc:ip:pwrmgr_pkg
-    files:
-      - rtl/pwrmgr.sv
-      - rtl/pwrmgr_cdc.sv
-      - rtl/pwrmgr_slow_fsm.sv
-      - rtl/pwrmgr_fsm.sv
-      - rtl/pwrmgr_wake_info.sv
-    file_type: systemVerilogSource
-
-targets:
-  default:
-    filesets:
-      - files_rtl
diff --git a/hw/ip/pwrmgr/pwrmgr_pkg.core b/hw/ip/pwrmgr/pwrmgr_pkg.core
index 7723ab7..f2e00c6 100644
--- a/hw/ip/pwrmgr/pwrmgr_pkg.core
+++ b/hw/ip/pwrmgr/pwrmgr_pkg.core
@@ -10,7 +10,7 @@
 filesets:
   files_rtl:
     depend:
-      - lowrisc:ip:tlul
+      - lowrisc:ip:pwrmgr_reg
     files:
       - rtl/pwrmgr_pkg.sv
     file_type: systemVerilogSource
diff --git a/hw/ip/pwrmgr/pwrmgr_only_reg.core b/hw/ip/pwrmgr/pwrmgr_reg.core
similarity index 67%
rename from hw/ip/pwrmgr/pwrmgr_only_reg.core
rename to hw/ip/pwrmgr/pwrmgr_reg.core
index c6baa50..51fda2b 100644
--- a/hw/ip/pwrmgr/pwrmgr_only_reg.core
+++ b/hw/ip/pwrmgr/pwrmgr_reg.core
@@ -2,16 +2,17 @@
 # Copyright lowRISC contributors.
 # Licensed under the Apache License, Version 2.0, see LICENSE for details.
 # SPDX-License-Identifier: Apache-2.0
-name: "lowrisc:ip:pwrmgr_only_reg:0.1"
+name: "lowrisc:ip:pwrmgr_reg:0.1"
 description: "pwrmgr IP only register"
 
 filesets:
   files_rtl:
     depend:
       - lowrisc:tlul:headers
+      - fileset_top ? (lowrisc:systems:pwrmgr_reg)
     files:
-      - rtl/pwrmgr_reg_pkg.sv
-      - rtl/pwrmgr_reg_top.sv
+      - fileset_ip ? (rtl/pwrmgr_reg_pkg.sv)
+      - fileset_ip ? (rtl/pwrmgr_reg_top.sv)
     file_type: systemVerilogSource
 
 targets:
diff --git a/hw/top_earlgrey/ip/pwrmgr/pwrmgr_only_reg.core b/hw/top_earlgrey/ip/pwrmgr/pwrmgr_reg.core
similarity index 90%
rename from hw/top_earlgrey/ip/pwrmgr/pwrmgr_only_reg.core
rename to hw/top_earlgrey/ip/pwrmgr/pwrmgr_reg.core
index e444e27..154b1f8 100644
--- a/hw/top_earlgrey/ip/pwrmgr/pwrmgr_only_reg.core
+++ b/hw/top_earlgrey/ip/pwrmgr/pwrmgr_reg.core
@@ -2,7 +2,7 @@
 # Copyright lowRISC contributors.
 # Licensed under the Apache License, Version 2.0, see LICENSE for details.
 # SPDX-License-Identifier: Apache-2.0
-name: "lowrisc:top_earlgrey:pwrmgr_only_reg:0.1"
+name: "lowrisc:systems:pwrmgr_reg:0.1"
 description: "Auto-generated pwrmgr register sources for top_earlgrey"
 
 filesets:
diff --git a/hw/top_earlgrey/top_earlgrey.core b/hw/top_earlgrey/top_earlgrey.core
index d9d9ac4..931dc72 100644
--- a/hw/top_earlgrey/top_earlgrey.core
+++ b/hw/top_earlgrey/top_earlgrey.core
@@ -36,9 +36,7 @@
       - lowrisc:top_earlgrey:xbar_main
       - lowrisc:top_earlgrey:xbar_peri
       - lowrisc:ip:rstmgr
-      - lowrisc:top_earlgrey:pwrmgr_only_reg
-      - lowrisc:ip:pwrmgr_pkg
-      - lowrisc:ip:pwrmgr_component
+      - lowrisc:ip:pwrmgr
       - lowrisc:tlul:headers
       - lowrisc:prim:all
     files: