Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VHDL Case statement syntax?

VHDL Case statement syntax?

VHDL Case statement syntax?

I am trying to write code to emulate the 8051 microcontroller.  I am modeling the control unit as a giant state machine and I was wondering if some of the case statement syntax I'm using is correct/valid/reasonable.

First of all, is a case within a case statement valid?  Second, when I look at the Op Code, can I use the case statment I am using to execute the same code for when the high nibble is 2, 3, 4, 5, 6, or 9?  (Will the statements at the end only execute if the high nibble is 9 and not the others?).  Please advise, thanks.


   case state is
    when Fetch => IR <= ROM_IN;
                  PC <= PC + 1;
                  state <= Decode;

    when Decode => If (IR(3 downto 0) = "0000") then
                    State <= Exe_Jump;
                    case IR(7 downto 4) is
                     when "0010" =>
                     when "0011" =>
                     when "0100" =>
                     when "0101" =>
                     when "0110" =>
                     when "1001" =>
                      state <= Exe_ALU;
                     when "0111" =>
                      state <= Exe_MOV_Imm;
                     when "1101" =>
                      state <= Exe_DJNZ;
                     when others =>
                      state <= Fetch;
                    end case;
                   End if;


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close