Typedef and alias in System verilog |

Поділитися
Вставка
  • Опубліковано 26 гру 2024

КОМЕНТАРІ • 4

  • @ChiragHadiya
    @ChiragHadiya 9 місяців тому +1

    ma'am if only we have to use the short name of data type than we can directly used the name od the type declared then why we using typedef only to take the short name . and in alias don't get output of 24 for both ?

    • @susheelapatagar
      @susheelapatagar  9 місяців тому +2

      Typedef is not only used to give short names but also allows us to give a meaningful name to the existing data type which helps other users to understand the program more quickly.
      Ex: unsigned int addr;
      .......//your code
      Unsigned int wdata;
      ........//your code
      .......
      //If you use typedef,this is how it looks:
      typedef unsigned int uint;
      uint addr;
      uint wdata;
      ........
      uint rdata,en;
      If you want to change the datatype of the above u can just change in 1st line. U don't hv to change everywhere.
      And typedef construct is also used for forward declaration.
      (You can go through typedef classes concept).

  • @ChiragHadiya
    @ChiragHadiya 9 місяців тому +1

    I am getting x for both a and b instead of 24 ?