Giter Site home page Giter Site logo

ctb-337 / my-systemverilog-examples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeffdecola/my-verilog-examples

1.0 0.0 0.0 7.55 MB

A place to keep my synthesizable SystemVerilog code snippets and examples.

License: MIT License

Shell 24.36% Verilog 71.25% SystemVerilog 4.38%

my-systemverilog-examples's Introduction

my-systemverilog-examples

Issue Count License

A place to keep my synthesizable SystemVerilog code snippets and examples.

Table of Contents,

Documentation and reference,

GitHub Webpage built with concourse ci

SCRIPT TO LAUNCH GTKWAVE

To make things easier when viewing a waveform, I wrote a script that will launch GTKWave with your saved *.gtkw file from Windows WSL, macOS or Linux (Whatever you use).

The script is launch-gtkwave.sh.

A QUICK NOTE ON SYNTHESIS

I declare my ports as follows because that's what the synthesis tools want. Who am I to argue,

    module NAME (
        input             a,     // Input A
        input       [7:0] b,     // Input B
        output reg  [3:0] y      // Output Y
    );

Also, I would stay away from asynchronous design. It can have problems when you synthesize to an FPGA.

    // DO THIS
    always @ (posedge clk) begin
        if (~reset) begin
            ...

    // NOT THIS
    always @ (posedge clk or negedge reset) begin

SYSTEMVERILOG EXAMPLES

All sections in alphabetical order. Each example uses iverilog to simulate and GTKWave to view the output. I also used Xilinx Vivado to synthesize and program these verilog examples on a Digilent ARTY-S7 FPGA development board. These examples also contain info I gathered from other sources.

BASIC CODE

COMBINATIONAL LOGIC

  • ALUs

    • jeff-74x181

      4-bit alu (arithmetic logic unit) and function generator. Provides 16 binary logic operations and 16 arithmetic operations on two 4-bit words. Based on the 7400-series integrated circuits used in my programable-8-bit-microprocessor below.

  • DATA OPERATORS

  • DECODERS & ENCODERS

    • decoder-3-8

      Decoder - Three inputs decodes to 1 of 8 outputs (hot).

    • decoder-to-encoder

      Combining the decoder-3-8 to the encoder-8-3 to prove the input will equal the output.

    • encoder-8-3

      Encoder - Eights inputs (1 hot) encodes to output.

  • MULTIPLEXERS & DEMULTIPLEXERS

    • demux-1x4

      Demultiplexer - One input, four outputs (using a case statement).

    • jeff-74x151

      8-line to 1-line data selector/multiplexer. Based on the 7400-series integrated circuits used in my programable-8-bit-microprocessor below.

    • jeff-74x157

      Quad 2-line to 1-line data selector/multiplexer, non-inverting outputs. Based on the 7400-series integrated circuits used in my programable-8-bit-microprocessor below.

    • mux-4x1

      Multiplexer - Four inputs, one output (using a case statement).

    • mux-to-demux

      Combining the mux-4x1 to the demux-1x4 to prove the input will equal the output (For the selected output).

FPGA DEVELOPMENT BOARDS

  • BUTTONS

    • buttons

      A few different ways to use buttons on a FPGA development board.

SEQUENTIAL LOGIC

SYSTEMS

my-systemverilog-examples's People

Contributors

jeffdecola avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.