You are on page 1of 12

VLSI

Design Automation
Lab instruction

DDEL, University of Cincinnati


Suyuan Chen
Jan.21.2017
Homework:
For all homework this semester, we have to make sure the program
could run without any problem in Linux system.
All homework will be evaluate in the lab machine. (In homework we
do have hardware and time limitation, make sure your program run
on lab machine do able to meet all requirement)
We do have several benchmarks, try to make sure all benchmark can
be run successfully.(Large benchmark will hold more points)

All individual homework should work independently, you could


discuss logic with friend but NO detail code discussion.
Group homework should be well coordinated. No code should be
copied from each other.
All your program will be called parprog.
What I need in the file you submit:
Single zip file, filename (your6+2.zip), no .rar tar.gz etc.
What you need in the zip:
Main.cpp and any other *.cpp file
Makefile
Readme.txt(mention any usage instruction to compile and run your code)
Final report (in PDF, please no .doc,.docx etc.)
DONT submit any *.o file and your final parprog executable file, I DONT need
your benchmark file and result file as well.
IMPORTANT: Double check the file and the zip you are trying to
submit. YOU HAVE ONLY ONE CHANCE TO SUBMIT!!
You submit late for 10min is OK. BUT NO wrong version of file or file missing.
What is your output:

In terminal:
The final cutset is 15.

In the output file:


15 ------------> cutset
1 3 5 6 7 8 9 12 24 54 13 54 65 ------------> partition 1
2 6 8 9 12 5 6 7 13 56 21 12 21 31 32 ------------> partition 2
MOST IMPORTANT THING

Your computer is not that reliable as you


think. Please backup your code frequency.
Otherwise, you lose everything.
How to write a program in Linux
If you do not want to install Linux on your laptop

Mac OS X: g++ and makefile can be used the same as well used in Linux.

Windows: Visual Studio C++ or Code Blocks.

YOU NEED TO RUN YOUR CODE IN LINUX AFTER DEBUG. Your report data should based
on your result running on Linux system.

Highly preferred to install Linux in your laptop


Ubuntu Gnome, Linux Mint, etc.
How to write a program in Linux
Make sure you have g++ and gdb(for debug) are installed.

One editor program could be used: vim/Gvim or emacs prefered.


Write your main.cpp and other related *.cpp , *.h file in one folder.

Write a makefile that will give the compile information that you want to use.

Type make in the terminal under the folder that you have the makefile.
If NO ERROR, go and run your program

Else, use gdb to debug your code and clear the bugs
C++ code format
Max Width of each line: 70 Characters

All function comment and date create/


modified need to explain at the begin-
-ning of the function.

All indent == 2 space.

To run your program, you should use


the exact format showed below:
./parprog b1 r1

While b1 is the input benchmark file,


and r1 is the result file we generate.
Makefile instruction
the Makefile tells make how to compile and link a program.
Using C/C++ as an example, when a C/C++ source file is changed,
it must be recompiled. If a header file has changed, each C/C++
source file that includes the header file must be recompiled to
be safe. Each compilation produces an object file corresponding
to the source file. Finally, if any source file has been
recompiled, all the object files, whether newly made or saved
from previous compilations, must be linked together to produce
the new executable program. These instructions with their
dependencies are specified in a Makefile. If none of the files
that are prerequisites have been changed since the last time the
program was compiled, no actions take place. For large software
projects, using Makefile can substantially reduce build times if
only a few source files have changed.
Makefile example:
Line1: tool is the final program name after
compiling. You should use parprog
in all homework.
use 3 object file that we need to
generate the final executable file.

Line3: compile SA.cpp file and generate SA.o


file

Line5: compile place.cpp file and generate


place.o file Optional options in g++:
-g used in gdb debug, you need to add this option if you wan to used
Line7: compile main.cpp file and generate gdb to do the code debug.
main.o file
-O used the compiler to optimize the code, you have O1, -O2, -O3.
Line9: clean command will remove all *.o this will effect your code sequence and print out information in
object file and the executable file.( debug. Use with care!!
any file generate by the comiler should
be deleted.). If you want a clean compile. -c to compile the *.cpp file to object file.
run make clean first, then run make.
(NO NOT REMOVE any *.cpp file) -o. Use the *.o file to output the final executable file.
Debug in gdb
Gdb is one of the most popular debugger in Linux coding.
We only introduce few basic function.

To run gdb, type gdb in terminal


To read your executable file file tool
To add break point b main.cpp:199, you could add more if you need more
breakpoint.
To start your program, type r b1 r1
The program will pause at the breakpoint, you could step into the function
with entering s, go to next line with n, or continue to the program with
c and program will stop at the next breakpoint.
You could also print variable to print any variable that you want to check.
Gdb example

You might also like