+ Post New Thread
Results 1 to 5 of 5
  1. #1
    Member level 3
    Points: 417, Level: 4

    Join Date
    Jul 2017
    Posts
    59
    Helped
    1 / 1
    Points
    417
    Level
    4

    Vhdl when else statement error

    hi,
    please anybody help me with the issue...

    Code VHDL - [expand]
    1
    2
    
    ifc_ad8_15 <= "ZZZZZZZZ" when cpu_rst_n and (not rst_hold_f) and (req_rst_r when (req_md_r = "11") else '1') = '1' 
              else rcw_src(0 to 7) when boot_override_r = '1' else "ZZZZZZZZ";

    showing the same error
    Error (10500): VHDL syntax error at req.vhd(556) near text "when";
    expecting ")", or ","
    Error (10500): VHDL syntax error at req.vhd(556) near text ")";
    expecting ";"

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 36,169, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,614
    Helped
    1927 / 1927
    Points
    36,169
    Level
    46

    Re: Vhdl when else statement error

    You cannot embed when statements within other when statements.



    •   AltAdvertisment

        
       

  3. #3
    Member level 3
    Points: 417, Level: 4

    Join Date
    Jul 2017
    Posts
    59
    Helped
    1 / 1
    Points
    417
    Level
    4

    Re: Vhdl when else statement error

    Quote Originally Posted by TrickyDicky View Post
    You cannot embed when statements within other when statements.
    so how do i solve this. can you please help me.



    •   AltAdvertisment

        
       

  4. #4
    Advanced Member level 5
    Points: 36,169, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,614
    Helped
    1927 / 1927
    Points
    36,169
    Level
    46

    Re: Vhdl when else statement error

    Have separate signals for each value..

    Code VHDL - [expand]
    1
    2
    
    a <= '1' when ip else '0';
    b <= '1' when a = '1' else '0';



  5. #5
    Super Moderator
    Points: 61,891, Level: 60
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    12,620
    Helped
    2926 / 2926
    Points
    61,891
    Level
    60

    Re: Vhdl when else statement error

    Hi,

    I can only read VHDL, but not write it, therefore I canīt give you a code solution.

    But the key is to think as a digital circuit, not as a software solution.
    If you know how to draw your logic as a schematic with digital logic ICs, then you should be able to write the VHDL code.
    Maybe a truth table can help.

    Klaus



--[[ ]]--