Jump to content

Issue with clocking block output


Recommended Posts

Iam seeing issue with mux output from clocking block(Inputs(a,b,sel) are delayed correctly by 1ns where as outputs is in sync with clk).

DUT definition:

module mux(a,b,sel,clk,out);

input [4:0] a;

input [4:0] b;

input clk;

input sel;

output [4:0] out;

reg [4:0] out_temp;

always @(posedge clk) begin


if(sel==0) out_temp <=a;
if(sel==1) out_temp <=b;


end

assign out =out_temp;


endmodule
 

Interface definition:

 

interface mux_if(input clk);

logic [4:0] a;

logic [4:0] b;

logic sel;

logic [4:0] out;


clocking mux_cb @(posedge clk);

   default  input #1ns output #1ns;

   input  out;

   output a,b;
   output sel ;

endclocking     

endinterface    
 

In TB iam instantiating DUT as 

mux mux_inst(.clk(mux_if1.clk),
             .a(mux_if1.a),
             .b(mux_if1.b),
             .sel(mux_if1.sel),
             .out(mux_if1.out)
             );

 


 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...