60 lines
1.8 KiB
Markdown
Raw Normal View History

2025-01-17 14:58:02 -07:00
## Boolean Engineering
- Truth tables
- Only practical for small circuits
- Schematic capture
- Using CAD to place logic gates on a virtual canvas
- Facilitates *hierarchical design*
- Good for larger circuits
- Don't scale well for very large circuits
- Hardware Description Languages
- Enables hierarchical design
- Standardized by IEEE
- Design is more portable
- Usable in combination with schematic design
# Verilog
2025-01-17 15:03:02 -07:00
- Originally developed by Gateway Design Automation
- Put in public domain in 1990
- Standardized in 1995
- Originally intended for simulation of logic networks, later adapted to synthesis
2025-01-27 10:37:59 -07:00
- Behavioral Verilog describes broader behavior, at a higher level
2025-01-17 15:03:02 -07:00
```verilog
2025-01-17 16:01:27 -07:00
// V---V---v--v-----portlist (not ordered)
2025-01-17 15:03:02 -07:00
module example1(x1, x2, s, f);
2025-01-17 16:01:27 -07:00
// Defining the types of the various ports
2025-01-17 15:03:02 -07:00
input x1, x2, s;
2025-01-17 15:51:27 -07:00
output f;
2025-01-17 16:01:27 -07:00
// The first argument is the output value.
// In this example, `k`, `g`, `h`, `f` are implicitly declared.
// They could also be declared manually with the syntax `wire foo`, alongside the `input` and `output` declarations
2025-01-17 16:06:27 -07:00
not(k, s); // You can also NOT a variable using a tilde, eg `~s`
2025-01-17 15:51:27 -07:00
and(g, k, x1);
and(h, s, x2);
or(f, g, h);
2025-01-17 15:56:27 -07:00
endmodule
```
2025-01-27 10:37:59 -07:00
```verilog
// V---V---v--v-----portlist (not ordered)
module example1(x1, x2, s, f);
// Defining the types of the various ports
input x1, x2, s;
output f;
// You can also do this
assign f = (~s & x1) | (s & x2);
// Or this
always @(a, b)
// always @(....) says "do this stuff whenever any of the values inside of @(...) change"
{s1, s0} = a + b;
endmodule
```
2025-01-17 16:06:27 -07:00
- Structural Verilog describes how things are laid out at a logic level
2025-01-27 10:37:59 -07:00
## Testbench Layout
2025-01-27 10:42:59 -07:00
- Define UUT module
- Initialize Inputs
- Wait
- Test every possible combination of inputs and validate that the outputs are correct
2025-01-27 10:47:59 -07:00
- Debug output can be displayed with `$display("Hello world");`