Results 1 to 2 of 2

Thread: ModelSim-Altera show error on compilation while Quartus not.

  1. #1
    Join Date
    Jul 2018
    Posts
    1
    Rep Power
    1

    Default ModelSim-Altera show error on compilation while Quartus not.

    Quartus compile this code without any errors.
    Code.sv

    Code:
    `timescale 1 ns/ 1 nsmodule test013_LITERAL (
        input  A,
        input  B,
        output C
    );
        struct{enum{IDLE,
                    SOME_STAGE_1} FSM;
                 logic some_register;
                } first_machine;
        struct{enum{IDLE,
                    SOME_STAGE_2} FSM;
                 logic some_register;
                } second_machine;            
        assign C = A ^ B;    
    endmodule
    testbench.vt
    Code:
    `timescale 1 ns/ 1 nsmodule testbench();
        reg test_A;
        reg test_B;
        wire test_C;
        test013_LITERAL DUT (.A(test_A),
                             .B(test_B),
                             .C(test_C));
        initial begin    
            #100
                test_A = 0;
                test_B = 0;
            #100
                test_A = 1;
                test_B = 0;    
            #100
                test_A = 0;
                test_B = 1;        
            #100
                test_A = 1;
                test_B = 1;    
        end    
    endmodule
    But ModelSim-Altera show error: "Enum literal name 'IDLE' already exists."
    Emm... Syntaxis of SV allowed me to use enum in struct but literal scope in struct is still common while registers scope in struct is privat.

    Can I write on SystemVerilog two structs in one module and then make enum in each struct with same literal ("IDLE" for example)? Is another struct means another scope?
    If not can anyone describe what structs are used for?
    If yes can anyone describe to me how to win ModelSim-Altera?

  2. #2
    Join Date
    Feb 2018
    Posts
    142
    Rep Power
    1

    Default Re: ModelSim-Altera show error on compilation while Quartus not.

    Hi,
    Can I write on SystemVerilog two structs in one module and then make enum in each struct with the same literal ("IDLE" for example)? Is another struct means another scope?
    If not can anyone describe what structs are used for?
    If yes can anyone describe to me how to win ModelSim-Altera?
    You can use two structs in one module but you can`t use the same enumeration constants between two different enumeration types (since two structs have individual scope) inside two different structs.
    No two enum types can use the same enumeration constants between them
    If you want to use the same enumeration constants between two different enumeration types, you'll have to create unique prefixes or suffixes for them (for example IDLE_1)


    Best Regards
    Vikas Jathar
    (This message was posted on behalf of Intel Corporation)

Similar Threads

  1. Compilation incompatibilities Modelsim-Quartus (component conditional generation)
    By mfbm in forum Quartus II and EDA Tools Discussion
    Replies: 9
    Last Post: February 15th, 2017, 11:09 PM
  2. Can't launch the Modelsim-Altera Software after the compilation
    By kchan in forum Quartus II and EDA Tools Discussion
    Replies: 12
    Last Post: December 9th, 2015, 05:37 AM
  3. Replies: 2
    Last Post: January 20th, 2013, 06:07 AM
  4. Modelsim Altera and Quartus II Web Edition Error
    By boottrax in forum Quartus II and EDA Tools Discussion
    Replies: 4
    Last Post: February 1st, 2012, 04:25 AM
  5. Modelsim compilation error
    By udaysing in forum Quartus II and EDA Tools Discussion
    Replies: 3
    Last Post: December 3rd, 2011, 07:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •