Академический Документы
Профессиональный Документы
Культура Документы
Alexander Fell
alex@iiitd.ac.in
1 / 59
Outline
Logistics
Rules
Timings
Evaluation
Plagiarism
Slices
Subversion/Git
Makefile
Revision of C
Indentation
Basic Types
Control Flow
Data Structures
Specialties for Embedded Systems
Assembler
References
2 / 59
Why ELD?
3 / 59
Why ELD?
3 / 59
Bad Code
1
2
3
4
5
6
7
8
9
10
11
12
4 / 59
Good Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
5 / 59
Bad Wiring
Source: http://gamercurmudgeon.blogspot.in/2011/04/chaos.html
6 / 59
Why ELD?
Because. . .
Embedded systems are ubiquitous!
I
I
I
I
I
7 / 59
Class
Requirements:
I
I
I
Computer architecture
Operating systems
Basic knowledge about C, Embedded C, Makefiles from the refresher course
http://www.usebackpack.com/
Enroll to Embedded Logic Design
I
I
I
Anonymously: http://bit.ly/ELD-feedback
Non-anonymously:
I
I
In person: B-101
By email: alex@iiitd.ac.in
8 / 59
Labs I
First 15-30 minutes, Q&A session about the next assignment
Requirements
I
I
I
I
I
Console
Compilers
Environments
Labs II
Resources:
I
I
I
I
I
I
10 / 59
Timings
Classes:
I
I
I
Lab:
I
Office Hours:
I
I
11 / 59
Plagiarism
12 / 59
Tentative Schedule
Week 1-2
Week 3-4
Course logistics
Introduction into plagiarism and ethics
Makefile
Revision of C
I
Week 5-6
Week 7-8
Week 9-10
Week 11-12
Week 13
Assembler
Introduction to embedded systems, microcomputers,
microprocessors, microcontrollers, FPGAs, ASICs
Architectural overview of the AVR microcontroller board
Timers, counters, watchdog, PWM, ADCs
Interrupts, interfacing external sensors
Communication protocols: RS232, I2C, SPI, 1 Wire
Introduction into FPGAs
Introduction into Verilog HDL
Combinatorial circuits
Sequential circuits
FSM
13 / 59
Tentative Evaluation I
BTech:
I
I
I
I
I
I
C refresher course: 6%
JAVA introductory course: 2%
Homework, (surprise) tests: 10%
Lab assignments: 32%
Mid term exam: 25% (micro controller)
Final exam: 25% (FPGA)
MTech/PhD:
I
I
I
I
I
Raghav Rule: If you miss lab without excuse (e.g. medical certificate):
Scoreyou = Scoregroup 0.7
14 / 59
Tentative Evaluation II
marks
yourTest
marksassignment = oldMarksassigment max(marks
test )
Probably but not limited to multiple choice questions
Will check mostly for the understanding of underlying concepts.
Simple thing, if you did your assignments by yourself and understood, what you did.
Example:
Your score in the assignment: oldMarksassigment = 13
In the test you have 8 marks out of 10 possible marks, hence
marksassignment = 10.4
15 / 59
Questions?
Questions?
16 / 59
Outline
Logistics
Rules
Timings
Evaluation
Plagiarism
Slices
Subversion/Git
Makefile
Revision of C
Indentation
Basic Types
Control Flow
Data Structures
Specialties for Embedded Systems
Assembler
References
17 / 59
18 / 59
18 / 59
In homeworks
In assignments
In the final project report 0 marks in the whole project, 15% of overall score
In Master Thesis Rejection of thesis, expulsion from institute: no degree, no
placement, no job (2 years wasted)
19 / 59
FPGA I
result = a b + c d . . .
An abstract view of an FPGA; logic cells are embedded in a general routing structure[8]
21 / 59
FPGA II
Configurable Logic Blocks (CLBs) consisting of slices with LUTs, muxers and flip-flops, and Interconnect[12]
22 / 59
FPGA III
LUT Truth Table
Example: 2 input LUT (2-LUT) storing result = a + b
a
0
0
1
1
b
0
1
0
1
result
0
1
1
1
b
0
1
0
1
c
1
1
0
1
23 / 59
Origin of Plagiarism
Laziness
Lack of English vocabulary.
The sentences so soooo nice, concise and beautiful. I must have it.
Lack of understanding
24 / 59
Quotation
According to Scott Hauck and Andre DeHon in [2], a slice with reference to the Xilinx
Virtex-II Pro FPGA comprises primarily two 4-LUT function generators, two
programmable registers for state holding and fast carry logic. (p. 23). However in
recent developments regarding FPGAs, this statement does not hold anymore. Due
to. . .
In your work, you discuss this statement. To inform the reader of your work, what you
are talking about, you need to cite the statement.
25 / 59
Citation
Recent developments regarding FPGAs suggest that slices do not consist of 4-LUTs
including periphery anymore as stated by the authors in [2]. . . .
Summarize! Somebody already wrote what you want to say. Do not reinvent the wheel.
26 / 59
Unintentional Plagiarism
27 / 59
28 / 59
Further Reading
http://www.umuc.edu/writingcenter/plagiarism/index.cfm
http://en.wikipedia.org/wiki/Scientific_plagiarism_in_India
http://www.globalpost.com/dispatch/india/090921/
did-you-write-yaar-india-plagiarism-the-rise
https://www.indiana.edu/~istd/
http://tutorials.sjlibrary.org/tutorial/plagiarism/tutorial/
introduction.htm?flash=yes
http://lmgtfy.com/?q=Plagiarism+Tutorial
https://www2.fairfield.edu/library/lib_plagiarismcourtquiz.lasso
29 / 59
Outline
Logistics
Rules
Timings
Evaluation
Plagiarism
Slices
Subversion/Git
Makefile
Revision of C
Indentation
Basic Types
Control Flow
Data Structures
Specialties for Embedded Systems
Assembler
References
30 / 59
Repositories
Solve problems by slicing problems into smaller parts.
I
I
I
Working code
Added content (functions, modules, etc.)
Previously working code, does not work anymore
31 / 59
Repositories
Solve problems by slicing problems into smaller parts.
I
I
I
Working code
Added content (functions, modules, etc.)
Previously working code, does not work anymore
31 / 59
Repositories
Solve problems by slicing problems into smaller parts.
I
I
I
Working code
Added content (functions, modules, etc.)
Previously working code, does not work anymore
./assignment1/
./Assign1/
./asgn1.backup/
./asgn1.backup1/
...
How will you make sure that your team partner gets the same code that you have
changed?
31 / 59
Repositories
Solve problems by slicing problems into smaller parts.
I
I
I
Working code
Added content (functions, modules, etc.)
Previously working code, does not work anymore
./assignment1/
./Assign1/
./asgn1.backup/
./asgn1.backup1/
...
How will you make sure that your team partner gets the same code that you have
changed?
Use a repository
I
I
I
I
Create revisions
Tag revisions
Does not forget anything
Merge changes
31 / 59
Merging Revisions
32 / 59
Server Clients I
Revision 3
* changed *
Revision 3
commit
Revision 4 (new)
Revision 3
Revision 2
Revision 1
Revision 0
Revision 2
* changed *
33 / 59
Server Clients II
Cray X-MP (1986) used by e.g. Pixar (Jurassic Park) and NASA (aerodynamics of the space shuttle). In the
bench is the power and coolant system[4]. Image source: [11]
34 / 59
Revision 4
* no change *
update
Revision 4
Revision 3
Revision 2
Revision 1
Revision 0
update
Revision 4
Revision 2
* changed *
update
Revision 4
* error merge *
35 / 59
Commands I
Server: svnadmin
svnadmin help
svnadmin help create
Client: svn
svn
svn
svn
svn
svn
svn
svn
svn
help
help
help
help
help
help
help
help
update
checkout
commit
add
remove
log
status
Example:
1. svn checkout
svn+ssh://username@192.168.1.152/home/groupXX /testSVN/
2. svn add newAwesomeFile.txt
3. svn commit -m"Added an awesome file"
4. svn update
36 / 59
Commands II
37 / 59
Outline
Logistics
Rules
Timings
Evaluation
Plagiarism
Slices
Subversion/Git
Makefile
Revision of C
Indentation
Basic Types
Control Flow
Data Structures
Specialties for Embedded Systems
Assembler
References
38 / 59
Makefile
39 / 59
Speedup
Imagine, you are a programmer changing a driver in the Linux Kernel and put an
empty new line somewhere.
I
Linux Kernel: 14.998.651 lines of code (version 3.2), average compilation time on a
2.8GHz, quad core, threaded: 45 minutes.
ext4.o
...
raiserFS.o
vfat.o
btrfs.o
usb1.o
file_systems.o
usb2.o
usb3.o
usb.o
io_system.o
...
40 / 59
Source: [5]
41 / 59
Internals of a Makefile
42 / 59
ext4.o
...
raiserFS.o
vfat.o
btrfs.o
usb1.o
file_systems.o
usb2.o
usb3.o
usb.o
io_system.o
...
usb.o cannot be compiled without having compiled usb1.o, usb2.o and usb3.o
priorly.
43 / 59
Further Reading
44 / 59
Outline
Logistics
Rules
Timings
Evaluation
Plagiarism
Slices
Subversion/Git
Makefile
Revision of C
Indentation
Basic Types
Control Flow
Data Structures
Specialties for Embedded Systems
Assembler
References
45 / 59
Compilation Flow
46 / 59
Indentation I
Write your code in such a way that it is readable (like in Python). You will get special
marks for beautiful code in the assignments!
Example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
uint8_t hourDisplay ;
i f ( hour == 0 ) { hourDisplay = 1 2 ; // i f h o u r == 0
}
e l s e i f ( hour > 1 2 ) { // s o m e t h i n g w i l l happen h e r e
hourDisplay = hour 1 2 ;
} e l s e { hourDisplay = hour ; } // awesome , I n e v e r saw a more b e a u t i f u l code
i f ( hourDisplay < 1 0 )
setPosition ( 1 0 , 0 ) ;
e l s e setPosition ( 9 , 0 ) ;
writeByte ( 0 x4 , 0 ) ; writeNumber ( hourDisplay ) ; writeByte ( : , 0 ) ;
i f ( minute < 1 0 ) {
writeByte ( 0 , 0 ) ;
}
writeNumber ( minute ) ;
47 / 59
Indentation II
Same code from previous example:
1
2
3
4
5
6
7
8
9
10
11
12
uint8_t hourDisplay ;
i f ( hour == 0 )
hourDisplay = 1 2 ;
e l s e i f ( hour > 1 2 ) {
hourDisplay = hour 1 2 ;
} else {
hourDisplay = hour ;
}
i f ( hourDisplay < 1 0 )
setPosition ( 1 0 , 0 ) ;
else
setPosition ( 9 , 0 ) ;
// i f a new day s t a r t s
13
14
15
48 / 59
Basic Types
49 / 59
Control Flow
50 / 59
Data Structures
51 / 59
52 / 59
Outline
Logistics
Rules
Timings
Evaluation
Plagiarism
Slices
Subversion/Git
Makefile
Revision of C
Indentation
Basic Types
Control Flow
Data Structures
Specialties for Embedded Systems
Assembler
References
53 / 59
Mnemonics
Atmega328P supports 131 instructions (refer to chapter 37 of the data sheet[3])
Somehow the instructions are represented in assembler (program.s) Mnemonics
Interrupt the built process by supplying the -S parameter to gcc.
54 / 59
Assembler Example
1
2
3
4
5
6
7
8
9
10
11
12
13
rjmp .L2
.L3 :
l d d r25 , Y+2
l d d r24 , Y+1
add r24 , r25
s t d Y+2, r24
l d d r24 , Y+1
s u b i r24 , lo8 ( (1) )
s t d Y+1, r24
.L2 :
l d d r24 , Y+1
c p i r24 , lo8 ( 1 0 0 )
b r l t .L3
55 / 59
Questions?
Questions?
56 / 59
Outline
Logistics
Rules
Timings
Evaluation
Plagiarism
Slices
Subversion/Git
Makefile
Revision of C
Indentation
Basic Types
Control Flow
Data Structures
Specialties for Embedded Systems
Assembler
References
57 / 59
References I
[1]
English-Word Information.
Plagiarisms: Past and Present.
http://wordinfo.info/unit/3424/ip:8/il:P.
Accessed: 2014-06-24.
[2]
[3]
Atmel Inc.
ATmega48A/PA/88A/PA/168A/PA/328/P Summary.
http://www.atmel.com/Images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_
datasheet_Summary.pdf.
Accessed: 2013-08-06.
[4]
[5]
[6]
[7]
Shakthi Kannan.
Dum Ka Biryani, Make for each other.
http://shakthimaan.com/downloads/glv/presentations/dum-ka-biryani-make-for-each-other.pdf.
Accessed: 2014-06-24.
58 / 59
References II
[8]
Mike Strickland.
The evolution of FPGA coprocessing.
http://www.electronicproducts.com/Digital_ICs/Standard_and_Programmable_Logic/The_evolution_of_FPGA_coprocessing.aspx.
Accessed: 2013-10-01.
[9]
William B. Watterson.
Theres Treasure Everywhere.
March 1996.
59 / 59