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.

Using the loop statement for FPGA

Status
Not open for further replies.

shaiko

Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
My FPGA is a "pass through hub" for 3 pairs of Tx and Rx signals between 2 devices called: HOST and UUT.
Each Rx/Tx pair has it's own control signal.
When the control signal is '1' the corresponding Tx is connected to Rx and allows data to flow.
When it's '0' the FPGA drives logic '1' to the Tx.

pic.jpg

Will the following loop do the job ?

Code:
	mux : process 
	( 
		CONNECT_I ,
		HOST_TO_FPGA_RX_I ,
		UUT_TO_FPGA_RX_I ,
		FPGA_TO_HOST_TX_O ,		
		FPGA_TO_UUT_TX_O  			
	) is
	begin
		for index in 0 to 4 
		loop
			if CONNECT_I ( index ) = '1' then
				FPGA_TO_HOST_TX_O ( index )  <= UUT_TO_FPGA_RX_I ( index )  ;
				FPGA_TO_UUT_TX_O ( index )  <= HOST_TO_FPGA_RX_I ( index )  ;
			else 
				FPGA_TO_HOST_TX_O ( index )  <= '1' ;
				FPGA_TO_UUT_TX_O ( index )  <= '1' ;			
			end if ;
		end loop ;	
	end process mux ;
 

Re: Using the loop statement

It's a simple 5-channel mux, I don't see a particular problem related to the loop scheme.

You can also enroll the loop, use a generate statement or rewrite it like this:
Code:
  FPGA_TO_HOST_TX_O  <= UUT_TO_FPGA_RX_I  OR NOT CONNECT_I;
  FPGA_TO_UUT_TX_O  <= HOST_TO_FPGA_RX_I  OR NOT CONNECT_I;
 
  • Like
Reactions: shaiko

    shaiko

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top