D
dash82
Guest
Hi,
My questions are regarding the code that is posted at the end.
I am a bit confused as to how the flow of the code would proceed.
There is no "always" statement in the code.
First, two instances of cic_interp are instantiated .i.e.
cic_interp_i & cic_interp_q . The signal assignments happen. The most
significant signals i_in and q_in are assigned to signal_in of
cic_interp_i & cic_interp_q.
Question 1:
Do both (cic_interp_i & cic_interp_q) instantiation and assignment
happen at the execution time 0 ?
Or for that matter, all (cic_interp_i , cic_interp_q, phase_acc_tx &
tx_cordic_0) instantiations happen at time 0 ?
I am doubtful of what I am thinking above. Because I can see that
cic_interp_i's output signal bb_i is being assigned as input in
tx_cordic_0. So, if I go by my logic, then wrong assignments would
happen.
Question 2:
Lets assume that some logic is defined for all (cic_interp_i ,
cic_interp_q, phase_acc_tx & tx_cordic_0) modules somewhere else. And
suppose cic_inter_i module logic takes 5 clock cycles to finish its
task and tx_cordic_0 module logic takes 8 clock cycles to finish its
task. So, will tx_cordic_0 wait for 5 clock cycles for cic_interp_i to
finish its task, produce bb_i and then tx_cordic_0 uses this new bb_i
and then takes additional 8 clock cycles to finish its task ?
So, total completion time would be 13 clock cycles ? Am I thinking
right or there is something wrong ?
Thanks !
Shah.
tx_chain.v code (The code is open source and protected by GNU GPL. I
have omitted the license details to save space.)
------------------
module tx_chain
(input clock,
input reset,
input enable,
input wire [7:0] interp_rate,
input sample_strobe,
input interpolator_strobe,
input wire [31:0] freq,
input wire [15:0] i_in,
input wire [15:0] q_in,
output wire [15:0] i_out,
output wire [15:0] q_out
);
wire [15:0] bb_i, bb_q;
cic_interp cic_interp_i
( .clock(clock),.reset(reset),.enable(enable),
.rate(interp_rate),.strobe_in(interpolator_strobe),.strobe_out(sample_strobe),
.signal_in(i_in),.signal_out(bb_i) );
cic_interp cic_interp_q
( .clock(clock),.reset(reset),.enable(enable),
.rate(interp_rate),.strobe_in(interpolator_strobe),.strobe_out(sample_strobe),
.signal_in(q_in),.signal_out(bb_q) );
`define NOCORDIC_TX
`ifdef NOCORDIC_TX
assign i_out = bb_i;
assign q_out = bb_q;
`else
wire [31:0] phase;
phase_acc phase_acc_tx
(.clk(clock),.reset(reset),.enable(enable),
.strobe(sample_strobe),.freq(freq),.phase(phase) );
cordic tx_cordic_0
( .clock(clock),.reset(reset),.enable(sample_strobe),
.xi(bb_i),.yi(bb_q),.zi(phase[31:16]),
.xo(i_out),.yo(q_out),.zo() );
`endif
endmodule // tx_chain
My questions are regarding the code that is posted at the end.
I am a bit confused as to how the flow of the code would proceed.
There is no "always" statement in the code.
First, two instances of cic_interp are instantiated .i.e.
cic_interp_i & cic_interp_q . The signal assignments happen. The most
significant signals i_in and q_in are assigned to signal_in of
cic_interp_i & cic_interp_q.
Question 1:
Do both (cic_interp_i & cic_interp_q) instantiation and assignment
happen at the execution time 0 ?
Or for that matter, all (cic_interp_i , cic_interp_q, phase_acc_tx &
tx_cordic_0) instantiations happen at time 0 ?
I am doubtful of what I am thinking above. Because I can see that
cic_interp_i's output signal bb_i is being assigned as input in
tx_cordic_0. So, if I go by my logic, then wrong assignments would
happen.
Question 2:
Lets assume that some logic is defined for all (cic_interp_i ,
cic_interp_q, phase_acc_tx & tx_cordic_0) modules somewhere else. And
suppose cic_inter_i module logic takes 5 clock cycles to finish its
task and tx_cordic_0 module logic takes 8 clock cycles to finish its
task. So, will tx_cordic_0 wait for 5 clock cycles for cic_interp_i to
finish its task, produce bb_i and then tx_cordic_0 uses this new bb_i
and then takes additional 8 clock cycles to finish its task ?
So, total completion time would be 13 clock cycles ? Am I thinking
right or there is something wrong ?
Thanks !
Shah.
tx_chain.v code (The code is open source and protected by GNU GPL. I
have omitted the license details to save space.)
------------------
module tx_chain
(input clock,
input reset,
input enable,
input wire [7:0] interp_rate,
input sample_strobe,
input interpolator_strobe,
input wire [31:0] freq,
input wire [15:0] i_in,
input wire [15:0] q_in,
output wire [15:0] i_out,
output wire [15:0] q_out
);
wire [15:0] bb_i, bb_q;
cic_interp cic_interp_i
( .clock(clock),.reset(reset),.enable(enable),
.rate(interp_rate),.strobe_in(interpolator_strobe),.strobe_out(sample_strobe),
.signal_in(i_in),.signal_out(bb_i) );
cic_interp cic_interp_q
( .clock(clock),.reset(reset),.enable(enable),
.rate(interp_rate),.strobe_in(interpolator_strobe),.strobe_out(sample_strobe),
.signal_in(q_in),.signal_out(bb_q) );
`define NOCORDIC_TX
`ifdef NOCORDIC_TX
assign i_out = bb_i;
assign q_out = bb_q;
`else
wire [31:0] phase;
phase_acc phase_acc_tx
(.clk(clock),.reset(reset),.enable(enable),
.strobe(sample_strobe),.freq(freq),.phase(phase) );
cordic tx_cordic_0
( .clock(clock),.reset(reset),.enable(sample_strobe),
.xi(bb_i),.yi(bb_q),.zi(phase[31:16]),
.xo(i_out),.yo(q_out),.zo() );
`endif
endmodule // tx_chain