union.sv - 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


18
 
1
module tb;
2
  union {
3
    int num1;
4
    byte num2;
5
  } packet;
6
  
7
  initial begin
8
    packet.num1 = 'habcd;
9
    $display("\tnum1= %0h",packet.num1);
10
    $display("\tnum2= %0h",packet.num2);
11
    
12
    packet.num2 = 'h43;
13
    $display("\tnum1= %0h",packet.num1);
14
    $display("\tnum2= %0h",packet.num2);
15
16
  end
17
endmodule  
18
    
xxxxxxxxxx
1
 
1
// Code your design here
2
31 views and 0 likes     
A short description will be helpful for you to remember your playground's details
 
100:0