Question: Execute the code implementing the Structure with enum data type and access all the elements of the enum using inbuilt methods of enum ( NOTE:
Execute the code implementing the Structure with enum data type and
access all the elements of the enum using inbuilt methods of enum
NOTE: execute the code without Typedef
module egstruct;
enum RED GREEN, BLACK, PURPLE, WHITE, GREY color;
struct
enum color; Member of the enum type
sname;
initial begin
sname.color RED;
Display the color names using builtin enum methods
$displayFirst Colour name: s sname.color.name;
$displayLast Color name: s color.namecolorlast;
$displayNext Color name: s color.namecolornextsname.color;
$displaySecond Next color name: s color.namecolornextcolornextsname.color;
$displayPrevious Color name: s color.namecolorprevsname.color;
$displaySecond Previous Color name: s color.namecolorprevcolorprevsname.color;
end
endmodule
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
