verilog - Delay between two instantiations of same module -


i want run following code:

module (input a1 ,clock, reset, output aout);  ---- ---- ----  key k1(a1,clock,reset,k1out); // takes around 40 cycles complete   key k2(k1out,clock,reset,k2out);  endmodule 

k1out displayed correctly, k2out not. in fact getting k2out xxxxx. there way provide delay between these 2 instantiations executed in order , can output correctly?

your describing hardware, 2 instances exist in parallel.

you either control clock each block execute sequentially, or build state machine sequence them.

with clock gating (internal key):

module (input a1 ,clock, reset, output aout);  ---- ---- ----  logic [6:0] state; @(posedge clock or posedge reset) begin   if (reset) begin     state <= 'b0;   end   else begin     if (state >= 7'd80) begin       state <= 'b0 ;     end else        state <= state + 1'b1;   end end  wire k1_enable = (state <  7'd40 ); wire k2_enable = (state >= 7'd40);   key k1(a1,   clock,reset,k1out, k1_enable);  key k2(k1out,clock,reset,k2out, k2_enable);  endmodule 

sequential elements of key use:

always @(posedge clock or posedge reset) begin   if (reset) begin     data <= 1'b0;   end   else begin     if (enable) begin       data <= ; //next value     end     //else hold data   end end 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -