<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>HDL | UCSC OSPO</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/tag/hdl/</link><atom:link href="https://deploy-preview-1007--ucsc-ospo.netlify.app/tag/hdl/index.xml" rel="self" type="application/rss+xml"/><description>HDL</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Wed, 21 Aug 2024 00:00:00 +0000</lastBuildDate><image><url>https://deploy-preview-1007--ucsc-ospo.netlify.app/media/logo_hub6795c39d7c5d58c9535d13299c9651f_74810_300x300_fit_lanczos_3.png</url><title>HDL</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/tag/hdl/</link></image><item><title>Final Blogpost: HDEval's LLM Benchmarking for HDL Design</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240821-ashwinbardhwaj/</link><pubDate>Wed, 21 Aug 2024 00:00:00 +0000</pubDate><guid>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240821-ashwinbardhwaj/</guid><description>&lt;h1 id="introduction">Introduction&lt;/h1>
&lt;p>Hello everyone! I&amp;rsquo;m Ashwin Bardhwaj, an undergraduate student studying at UC Berkeley. As part of &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/project/osre23/ucsc/livehd">Micro Architecture Santa Cruz (MASC)&lt;/a> my &lt;a href="https://drive.google.com/file/d/1Fnr85lqrTs7OBohfHfSZI2K3wZU3zJm0/view?usp=sharing" target="_blank" rel="noopener">proposal&lt;/a> under the mentorship of &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/jose-renau/">Jose Renau&lt;/a> and &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/sakshi-garg/">Sakshi Garg&lt;/a> looks to create a suite of benchmark programs for &lt;a href="https://github.com/masc-ucsc/hdeval" target="_blank" rel="noopener">HDEval&lt;/a>.&lt;/p>
&lt;p>The goal of this project is to create large-scale Verilog programs in order to benchmark that capability of LLMs to develop HDL code. Throughout this project, I have created 3 of the large Verilog testbenches called 3-Stage-RISC_V processor, Gameboy Emulator, and Sorts. The benchmark programs will lose their effectriveness if LLMs such as ChatGPT scrape over Github reposotires and learn from them. As a result, the code itself cannot be made public due to LLM scraping over repositories, this file will cover the test report for all 3 of these projects.&lt;/p>
&lt;h1 id="3-stage-risc-v-processor">3 Stage RISC V Processor&lt;/h1>
&lt;p>This is a pipelined RISC processor developed to to handle RV32I instructions. A 3-Stage processsor will typically contain a Fetch, Decode, and Execute cycle. As a result, every instruction will take exactly 3 clock cycles. For this processor, instructions can be formatted into R, I (Load), S (Store), B (Cond), and J (Jump and Link) type instructions. Once a 32 bit instruction is fetched at the location in memory specifed by the pc (Program Counter) register, it is sent to be decoded by the &amp;ldquo;decode unit&amp;rdquo;. Through decoding an instruction, we can determine the exact operation code, register location of the 2 operands (rs1 and rs2), and the destination register (rd) at which to write the calculated result. After decoding, an activation flag is sent to the excetution cycle to then take and access the register file at address rs1 and rs2 in order to get the correct operand data. The data and operation is then sent to the ALU to compute the result based on the opcode. The result is then written back into the register file at the rd address and the program counter is incremented and the next instruction is fetched.&lt;/p>
&lt;p>The prompts for each module in this processor have been generated and tested against a GPT 3 turbo and GPT 4o models as an example. In the RISC V tab in my test report, I have provided the exact prompts and results after running on MASC&amp;rsquo;s &lt;a href="https://github.com/masc-ucsc/hdlagent" target="_blank" rel="noopener">HDLAgent&lt;/a> tool which can access the APIs of many LLMs.&lt;/p>
&lt;h1 id="gameboy-emulator">Gameboy Emulator&lt;/h1>
&lt;p>The Gameboy Emulator is a Verilog implementation of the classic GameBoy console that was widely popular in the 1990s. The main aspects of the GameBoy that were focused on in this project were the Z-80 like CPU, memory objects like RAM, VRAM, and ROM, the PPU (Picture Processing Unit), and other peripherals. The instructions are given to the CISC (variable-length instructions) CPU where they are decoded and executed based on the details and expectations of that specific instruction. In some cases, timing becomes a concern and there is significant effort made to ensure that instructions can be parsed and run predictably and effictively. Instructions from the ROM may take between 1 to 4 clock cycles to run depending on the requirements. For example, the instruction &amp;ldquo;LD B, HL&amp;rdquo; , loads the data found at the 16 bit address given by registers H and L into register B is a 2 cycle instruction. The first cycle decodes the HL address and fetches the data at the accurate location, while the second cycle takes the new input data at writes it into register B. This requires accurate timing control between different asects of the GameBoy.
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="Gameboy Emulator Top Level Wave File" srcset="
/report/osre24/ucsc/livehd/20240821-ashwinbardhwaj/Gameboy_Wave_File_hueac052dcb2b1c9a531ecc9cf3de73e1f_112493_1c31333f2eab882478c68b3e4fe07ef4.webp 400w,
/report/osre24/ucsc/livehd/20240821-ashwinbardhwaj/Gameboy_Wave_File_hueac052dcb2b1c9a531ecc9cf3de73e1f_112493_afc571aac140f2cd4e9e117826b4bf3a.webp 760w,
/report/osre24/ucsc/livehd/20240821-ashwinbardhwaj/Gameboy_Wave_File_hueac052dcb2b1c9a531ecc9cf3de73e1f_112493_1200x1200_fit_q75_h2_lanczos.webp 1200w"
src="https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240821-ashwinbardhwaj/Gameboy_Wave_File_hueac052dcb2b1c9a531ecc9cf3de73e1f_112493_1c31333f2eab882478c68b3e4fe07ef4.webp"
width="760"
height="402"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;p>The Picture Processing Unit is also an integral feature of the gameboy. Three frames called Background, Window, and Sprite are combined into the classic Gameboy screens we know today. White the Background and Window data are consistently called from the VRAM after certain clock cycle times, the Sprite and sprtite attributes are accessed using DMA (Direct Memory Access) from OAM (Object Attribute Memory). This reduces the CPU load and improves the speed of sprite data.&lt;/p>
&lt;h1 id="deliverables">Deliverables&lt;/h1>
&lt;ul>
&lt;li>
&lt;p>&lt;strong>HDEval Test Report&lt;/strong>: The &lt;a href="https://docs.google.com/spreadsheets/d/1vDh_k75h0sG8JGRDDZcdBM4AprVcw9l1/edit?usp=sharing&amp;amp;ouid=102173779464961795129&amp;amp;rtpof=true&amp;amp;sd=true" target="_blank" rel="noopener">HDEval Test Report&lt;/a> contains the module prompts for each testbench, the results after testing on GPT 3 turbo and 4o, and test cases to ensure code correctness and reliability.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>&lt;strong>HDEval Repo&lt;/strong>: &lt;a href="https://github.com/masc-ucsc/hdeval" target="_blank" rel="noopener">HDEval&lt;/a> contains the encrypted version of the yaml files that encapsulate the code, prompts, and additional data.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h1 id="next-steps">Next Steps&lt;/h1>
&lt;p>Given these benchmarks, it is important to track the abilities of these LLMs to generate HDL code. Therefore, including GPT 3-turbo and 4o. I would like these benchmarks to be applied to more models so that we can track their growth and keep informed on their effectiveness in HDL and hardware.&lt;/p>
&lt;h1 id="previous-blogs">Previous Blogs&lt;/h1>
&lt;p>Please feel free to check out my previous blogs!&lt;/p>
&lt;ul>
&lt;li>&lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240611-ashwinbardhwaj/">First Blog&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240718-ashwinbardhwaj/">Midterm Blog&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>Thank you for reading!&lt;/p></description></item><item><title>Midterm Blogpost: HDEval's LLM Benchmarking for HDL Design</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240718-ashwinbardhwaj/</link><pubDate>Thu, 18 Jul 2024 00:00:00 +0000</pubDate><guid>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240718-ashwinbardhwaj/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>Hello! My name is &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/ashwin-bardhwaj/">Ashwin Bardhwaj&lt;/a>, an electrical engineering and computer science student based in San Diego, CA. For the past 6 weeks, I have been working closely with Professor &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/jose-renau/">Jose Renau&lt;/a> on the &lt;a href="https://github.com/masc-ucsc/hdeval" target="_blank" rel="noopener">HDEval&lt;/a> project. The aim of this project is to create multiple project sized HDL benchmarks to evaluate how well existing LLMs can generate Verilog/Chisel code. These benchmarks will include my own &amp;ldquo;golden&amp;rdquo; HDL implementation of the project as well as respective English prompts to guide the LLM. I am excited to be able to work with these tools that have the potential to become a valuable resource for HDL design. So far, I have been successful in creating the first benchmark, a pipelined 3 stage RISC-V core, as well as working through by second project, a Gameboy Emulator.&lt;/p>
&lt;h2 id="risc-v-implementation">RISC-V Implementation&lt;/h2>
&lt;p>Over this past month and a half, I have successfully completed my first benchmark which focuses on creating, modeling, and testing a pipelined 3-stage RISC-V core. The core uses the fetch, decode, and execute structure and is functional for most RV32I instructions. I synthesized and simulated my Verilog using Icarus Verilog and displayed the waveforms on GTKWave. After development, a good section of time was spent creating and tuning the English explanation of each Verilog module. After running these benchmark files through several LLM APIs, we compared the existing &amp;ldquo;golden&amp;rdquo; modules with the generated ones and noticed that more recent versions of LLMs such as GPT 4o and Claude 3 preform much better at creating syntactically correct and efficient code.&lt;/p>
&lt;p>In addition, I have also created a tool that will parse the Verilog and instruction files into the necessary json structure to then test on various models.&lt;/p>
&lt;h2 id="gameboy-emulator">Gameboy Emulator&lt;/h2>
&lt;p>I am also in the process of developing the second benchmark, which targets a Gameboy emulator. This will challenge the LLMs much more than the RISC-V project because apart from the custom CISC CPU, the model should also understand how to handle various other blocks of the hardware system including memory, picture processing unit (PPU), sound processing unit (SPU), various input/output systems like the buttons and cartridge, and interrupt handlers. As a result, it will challenge the model to understand the system as a whole when creating each individual module.&lt;/p>
&lt;h2 id="next-steps">Next Steps&lt;/h2>
&lt;p>As we continue on to the second half of the project, I will continue working on my gameboy emulator. I have already completely developed and tested the Z80-esque CPU, DMA, and interrupt handler but need to continue working on the display and sound interfaces. Also, I will also continue to evaluate and run these tests over a wider range of LLMs to get a better picture of what models and versions are best suited for HDL design as well as the direction these models are going in.&lt;/p></description></item><item><title>HDEval: Benchmarking LLMs that Generate Verilog/Chisel Modules From Natural Language</title><link>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240611-ashwinbardhwaj/</link><pubDate>Tue, 14 May 2024 00:00:00 +0000</pubDate><guid>https://deploy-preview-1007--ucsc-ospo.netlify.app/report/osre24/ucsc/livehd/20240611-ashwinbardhwaj/</guid><description>&lt;p>Hi everyone!&lt;/p>
&lt;p>I&amp;rsquo;m Ashwin Bardhwaj, currently pursuing a bachelors in Electrical Engineering and Computer Science at UC Berkeley. I was recently involved in a project to implement a secure hardware encryption enclave in Verilog. That&amp;rsquo;s why I was excited to work with the MASC group to evaluate how existing generalized LLMs (such as ChatGPT 4 or StarCoder) can generate accurate Verliog/Chisel code from English and assist in the hardware development process.&lt;/p>
&lt;p>As part of &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/project/osre23/ucsc/livehd">Micro Architecture Santa Cruz (MASC)&lt;/a> my &lt;a href="https://drive.google.com/file/d/1Fnr85lqrTs7OBohfHfSZI2K3wZU3zJm0/view?usp=sharing" target="_blank" rel="noopener">proposal&lt;/a> under the mentorship of &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/jose-renau/">Jose Renau&lt;/a> and &lt;a href="https://deploy-preview-1007--ucsc-ospo.netlify.app/author/sakshi-garg/">Sakshi Garg&lt;/a> looks to create a suite of benchmark programs for &lt;a href="https://github.com/masc-ucsc/hdeval" target="_blank" rel="noopener">HDEval&lt;/a>.&lt;/p>
&lt;p>The deliverable of this project is to create multiple large HDL benchmarks along with a respective set of prompts. Using yosys to implement Logic Equivalence Check, we are able to prove through formal verification that the generated code will exhibit the same behavior as the benchmark. In addition, we can also consider the performance and resource utilization of the generated code as a metric.&lt;/p></description></item></channel></rss>