Altera_Forum
Honored Contributor
8 years agoDifference between "logic" and "bit" data types.
Hi all,
As we know "logic" data type has 4 states = 0, 1, X & Z, where as "bit" has only 2 states = 0 & 1. Generally we can see use of "logic" as data type for all kind of signals on internet :rolleyes:. But I have read in book that for 2 states logic we can use "bit" as datatype. So, my question is, 'can we use "bit" data type for those signals like clock or reset which have only 2 states 0 or 1 ?.' :confused: If no then why we can not use it, and if yes then what is advantage of using "bit" over "logic". module test_example ( input bit clk , // system clock input bit reset_n // system reset ); In this is example I have use bit as datatype for clk and reset_n signal. because it is obvious that clock can not be X or Z. So there are many signals that will not be X or Z then why we used logic datatype for those instead of bit. I hope I am clear with my doubt. If anybody has answer for my question, please explain me. All answers are welcomed here..:)