vault backup: 2025-02-03 11:09:09

This commit is contained in:
arc 2025-02-03 11:09:09 -07:00
parent 8d046bb2a6
commit ba1c7d92b6
2 changed files with 30 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# Half Adder # Half Adder
# # Full Adder
# Ripple Carry Adder # Ripple Carry Adder
@ -11,3 +11,5 @@ 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$, 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. 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

View File

@ -20,7 +20,28 @@ module foo;
# Variables # Variables
A variable is a data storage element. They retain the last input given. 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 ## Registers
A `reg` can be used to model hardware registers because it stores a value until the next assignment. 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 ### 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. 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 # Scalar and Vector Types