Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8765261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:14:15+00:00 2026-06-13T16:14:15+00:00

When I initialize an array sbox , I am getting syntax errors. Please help

  • 0

When I initialize an array sbox, I am getting syntax errors. Please help me out.

  reg  [7:0] sbox[15:0];
sbox = '{
 8'h63, 8'h7c, 8'h77, 8'h7b,
 8'hf2, 8'h6b, 8'h6f, 8'hc5,
 8'h30, 8'h01, 8'h67, 8'h2b,
 8'hfe, 8'hd7, 8'hab, 8'h76
};

This is actually sbox. Error it was showing:

near “=”: syntax error, unexpected ‘=’, expecting IDENTIFIER or
TYPE_IDENTIFIER

I was using modelsim simulator

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:14:16+00:00Added an answer on June 13, 2026 at 4:14 pm

    The syntax you are using for the array assignment is only valid in SystemVerilog, not Verilog.

    So your compiler needs to support this, and you need to tell the compiler that the file is SystemVerilog. Most compilers (including modelsim) will assume the file type based on the extension, e.g. .v == Verilog and .sv == SystemVerilog, while others required a switch.

    In addition, as pointed out in the answer from toolic, you need to place the assignment in an initial block, or you could combine the declaration with the assignment, like this:

    reg [7:0] sbox[15:0] = '{
            8'h63, 8'h7c, 8'h77, 8'h7b,
            8'hf2, 8'h6b, 8'h6f, 8'hc5,
            8'h30, 8'h01, 8'h67, 8'h2b,
            8'hfe, 8'hd7, 8'hab, 8'h76
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to initialize an array of structures to all-0's, using the below syntax:
I want to initialize an array and then initialize a pointer to that array.
I want to initialize an array of int and populate it with a range
To create and initialize an array with another array I currently do this: void
How do I create and initialize an array in F# based on a given
Current Version of the Question: I initialize an array $tbd_list as follows: $tbd_list =
Is there are an easy way to initialize byte array from portion of existing
I am writing a program in C++ and I need to initialize an array
Is it possible to do the following (e.g. initialize bool array and set all
I'm having a brain cramp... how do I initialize an array of objects properly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.