diff --git a/code/ece152a_pkg.sv b/code/ece152a_pkg.sv new file mode 100644 index 0000000..8901002 --- /dev/null +++ b/code/ece152a_pkg.sv @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2023, University of California; Santa Barbara + * Distribution prohibited. All rights reserved. + * + * File: taillights_pkg.sv + * Description: Taillights SystemVerilog package. + * Includes the enum for the FSM module + */ + +package taillights_pkg; + +typedef enum logic [2:0] { + S000_000, + S000_100, + S000_110, + S000_111, + S001_000, + S011_000, + S111_000, + S111_111 +} state_t; + +endpackage diff --git a/figures/ece152a_pkg.tex b/figures/ece152a_pkg.tex new file mode 100644 index 0000000..f8a3c2d --- /dev/null +++ b/figures/ece152a_pkg.tex @@ -0,0 +1,8 @@ + +\begin{figure}[t] + \centering + \small + \inputminted[frame=single]{systemverilog}{code/ece152a_pkg.sv} + \caption{This is a SystemVerilog package that was provided to ECE 152A students to aid in their implementation of a 1965 Ford Thunderbird taillight state-machine.} + \label{fig:ece152a_pkg} +\end{figure} diff --git a/tex/chapters/5_scalability.tex b/tex/chapters/5_scalability.tex index 3440ae1..1c0c667 100644 --- a/tex/chapters/5_scalability.tex +++ b/tex/chapters/5_scalability.tex @@ -2,11 +2,13 @@ \chapter{Teaching Code Scalability and Development Practices} \label{chapter:scalability} -Aside from ensuring that student code follows best-practices and correctly synthesizes, an equally important skill to teach students is how to efficiently work on large-scale projects. As the number of transistors on an integrated circuit has increased, the scale of Verilog designs has also drastically increased. At Intel, the SoC that my team was verifying had over 800 Verilog source files in the design. Similarly, one of the most popular RISC-V cores, CVA6, is written in nearly 17,000 lines of code. Ensuring seamless development and limiting the number of bugs within these colossal codebases requires strong project management skills. This is achieved by automatic regression, consistent coding styles, and employing version control. In more advanced Verilog courses such as Computer Architecture or SoC design, I argue that teaching code scalability is often just as important as teaching microarchitecture implementation methods. +Aside from ensuring that student code follows best-practices and correctly synthesizes, an equally important skill to teach students is how to efficiently work on large-scale projects. As the number of transistors on an integrated circuit has increased, the scale of Verilog designs has also drastically increased. At Intel, the SoC that my team was verifying had over 500 Verilog source files in the design. Similarly, one of the most popular RISC-V cores, CVA6, is written in nearly 17,000 lines of code \cite{cva6}. Ensuring seamless development and limiting the number of bugs within these colossal codebases requires strong project management skills. This is achieved by automatic regression, consistent coding styles, and employing version control. In more advanced Verilog courses such as Computer Architecture or SoC design, I argue that teaching code scalability is often just as important as teaching microarchitecture implementation methods. \section{SystemVerilog offers many features to aid in code organization.} -Features such as packages, structs, and parameters are incredibly popular in large-scale SystemVerilog projects. And although IEEE 1364 Verilog does not support packages and structs, many RTL designers have found workarounds with \mintinline{systemverilog}{`include} files and functions. [ref:lowrisc, sv2v] These features may not be required to implement hardware algorithms, but are still extremely prevalent in well-organized, large-scale Verilog designs as well as in complex hardware algorithms such as instruction decoding and serial interfaces. In ECE 152A, ECE 154A, and ECE 154B, we were sure to teach students to apply these code organization strategies. [fig] +\input{figures/ece152a_pkg} + +Features such as packages, structs, and parameters are incredibly popular in large-scale SystemVerilog projects. And although IEEE 1364 Verilog does not support packages and structs, many RTL designers have found workarounds with \mintinline{systemverilog}{`include} files and functions. \cite{lowRISCstyleguides, zachjssv2vGitHub} These features may not be \emph{required} to implement hardware algorithms such as instruction decoding and serial interfaces, but are still extremely prevalent in well-organized, large-scale Verilog designs. In ECE 152A, ECE 154A, and ECE 154B, we were sure to teach students to apply these code organization strategies. See \autoref{fig:ece152a_pkg}. \section{Version control should be used in Verilog designs.} @@ -14,4 +16,4 @@ \section{Version control should be used in Verilog designs.} \section{SystemVerilog assertions and in-module verification are important.} -The final design strategy for promoting code scalability is to promote in-module verification. Waveform viewers are incredibly powerful and useful tools, but work best when supplemented with \mintinline{systemverilog}{$display} statements that have already identified where and when a simulation error occurred. Most SystemVerilog in industry designs is full of self-verifying modules by use of SystemVerilog assertions (SVA) and Universal Verification Methodology (UVM). Note that as of 9/10/23, since there is poor SVA and UVM support in open-source tools, many open-source projects have success using \mintinline{systemverilog}{`ifdef} macros to disable UVM and SVA calls on a per-tool basis, or projects only may use a subset of the features which are supported, or the projects resort to a basic \mintinline{systemverilog}{always} blocks instead. [fig] But no matter the specific implementation, in-module verification is a valuable design practice to teach students. In ECE 154A, ECE 154B, and ECE 152A, students were often required to design modules that incorporated simulation-only logic to test basic functionality. By adopting these universal standards, Verilog education becomes better aligned with real-world methodologies for enhanced scalability and proficiency. +The final design strategy for promoting code scalability is to promote in-module verification. Waveform viewers are incredibly powerful and useful tools, but work best when supplemented with \mintinline{systemverilog}{$display} statements that have already identified where and when a simulation error occurred. Most SystemVerilog in industry designs is full of self-verifying modules by use of SystemVerilog assertions (SVA) and Universal Verification Methodology (UVM). Note that as of 9/10/23, since there is poor SVA and UVM support in open-source tools, projects may need to use \mintinline{systemverilog}{`ifdef} macros to disable UVM and SVA calls on a per-tool basis, may need to limit themselves to the subset of supported features, or may need to resort to a basic \mintinline{systemverilog}{always} blocks instead. But no matter the specific implementation, in-module verification is a valuable design practice to teach students. In ECE 154A, ECE 154B, and ECE 152A, students were often required to design modules that incorporated simulation-only logic to test basic functionality. By adopting these universal standards, Verilog education becomes better aligned with real-world methodologies for enhanced scalability and proficiency. diff --git a/tex/thesis.bib b/tex/thesis.bib index bafcae1..d8b5097 100644 --- a/tex/thesis.bib +++ b/tex/thesis.bib @@ -148,6 +148,20 @@ @misc{edalizeGitHub note = {[Accessed 18-09-2023]}, } +@misc{zachjssv2vGitHub, + author = {Zachary Snow}, + title = {zachjs/sv2v: {S}ystem{V}erilog to {V}erilog conversion}, + howpublished = {\url{https://github.com/zachjs/sv2v}}, + note = {[Accessed 19-09-2023]}, +} + +@misc{cva6, + author = {OpenHW Group}, + title = {openhwgroup/cva6: {T}he {C}{O}{R}{E}-{V} {C}{V}{A}6 is an {A}pplication class 6-stage {R}{I}{S}{C}-{V} {C}{P}{U} capable of booting {L}inux}, + howpublished = {\url{https://github.com/openhwgroup/cva6}}, + note = {[Accessed 19-09-2023]}, +} + @misc{awesomeOpenSourceHardware, author = {Andreas Olofsson}, title = {aolofsson/awesome-opensource-hardware: {L}ist of awesome open source hardware tools, generators, and reusable designs},