Asee peer logo

DRIVING GPIO PINS WITH RISC-V INSTRUCTION SET ARCHITECTURE

Download Paper |

Conference

2022 ASEE Gulf Southwest Annual Conference

Location

Prairie View, Texas

Publication Date

March 16, 2022

Start Date

March 16, 2022

End Date

March 18, 2022

Tagged Topic

Diversity

Page Count

6

DOI

10.18260/1-2--39174

Permanent URL

https://peer.asee.org/39174

Download Count

1314

Paper Authors

author page

Darius Miles Gatson Houston Baptist University

biography

Ryan Duane Barnes Houston Baptist University

visit author page

Ryan Barnes is a Junior student pursuing a BSc in Computer Science at Houston Baptist University with a strong foundation of object-oriented programming in python, java and javascript.

visit author page

Download Paper |

Abstract

In this paper, we are demonstrating the use of RISC-V assembly code wrapped in C code to operate a 4-bit full adder. This project was implemented as a partial fulfillment of our Computer Architecture (COSC 3341) course project where we learned about the latest open source RISC-V Instruction Set Architecture (ISA). To implement this project, we used the SN74LS283N 4-bit full adder IC, the SiFive HiFive 1 Rev B board that hosts a 32-bit RISC-V processor, breadboard, LEDs, and few resistors. To program the circuit, we used Visual Studio Code with the PlatformIO extension to allow deployment and debugging of the RISC-V assembly code on the HiFive board. The goal of the project was to demonstrate the 4-bit full adder truth table operation by cycling through the different possible inputs and demonstrating the adder output using LED lights. The input to the adder was driven by the board GPIO pins that were enabled through the RISC-V assembly code. Using the SiFive HiFive 1 Rev B manuals, we identified the base memory addresses to access the GPIO pins and the offsets of the individual pins. Through experimentation and debugging of our assembly code, we were able to see the effect of running the code using the debug mode which is un-optimized code, and the effect of pre-built optimized binary code. The un-optimized code ran the circuit in a deterministic way and the output was what we expected, while the optimized code scrambled the code due to the reordering of the instructions and out-of-order execution and the output was non-deterministic. The optimized code had a GPIO pin stay on for the duration of the truth table operation and skewed the results because of it. The un-optimized code, in debug mode, had no GPIO pin held HIGH for the entire truth table operation and the GPIO pins held HIGH and LOW when expected.

Gatson, D. M., & Barnes, R. D. (2022, March), DRIVING GPIO PINS WITH RISC-V INSTRUCTION SET ARCHITECTURE Paper presented at 2022 ASEE Gulf Southwest Annual Conference, Prairie View, Texas. 10.18260/1-2--39174

ASEE holds the copyright on this document. It may be read by the public free of charge. Authors may archive their work on personal websites or in institutional repositories with the following citation: © 2022 American Society for Engineering Education. Other scholars may excerpt or quote from these materials with the same citation. When excerpting or quoting from Conference Proceedings, authors should, in addition to noting the ASEE copyright, list all the original authors and their institutions and name the host city of the conference. - Last updated April 1, 2015