简体   繁体   中英

invalid module instantiation systemverilog

I am trying to run this code in eda playground but I am getting following errors:

module array_redu(); 
  byte b[] = { 1, 2, 3, 4 }; 
  int sum,product,b_xor;
  initial
    begin 
      sum =b.sum ;  // y becomes 10 => 1 + 2 + 3 + 4
      product =b.product ;  // y becomes 24 => 1 * 2 * 3 * 4
      b_xor=b.xor with (item+ 4 );  // y becomes 12 => 5 ^ 6 ^ 7 ^8 
      $display(" Sum is %0d, product is %0d, xor is  %0b",sum,product,b_xor)
      end
endmodule

I am getting following errors:

design.sv:2: syntax error
design.sv:2: error: Invalid module instantiation
design.sv:3: syntax error
design.sv:3: error: Invalid module instantiation
design.sv:8: syntax error
design.sv:8: error: malformed statement
design.sv:10: syntax error

I simulated your code using Aldec Riviera Pro on EDA Playground . There was only 1 error: you are missing a semi-colon from the end of the line with $display .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM