Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Inout verilog port and testbench

Status
Not open for further replies.

Araxnid

Newbie level 6
Joined
Aug 14, 2012
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,366
Hello, can someone help me with simulating my module, i read some topics here about this problem, but still cant understand how to use inout port in right way.

So i have a main module with USB_DATA inout type

Code:
inout	[7:0]USB_DATA;

then, i use
Code:
assign USB_DATA = RX_START ? Q : 8'bZ;
RX_START - my control signal ( reg ) and Q is reg[7:0]

So, in test bench i write it so:
Code:
	wire[7:0] USB_DATA;
	reg [7:0]USB_DATA_reg;
	
	reg oe = 0;

	
	USB U0(RESET,
	CLK,
	USB_DATA,
	USB_RD,
	USB_WR,
	USB_TXE,
	USB_RXF
	);
	
	assign USB_DATA = oe? 8'bZ : USB_DATA_reg;

	initial
	begin
	   USB_DATA_reg[7:0]=0;
		CLK = 0;
		RESET = 0;
	end

So, in modelsim i get USB_DATA_reg zero, but USB_DATA still X, what im doing wrong?
 

what im doing wrong?
Can't be seen from your testbench snippet. Most likely USB_DATA is driven from the module side too. But the state of most control signals is unknown. If they are right, the module may still act wrong.
 

Ok, i find my trouble - i didnt write anything to reg RX_START, so it was X from the simulation start and everything goes bad :( .I wrote zero to it and all go OK!
Sorry for trouble, and thanks for answering
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top