vault backup: 2025-02-03 11:09:09
This commit is contained in:
parent
8d046bb2a6
commit
ba1c7d92b6
@ -1,6 +1,6 @@
|
||||
# Half Adder
|
||||
|
||||
#
|
||||
# Full Adder
|
||||
|
||||
# Ripple Carry Adder
|
||||
|
||||
@ -10,4 +10,6 @@ A carry select adder is built using two ripple carry adders, and multiplexing th
|
||||
The delay is calculated like so:
|
||||
1. Given the delay of a full adder is $k$, and the delay of a 2 to 1 mux is $\frac{1}{m}k$,
|
||||
2. then the delay of a 4 bit ripple carry adder is $4k$, because it's 4 full adders chained together, running sequentially.
|
||||
3. This means that the delay of a 4 bit carry select adder is $4k + \frac{k}{m}$
|
||||
3. This means that the delay of a 4 bit carry select adder is $4k + \frac{k}{m}$
|
||||
|
||||
# Carry-lookahead adder
|
@ -20,7 +20,28 @@ module foo;
|
||||
|
||||
# Variables
|
||||
A variable is a data storage element. They retain the last input given.
|
||||
```verilog
|
||||
```verilog
|
||||
module testbench;
|
||||
integer int_a; // Integer variable
|
||||
real real_b; // Real variable
|
||||
time time_c; // Time variable
|
||||
|
||||
initial begin
|
||||
int_a = 32'hfacd_1b34; // Assign an integer value
|
||||
real_b = 0.1234567; // Assign a floating point value
|
||||
|
||||
#20; // Advance simulation time by 20 units
|
||||
time_c = $time; // Assign current simulation time
|
||||
|
||||
// Now print all variables using $display system task
|
||||
$display ("int_a = 0x%0h", int_a);
|
||||
$display ("real_b = %0.5f", real_b);
|
||||
$display ("time_c = %0t", time_c);
|
||||
end
|
||||
endmodule
|
||||
```
|
||||
```
|
||||
## Registers
|
||||
A `reg` can be used to model hardware registers because it stores a value until the next assignment.
|
||||
|
||||
@ -31,4 +52,9 @@ A Verilog `integer` type is a 32 bit wide storage value. It does not *need* to s
|
||||
```
|
||||
### Time
|
||||
A `time` variable is unsigned, 64 bits wide, and can be used to store time duration for debugging purposes. `realtime` is similar, but time is stored as a floating bit value.
|
||||
|
||||
## Real
|
||||
The `real` type denotes a floating point value.
|
||||
|
||||
|
||||
# Scalar and Vector Types
|
||||
|
Loading…
x
Reference in New Issue
Block a user