Edit code - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

203


21
 
1
//----------------------------------------------------------------------//
2
//              example2 : Enumeration Type [DataTypes]                 //
3
//  This example shows how to declare enum, how to use the enumeration  //
4
//                  methods first and name                      // 
5
//----------------------------------------------------------------------//
6
7
module enum_datatype;
8
9
  //declaration
10
  enum { red, green, blue, yellow, white, black } Colors;
11
  
12
  //display members of Colors
13
  initial begin
14
    Colors = Colors.first;
15
    for(int i=0;i<6;i++) begin
16
      $display("Colors :: Value of  %0s \t is = %0d",Colors.name,Colors);
17
      Colors = Colors.next;      
18
    end
19
  end
20
  
21
endmodule
xxxxxxxxxx
1
 
1
10885 views and 7 likes     
A short description will be helpful for you to remember your playground's details
 
100:0