I need some help changing dynamically parameters of one module
I'm trying to extract part of network data that it comes from the top module and goes to the internal modules
In specific I have one internal module (field_extract) that receives 4 inputs: the clock, data(network data from the top module), a signal that indicates the start of frame (sof), vld (indicates that the data is valid) and two parameters one of them is how many bytes I want to extract from data and the OFFSET of these bytes from the start of frame, the parameter that I want to modify in execution time is the OFFSET
Also, this module has two outputs, one is field(the value extracted from the data) and vld(asserts when the data it was extracted)
Instantiation of this module looks like this:
field_extract # ( .BYTES(1), .OFFSET(TYPE_OFFSET) ) Type_extract ( .clk(clk), .data(data), .sof(sof), .vld(vld), .field(Type), .field_vld(Type_vld) );
my question is how can I change "TYPE_OFFSET" depending on a variable parameters
What I mean with this is: I want to extract "Type" in certain OFFSET depending on certain values extracted from the frame in the past, so "Type" is not at the same position of the frame if the first part of the frame contains certain values something like this:
always @ (posedge clk) begin if (First_Message_Type == MESSAGE_TYPE_X) TYPE_OFFSET <= 50; end
I know that the last code is not possible because TYPE_OFFSET is a constant but here is the question again... there is any way to modify this constant in a time of execution?
I hope this has been clear Thanks for your time and help.