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

    Join Date
    Jul 2017
    Posts
    54
    Helped
    1 / 1
    Points
    322
    Level
    3

    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 ";"

    •   Alt9th October 2017, 10:22

      advertising

        
       

  2. #2
    Advanced Member level 5
    Points: 35,007, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,414
    Helped
    1868 / 1868
    Points
    35,007
    Level
    45

    Re: Vhdl when else statement error

    You cannot embed when statements within other when statements.



    •   Alt9th October 2017, 10:23

      advertising

        
       

  3. #3
    Member level 3
    Points: 322, Level: 3

    Join Date
    Jul 2017
    Posts
    54
    Helped
    1 / 1
    Points
    322
    Level
    3

    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.



    •   Alt9th October 2017, 10:26

      advertising

        
       

  4. #4
    Advanced Member level 5
    Points: 35,007, Level: 45
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,414
    Helped
    1868 / 1868
    Points
    35,007
    Level
    45

    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: 52,830, Level: 56
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    10,648
    Helped
    2523 / 2523
    Points
    52,830
    Level
    56

    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



--[[ ]]--