# Programmable Logic/Verilog Data Types
## Data Values

Verilog has four values any signal can take:
| Value | Meaning |
| 0 | A binary value of 0. Corresponds to zero volts. |
| 1 | A binary value of 1. Depending on the underlying fabrication technology, may correspond to +5V, +3.3V, or some other positive value. |
| x | A value of "don't care". x values are neither a 0 nor a 1, and should be treated as unknown values. |
| z | A high-impedance value from a tri-state buffer when the control signal is not asserted. Corresponds to a wire that is not connected, or is "floating". |
In practice, x and z values are difficult to use in synthesis, and should typically be avoided, unless there is a very specific reason for using them.

## Wire

Wires, specified with the wire keyword represent physical wires that carry electrical signals from one module to the next. Wires do not store any data, and they must be constantly supplied with a value or they will not contain a value. Wires may not be the target of a blocking or sequential assignment.
Wires come in one of three varieties:
| Type | Function |
| wire | These wires carry simple data from one port to another. |
| wor | These wires are a logical OR of all input data values applied to the wire. These synthesize to OR gates with multiple input ports. |
| wand | These wires are a logical AND of all input data values applied to the wire. These synthesize to AND gates with multiple input ports. |
Wires can be assigned a value using the assign keyword. All assign declarations are considered to be running concurrently and continuously.
In the following case, the value of a is dependent on the values of b and c. Any change in either b or c will result in an automatic and instantaneous change in the value of a.
Circular assignments cannot be made using the assign keyword, as this produces a continuous loop. In the following example, the value of a is undefined, because it depends on itself passed through combinational (i.e. asynchronous, continuously operating) logic.
For the wand and wor data types, all assignments to that wire are considered to be ports to logic gates. For instance, the following code:
Is equivalent to this code:
While it may seem like more work to use wor or wand, they can greatly simplify some complicated logic operations, and they can help to improve the readability of the code.

## Reg

check syntax
A register, denoted with the keyword reg is a memory storage location. Registers store values without needing constant assignment, but they must be manually updated with a blocking or sequential assignment. Register values are all treated as being unsigned values, and any extension of a value into a larger register will not result in logical sign extension.
Registers can be used with the "=" and "<="
Assignments with the "=" operator are blocking assignments, and they will be performed sequentially. Assignments with the "<=" operator are non-blocking. All non-blocking assignments in a particular code block will begin at the same time. The block will not terminate until all the non-blocking assignments have completed.

## Vector

a vector is collection of a variables denoted with same name but with different subscripts example: [2:0]i;

## Integer

Integer values, specified with the integer keyword are similar in function to registers, except that they are treated implicitly as signed numbers. Integer values will be logically sign-extended on assignment.

## Real

A real number can be specified in one of the following two forms.
* decimal notation:examples of numbers in this form are: 2.0, 5.678, 1154.76, 0.1
* scientific notation: examples of numbers in this form are:

## Parameter

A parameter is similar to predefined identifiers in C. It is used to declare a global constant

## Buses

Register and wire types can be specified as multi-bit buses. This assignment is made in the variable declaration using the operator. As an example:
This declares wire a to be a bus of 6 wires, with bit 5 (a[5]) being the MSB, and bit 0 (a[0]) being the LSB. The bit number of the LSB must be lower than the bit number for the MSB, but it needs not be zero.

### Bit Selection

The individual wires or registers in a bus can be interfaced with directly, and subsets of the bus can be manipulated. Given the following declaration:
The following code will set a value to bit 14 of the bus:
And the following code will assign a value to the lower 8 bits of the bus:
Likewise, we can read from only part of a bus. The following code assigns the 8-bit bus b to be the upper 8 bits of the 16-bit bus a:
Part-select operators let the compiler calculate the range based on a starting point and a data-width size;