F
fpgabuilder
Guest
How do I replace the i/os on the modules repeatedly instantiated as
below with an instance of an interface?
module top_level
#(parameter
NUM_OF_ADC_INTERFACES=`ADC_BRD_FPGA_NUM_OF_ADC_INTERFACES,
NUM_OF_CHANNELS_PER_ADC_INTERFACE=`ADC_BRD_FPGA_NUM_OF_CHANNELS_PER_ADC_INTERFACE
)
(
//adc channel interfaces
input [NUM_OF_ADC_INTERFACES-1:0] dco_p,
input [NUM_OF_ADC_INTERFACES-1:0] dco_n,
input [NUM_OF_ADC_INTERFACES-1:0] fr_p,
input [NUM_OF_ADC_INTERFACES-1:0] fr_n,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dA_p,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dA_n,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dB_p,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dB_n
);
//deserializer
genvar i;
generate for
(i=0;i<NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE;i=i+1)
begin : adc_in
deserializer deserializer
(
//adc if pins
.dco_p(dco_p[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.dco_n(dco_n[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.fr_p(fr_p[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.fr_n(fr_n[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.dA_p(dA_p),
.dA_n(dA_n),
.dB_p(dB_p),
.dB_n(dB_n),
//parallel data
.dout(dout),
.pclk(pclk)
);
end
endgenerate
I am confused about how I can use one interface block that represents
a bundle of bundle of wires at the top-level and then connect to the
same interface block at a lower-level where one instance of module
within a generate statement gets only one bundle of wires from the
entire bundle. E.g. -
module adc_brd_fpga
#(parameter
NUM_OF_ADC_INTERFACES=`ADC_BRD_FPGA_NUM_OF_ADC_INTERFACES,
NUM_OF_CHANNELS_PER_ADC_INTERFACE=`ADC_BRD_FPGA_NUM_OF_CHANNELS_PER_ADC_INTERFACE
)
(
//adc channel interfaces
adc_if.adcFpgaRx (*) //modport adcFpgaRx contains a generate
statement for
//all the channels.
);
//deserializer
genvar i;
generate for
(i=0;i<NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE;i=i+1)
begin : adc_in
deserializer deserializer
(
//adc if pins
adc_if.channelRx(*),
//parallel data
deser_if.tx(*)
);
end
endgenerate
endmodule
TIA,
Sanjay
below with an instance of an interface?
module top_level
#(parameter
NUM_OF_ADC_INTERFACES=`ADC_BRD_FPGA_NUM_OF_ADC_INTERFACES,
NUM_OF_CHANNELS_PER_ADC_INTERFACE=`ADC_BRD_FPGA_NUM_OF_CHANNELS_PER_ADC_INTERFACE
)
(
//adc channel interfaces
input [NUM_OF_ADC_INTERFACES-1:0] dco_p,
input [NUM_OF_ADC_INTERFACES-1:0] dco_n,
input [NUM_OF_ADC_INTERFACES-1:0] fr_p,
input [NUM_OF_ADC_INTERFACES-1:0] fr_n,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dA_p,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dA_n,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dB_p,
input
[NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE-1:0] dB_n
);
//deserializer
genvar i;
generate for
(i=0;i<NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE;i=i+1)
begin : adc_in
deserializer deserializer
(
//adc if pins
.dco_p(dco_p[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.dco_n(dco_n[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.fr_p(fr_p[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.fr_n(fr_n[i/NUM_OF_CHANNELS_PER_ADC_INTERFACE]),
.dA_p(dA_p),
.dA_n(dA_n),
.dB_p(dB_p),
.dB_n(dB_n),
//parallel data
.dout(dout),
.pclk(pclk)
);
end
endgenerate
I am confused about how I can use one interface block that represents
a bundle of bundle of wires at the top-level and then connect to the
same interface block at a lower-level where one instance of module
within a generate statement gets only one bundle of wires from the
entire bundle. E.g. -
module adc_brd_fpga
#(parameter
NUM_OF_ADC_INTERFACES=`ADC_BRD_FPGA_NUM_OF_ADC_INTERFACES,
NUM_OF_CHANNELS_PER_ADC_INTERFACE=`ADC_BRD_FPGA_NUM_OF_CHANNELS_PER_ADC_INTERFACE
)
(
//adc channel interfaces
adc_if.adcFpgaRx (*) //modport adcFpgaRx contains a generate
statement for
//all the channels.
);
//deserializer
genvar i;
generate for
(i=0;i<NUM_OF_ADC_INTERFACES*NUM_OF_CHANNELS_PER_ADC_INTERFACE;i=i+1)
begin : adc_in
deserializer deserializer
(
//adc if pins
adc_if.channelRx(*),
//parallel data
deser_if.tx(*)
);
end
endgenerate
endmodule
TIA,
Sanjay