it answers the question somehow i think.
My intention is to have just one one dq_prpoc, which is just a register (singe bit or multibit) and to use the same register method for different operations like counting, addition, subtraction etc, by passing the right hand side operant from the instantiation code. This is ideally to reduce the code footprint and for maximum configurability.
I’m writing an example below:
def dq_proc(clk, reset, q, d, init_val):
q.next = init_val
q.next = d
NB_CHAIN_COUNTERS = 10
inst = 
data_in = [Signal(int(0)) for i in range(NB_CHAIN_COUNTERS)]
a = [Signal(int(random.randint(0x0100,0xffff)) for i in range(NB_CHAIN_ADDERS)]
b = [Signal(int(random.randint(0x0100,0xffff)) for i in range(NB_CHAIN_ADDERS)]
c = [Signal(int(0)) for i in range(NB_CHAIN_ADDERS)]
# counter instantiation
for i in range(NB_CHAIN_COUNTERS) :
inst.append(dq_proc(clk, reset, data_in[i], data_in[i]+1, int( i*10) ) # there is an issue, i cannot pass data_in[i] + 1 for counter as it is supposed to be incremented on the next clock cycle
# adder instantiation
for i in range(NB_CHAIN_ADDERS) :
inst.append(dq_proc(clk, reset, c[i], a[i]+ b[i], int(0) ) # there is an issue, i cannot pass a[i] + b[i]
This is just an example code for demonstration, but basically my idea was to use only one dq_process and as an arguments instantiate different operations based on user requirements.
It looks like such a dynamic configurability is currently not possible.
The way is to have different methods for counters, adders, subtractors etc and to instantiate each operation seperately.
Is this what you mean?
Or, is it possible to achieve this in some way ?