Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
763 Views

combining state machines to a single bdf

hello 

 

i'm doing a university project that involves the back lights of a ford thunderbird. 

i have three separate state machines: 

 

one for left & right turns 

one for break, break+left turn, & break+right turn 

one for break, hazards, & break+hazards 

 

individually, they all work the way they are supposed to on the board (cyclone ii). 

 

however i am having trouble combining each state machine to a single bdf file.  

i tried combining the bus wires to the same output (the lights) but there is an error when compiling. how do i get them all to the same outputs? 

 

i'm using 9.0 build 235 

 

here is a layout of how i have the bdf so far: 

thank you for your help
0 Kudos
7 Replies
Altera_Forum
Honored Contributor I
24 Views

How do you combine them? Do you simply wire them together? Then , your error is surely something like "Output with multiple drivers" 

You must use OR gates to combine those bus wires, if they are active high. If active low, use AND gates.
Altera_Forum
Honored Contributor I
24 Views

I'm still lost on what exactly you mean.

Altera_Forum
Honored Contributor I
24 Views

For example all your 3 blocks are supposed to control the r[0] output. 

You can't connect them in parallel because each line would drive a defined state, high or low, so there would be conflict. 

You must use a OR3 gate: this is an OR gate with 3 inputs which will receive r[0] from your 3 blocks, while the ORed output will drive the fpga pin, namely the right light. 

Same for other r lines and same for other signals: use OR3 or OR2 depending how many sources you need to mix.
Altera_Forum
Honored Contributor I
24 Views

Just to make sure I understand what you're saying: 

 

I need to wire the r[3..0] from each state machine to an OR3/2 gate that I use and then wire that to the r[0]...r[3] outputs? 

 

Is there anyway you can show me a mock-up with one of the outputs?
Altera_Forum
Honored Contributor I
24 Views

Thank you so much. I just have one more issue. 

Is there a way to like set up the gates so if the hazards are activated in the specific state machine, regardless if i turn on the turn switches, the hazards will stay?
Altera_Forum
Honored Contributor I
24 Views

If I understand correctly what you mean, you need to gate the turn signals before the state machine. 

Say you rename iL the signal coming from turn left input pin and sL the signal to the state machine. In your current design they are the same. 

You must gate iL with the h signal, using an AND and a NOT gate.  

sL = iL AND (NOT h)
Altera_Forum
Honored Contributor I
24 Views

I've gotten everything to work :) 

Thanks a ton for your help.
Reply