Musings, Courses, & Projects by Rob Marano

Notes for Week 1

← back to syllabus ← back to notes

Topics

  1. Intro to logic design using Verilog HDL
  2. Logic elements
  3. Expressions
  4. Modules and ports

Topics Deep Dive

Gate-Level Modeling

Introduction:

SystemVerilog for testbench development:

What is bit swizzling?

Here’s a breakdown of bit swizzling:

Purpose:

Techniques:

For Example:

Let’s say you have a 4-bit data structure 1011 and you want to swap the two middle bits.

You could achieve this through swizzling:

  1. Isolate the middle bits:
    1. Mask the first and last bits with 0011 to get 0011.
  2. Swap the middle bits:
    1. Shift the isolated bits left by one (0110) and right by one (0011).
    2. Combine the shifted results using OR (|) to get 0111.
  3. Combine with the original outer bits:
    1. Mask the original data with 1001 to get 1001.
      1. Combine this with the swapped middle bits using OR (|) to get the final result 1111.

SystemVerilog Support:

SystemVerilog provides powerful bit swizzling capabilities:

Example in SystemVerilog:

logic [7:0] data = 8'b10110100;
logic [7:0] swizzled_data;

swizzled_data = {data[6:7], data[2:3], data[4:5], data[0:1]}; // Swizzle specific bits

Bit swizzling is a fundamental technique in computer architecture and digital design, enabling efficient data manipulation and optimization at the bit level.

More complex gate-level modeling:

Introduction to sequential logic:

Advanced gate-level modeling:

← back to syllabus ← back to notes