BIDIRECTIONAL PORT

1,053 views
Skip to first unread message

JAWALE SHANTANU JAGANNATH 13MVD0070

unread,
Sep 26, 2016, 7:05:37 PM9/26/16
to vlsi-des...@googlegroups.com

module inout1(avdd1,dvdd1,check2,check3,check5);

input avdd1;
input check2;
output reg check3,check5;

output reg dvdd1;
wire ch;
wire ch1;

inout12 i1(avdd1,ch,ch1,check2,check5);

always@(*)

begin
dvdd1=ch;
check3=ch1;
end

endmodule


/*
module inout12(avdd,dvdd,check2,check3);

inout avdd,dvdd;
inout check2;
inout check3;

`ifdef check1_output
assign check2 = check3 ? 1 : 0;
`endif

//assign check4 = 1'b1;

/*
always@(*)
begin
 check4=1'b1;
end

*/

`ifdef avdd_as_input
assign dvdd=avdd;
`endif


`ifdef avdd_as_output
assign avdd=dvdd;
`endif // avdd_as_output

endmodule


TESTBENCH
module inout_tb();

reg avdd1;
reg check2;
wire check3;
wire dvdd1;

inout1 l1(.avdd1(avdd1),.dvdd1(dvdd1),.check2(check2),.check3(check3));

initial
begin
 avdd1=1'b1;
  #2 avdd1=1'b0;
  #4 check2 = 1'b1;
  #300;
  #2 avdd1=1'b1;
  #100 avdd1=1'b0;
#3000 $finish;
end

endmodule

In above program QUESTIONS
1)we can declare inout as reg ?
2)inner module inout while at top if we connect to output /reg  is shows error 

 Expression connected to an 'inout' port must be collapsible.

thats is why i connect through wire and then to output but i want to connect directly to output is there any way we can do changes in inout12.v inner module so that inout pin at top directly we can connect to putput
Reply all
Reply to author
Forward
0 new messages