I have a shared enum logic typedef used to store FSM state type of module_A. I want to use the state information of multiple instances of module_A, in module_B. Is it possible to use packed array of typedef enum logics as I/O port? Is it synthesizable? If not, what could you suggest me to use?
package my_package;
typedef enum logic [1:0] {
STATE_0,
STATE_1,
STATE_2,
STATE_3
} module_a_state_t;
endpackage
module module_A (
output my_package::module_a_state_t state_o
);
// Module body:
my_package::module_a_state_t current_state, next_state;
// FSM goes here
// ...
endmodule
module module_B #(
.NUMBER_OF_MODULE_A_INSTANCES
)(
input [NUMBER_OF_MODULE_A_INSTANCES-1:0] my_package::module_a_state_t multiple_states_i // Is this possible? Is it synthesizable?
);
// Module body
// ...
endmodule
I know that I can make it without using typedef enum logic, such as below. But I want to have an I/O port as generic as possible. In this case being generic means if want to extend the state cases, changing the enum logic width in the package should be enough.
input logic [NUMBER_OF_MODULE_A_INSTANCES:0][1:0] // I don't want to use this.