Skip to content

Panda-Code-Master/Vlsi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PES_ASIC_CLASS

This Repository Guides you to complete ASIC flow from scratch (GUIDE : Kunal Ghosh)

The COURSE files are present under those respective day folders

Solutions to frequenty occuring errors are in Error_solution.md

Update

sudo apt update
sudo apt upgrade

Install the Prerequisites(for ubuntu)

chmod +x run_ubuntu.sh
./run_ubuntu.sh

The installed contents will be available at ~/riscv_toolchain

Introduction

Flow : HLL -> ALP -> Binary -> (HDL) -> GDS

  • HLL -> High level language (c , c++)
  • ALP -> Assembly level program
  • HDL -> Hardware Description Language
  • GDS -> Graphic Data System (layout)
The Hardware needs to understand what the Application software is saying it to do.This relation can be eshtablished by System Software

System Software

  • OS : Operating System : Handles IO, memory allocation, Low level system function
  • Compiler : Convert the input to hardware dependent instruction
  • Assembler : Convert the instructions provided by compiler to Binary format
  • HDL : A program that understands the Binary pattern and map it to a netlist
  • GDS : Layout

COURSE

DAY 1

1. Create a simple C program That calculates sum from 1 to N -> sum_1_to_N.c

Compile it using C compiler

gcc sum_1_to_N.c -o 1_to_N.o
./1_to_N.o

-o allows you to name your output file

compile using riscv compieler and view the output

riscv64-unknown-elf-gcc -O1 -mabi=lp64 -march=rv64i -o 1_to_N.o sum_1_to_N.c
spike pk 1_to_N.o
  • -Onumber : level of optimisation required
  • -mabi : specifies the ABI (Application Binary Interface) to be used during code generation according to the requirements
  • -march : specifies target architecture

We can check the different options available for all these fields using the commands go to the directory where riscv64-unkonwn-elf is present

  • -O1 : riscv64-unkonwn-elf --help=optimizer
  • -mabi : riscv64-unknown-elf-gcc --target-help
  • -march : riscv64-unknown-elf-gcc --target-help

To view the disassembled ALP code

riscv64-unkonwn-elf-objdump -d 1_to_N.o

To debug the ALP generated by the compiler

spike -d pk 1_to_N.o
  • press ENTER : shows the first line and successive ENTER shows successive lines
  • reg 0 a2 : checks content of register a2 0th core
  • q : quit the debug process
Difference between the ALP commands when used different optimizers
  • use the command riscv64-unknown-elf-objdump -d 1_to_N.o | less
  • use /instance to search for an instance
  • press ENTER
  • press n to search next occurance
  • press N to search for previous occurance.
  • use esc :q to quit

Contents of main when used -O1 optimizer

contents of main when used -Ofast optimizer

Range of Unsigned numbers : [0, (2^n)-1 ] Range of signed numbes : Positive : [0 , 2^(n-1)-1] Negative : [-1 to 2^(n-1)]

2. create a C program that shows the maximum and minimum values of 64bit unsigend and signed numbers

sign_unsign.c

![sign_snsign_compiled]

DAY 2

BASICS :

Instructions that act on signed or unsigned integers are called Base Integer Instructions There are 47 Base Integer Instructions present in RISC-V ISA

ABI : Application Binary Interface

The instructions generated by compiler using a target ISA can be accessed by OS and User directly

  • The parts of ISA accessible to User : User ISA
  • The parts of ISA accessible to OS : system ISA The access is done using Sysytem calls with the help of ABI

==> If we want to access hardware resources of processor, it has to be done via registers using ABI

Data can be stored in register by 2 methods
  1. Directly store in registers
  2. Store into registers from memory

To store 64 bits of data from mem to reg, we use 8*8bit stores ie., m[0],m[1]......m[7].

RISC-V uses Little Endian format to store the data ie., Least significant Byte is stored in m[0]

The load, add, store etc instructions have different representation formats

Pass The inputs to C program using Registers

The required program files are under day 2 folder

Here we can observe that at 5th line, inorder to comute the result ,its going to the "load" function

Further we will see how to run a C program on on RISC-V CPU

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published