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
Followup:
---------------
I tried writing a simple test bench and stepping
through my code simulation, but it just would'nt work. I am including
my code
below. I know the test bench is pretty stupid,
but I atleast expected it to enter my code.
I would be grateful if Mike or anyone else in the group could give a
brief indication as to :
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 ?
If not, what would be the flow.? Also, i do understand that signal
assignments are happening in tx_chain code.
But I do believe that much more than instantiations are happening at
different intervals of time.
I do understand that the 'always' statement is defined in the base
classes (Thanks Mike !) . And I do understand the flow in those base
classes.
But, somehow I am confused with the flow for this top module.
Any help is greatly appreciated.
Thanks.
module stimulus;
reg clock;
reg reset;
reg enable;
reg sample_strobe;
reg interpolator_strobe;
wire [7:0] interp_rate ;
wire [31:0] freq ;
wire [15:0] i_in ;
wire [15:0] q_in ;
wire [15:0] i_out ;
wire [15:0] q_out ;
tx_chain testing
(clock,reset,enable,interp_rate,sample_strobe,interpolator_strobe,freq,i_in,q_in,i_out,
q_out);
initial
begin
clock = 1'b1;
reset = 1'b0 ;
enable = 1'b1 ;
sample_strobe = 1'b1 ;
interpolator_strobe = 1'b1 ;
end
endmodule
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
Followup:
---------------
I tried writing a simple test bench and stepping
through my code simulation, but it just would'nt work. I am including
my code
below. I know the test bench is pretty stupid,
but I atleast expected it to enter my code.
I would be grateful if Mike or anyone else in the group could give a
brief indication as to :
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 ?
If not, what would be the flow.? Also, i do understand that signal
assignments are happening in tx_chain code.
But I do believe that much more than instantiations are happening at
different intervals of time.
I do understand that the 'always' statement is defined in the base
classes (Thanks Mike !) . And I do understand the flow in those base
classes.
But, somehow I am confused with the flow for this top module.
Any help is greatly appreciated.
Thanks.
module stimulus;
reg clock;
reg reset;
reg enable;
reg sample_strobe;
reg interpolator_strobe;
wire [7:0] interp_rate ;
wire [31:0] freq ;
wire [15:0] i_in ;
wire [15:0] q_in ;
wire [15:0] i_out ;
wire [15:0] q_out ;
tx_chain testing
(clock,reset,enable,interp_rate,sample_strobe,interpolator_strobe,freq,i_in,q_in,i_out,
q_out);
initial
begin
clock = 1'b1;
reset = 1'b0 ;
enable = 1'b1 ;
sample_strobe = 1'b1 ;
interpolator_strobe = 1'b1 ;
end
endmodule