[adc_ctrl] move fsm package definition
- this makes it easier for dv and others to re-use.
Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/hw/ip/adc_ctrl/adc_ctrl.core b/hw/ip/adc_ctrl/adc_ctrl.core
index 81ebc94..8eab74e 100644
--- a/hw/ip/adc_ctrl/adc_ctrl.core
+++ b/hw/ip/adc_ctrl/adc_ctrl.core
@@ -12,9 +12,9 @@
- lowrisc:ip:tlul
- "fileset_partner ? (partner:systems:ast_pkg)"
- "!fileset_partner ? (lowrisc:systems:ast_pkg)"
-
-
+
files:
+ - rtl/adc_ctrl_pkg.sv
- rtl/adc_ctrl_reg_pkg.sv
- rtl/adc_ctrl_reg_top.sv
- rtl/adc_ctrl_fsm.sv
@@ -72,4 +72,3 @@
mode: lint-only
verilator_options:
- "-Wall"
-
diff --git a/hw/ip/adc_ctrl/rtl/adc_ctrl_fsm.sv b/hw/ip/adc_ctrl/rtl/adc_ctrl_fsm.sv
index dc2a3c7..058970e 100644
--- a/hw/ip/adc_ctrl/rtl/adc_ctrl_fsm.sv
+++ b/hw/ip/adc_ctrl/rtl/adc_ctrl_fsm.sv
@@ -6,6 +6,7 @@
module adc_ctrl_fsm
import adc_ctrl_reg_pkg::*;
+ import adc_ctrl_pkg::*;
(
input clk_aon_i,
input rst_aon_ni,
@@ -50,30 +51,6 @@
logic [7:0] lp_sample_cnt_thresh;
logic [15:0] np_sample_cnt_thresh;
- //FSM flow
- //1. PWRDN->PWRUP->ONEST_0->ONEST_021->ONEST_1->ONEST_DONE->PWRDN
- //2. PWRDN->PWRUP->LP_0->LP_021->LP_1->LP_EVAL->LP_SLP->LP_PWRUP->LP0->
- // LP_021->LP_1->LP_EVAL->NP_0->NP_021->NP_1->NP_EVAL->NP_0...repeat
- //3. PWRDN->PWRUP->NP_0->NP_021->NP_1->NP_EVAL->NP_0/NP_DONE....repeat
- typedef enum logic [4:0] {
- PWRDN,// in the power down state
- PWRUP,// being powered up
- ONEST_0,// in oneshot mode; sample channel0 value
- ONEST_021,// in oneshot mode; transition from chn0 to chn1
- ONEST_1,// in oneshot mode; sample channel1 value
- ONEST_DONE,
- LP_0,// in low-power mode, sample channel0 value
- LP_021,// in low-power mode, transition from chn0 to chn1
- LP_1,// in low-power mode, sample channel1 value
- LP_EVAL,// in low-power mode, evaluate if there is a match
- LP_SLP,// in low-power mode, go to sleep
- LP_PWRUP,// in low-power mode, being powered up
- NP_0,// in normal-power mode, sample channel0 value
- NP_021,// in normal-power mode, transition from chn0 to chn1
- NP_1,// in normal-power mode, sample channel1 value
- NP_EVAL, // in normal-power mode, detection is done
- NP_DONE
- } fsm_state_e;
fsm_state_e fsm_state_q, fsm_state_d;
diff --git a/hw/ip/adc_ctrl/rtl/adc_ctrl_pkg.sv b/hw/ip/adc_ctrl/rtl/adc_ctrl_pkg.sv
new file mode 100644
index 0000000..bdb3e52
--- /dev/null
+++ b/hw/ip/adc_ctrl/rtl/adc_ctrl_pkg.sv
@@ -0,0 +1,35 @@
+// Copyright lowRISC contributors.
+// Licensed under the Apache License, Version 2.0, see LICENSE for details.
+// SPDX-License-Identifier: Apache-2.0
+//
+// adc_ctrl package module
+
+package adc_ctrl_pkg;
+
+ // FSM flow
+ // 1. PWRDN->PWRUP->ONEST_0->ONEST_021->ONEST_1->ONEST_DONE->PWRDN
+ // 2. PWRDN->PWRUP->LP_0->LP_021->LP_1->LP_EVAL->LP_SLP->LP_PWRUP->LP0->
+ // LP_021->LP_1->LP_EVAL->NP_0->NP_021->NP_1->NP_EVAL->NP_0...repeat
+ // 3. PWRDN->PWRUP->NP_0->NP_021->NP_1->NP_EVAL->NP_0/NP_DONE....repeat
+ typedef enum logic [4:0] {
+ PWRDN, // in the power down state
+ PWRUP, // being powered up
+ ONEST_0, // in oneshot mode; sample channel0 value
+ ONEST_021, // in oneshot mode; transition from chn0 to chn1
+ ONEST_1, // in oneshot mode; sample channel1 value
+ ONEST_DONE, // one shot done
+ LP_0, // in low-power mode, sample channel0 value
+ LP_021, // in low-power mode, transition from chn0 to chn1
+ LP_1, // in low-power mode, sample channel1 value
+ LP_EVAL, // in low-power mode, evaluate if there is a match
+ LP_SLP, // in low-power mode, go to sleep
+ LP_PWRUP, // in low-power mode, being powered up
+ NP_0, // in normal-power mode, sample channel0 value
+ NP_021, // in normal-power mode, transition from chn0 to chn1
+ NP_1, // in normal-power mode, sample channel1 value
+ NP_EVAL, // in normal-power mode, detection is done
+ NP_DONE // normal-power detection done
+ } fsm_state_e;
+
+
+endpackage : adc_ctrl_pkg