Quantcast
Channel: Altera Forums
Viewing all articles
Browse latest Browse all 19390

ModelSim-Altera show error on compilation while Quartus not.

$
0
0
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?

Viewing all articles
Browse latest Browse all 19390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>