EmbDev.net

Forum: FPGA, VHDL & Verilog Mutiple source drivers - How to resolve it??


Author: John Mayer (215)
Posted on:

Rate this post
0 useful
not useful
I have this process
state_fail_win <= test;
process(clk,anode,counter_1,counter_10, state_fail_win,anode,counter_1r,counter_10r)
variable prescaler: integer range 0 to 49999999 := 0;
begin
if rising_edge(clk) then
    if(prescaler < 49999999/200) then   
    prescaler := prescaler + 1;    
    else
      prescaler := 0;
      anode <= anode + '1';
    end if;
end if;    
      
if state_fail_win = '1' then 
  if (counter_1 < 9) then        
    counter_1 <= counter_1 + 1;
  else
    counter_1 <= 0;
      if (counter_10 < 9) then        
        counter_10 <= counter_10 + 1;  
      else 
        counter_10 <= 0;
        counter_1 <= 0;
      end if;
  end if;
end if;
state_fail_win <= '0';
  if state_fail_win = '0' then
    case anode is
      when "00" => SEG <= counter_1r; 
      when "01" => SEG <= counter_10r;
      when "10" => SEG <= d;
      when "11" => SEG <= r;    
      when others => SEG <= "00000000";
    end case;
  end if;
end process;  
I don't quite see how i get this error message..
Multi-source in Unit <segment> on signal <test>; this signal is 
connected to multiple drivers.
But how can i Resolve it??

: Edited by User
Author: Duke Scarring (Guest)
Posted on:

Rate this post
0 useful
not useful
John Mayer wrote:
> process(clk,anode,counter_1,counter_10,
> state_fail_win,anode,counter_1r,counter_10r)
> variable prescaler: integer range 0 to 49999999 := 0;
> begin
> if rising_edge(clk) then
>     if(prescaler < 49999999/200) then
>     prescaler := prescaler + 1;
>     else
>       prescaler := 0;
>       anode <= anode + '1';
>     end if;
Uhh.
1. You mix up sequential (clk) and combinatorical (without clk) logic in 
the same process. That's very advanced and usally confusing for 
beginners.

2. At least the signal state_fail_win is driven on diffrent places: 
Outside the process and inside the process. That's construct cannot map 
to hardware.

Remember this: Drive a signal only at one point and read it wherever 
you need it. A process is like a chip in your circuit with inputs and 
outputs.

Duke

Author: FPGA-advisor (Guest)
Posted on:

Rate this post
0 useful
not useful
you should learn to describe any of the signals in a design only in one 
process rather than accesing it from various places.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.