Wednesday, 30 September 2015

Difference between wire, reg and logic in SystemVerilog

  1.     Wires are used for connecting different elements
  2.     They can be treated as a physical wire
  3.     They can be read or assigned
  4.     No values get stored in them
  5.     They need to be driven by either continuous assign statement or from a port of a module
  1.     Contrary to their name, regs doesn't necessarily corresponds to physical registers
  2.     They represents data storage elements in Verilog/SystemVerilog
  3.     They retain their value till next value is assigned to them (not through assign statement)
  4.     They can be synthesized to FF, latch or computational circuit (They might not be synthesizable !!!)
Wires and Regs are present from Verilog time-frame. SystemVerilog added a new data type called logic to them. So the next question is what is this logic data type and how it is different from our good old wire/reg.


    As we have seen, reg data type is bit mis-leading in Verilog. SystemVerilog's logic data type addition is to remove the above confusion. The idea behind having a new data type called logic which at least doesn't give an impression that it is hardware synthesizable

    Logic data type doesn't permit multiple driver. It has a last assignment wins behavior in case of multiple assignment (which implies it has no hardware equivalence). Reg/Wire data type give X if multiple driver try to drive them with different value. Logic data type simply assign the last assignment value.

The next difference between reg/wire and logic is that logic can be both driven by assign block, output of a port and inside a procedural block like this

No comments:

Post a Comment