Title: Digital Design with VHDL
1??? ???? ??????? ???????
?????? ????? C ???? 8
??? ??? ??? 86-1385
2- ??????? ????(Conditional statement)
- ????? ????? ????? (expression) ?? ???? C ? ?????
?????? - ????? if
- ????? if-else
- ????? switch-case
3????? expression (?????)
- ?????????
- ???????? - / - -
- ????? ?????
- ?????? ?? lt gt lt gt !
- ????? (?) (??) ! (????)
- Expression (?????) ?????? ??? ?? ???????
??????? ? ?????????. - ????? ???????
- ???????? ?? ?????????? ???????? ??????? ?? ???
35 343 x2y - ????? ?????? ??? ?? ?? ???? ?? ?? ???? ???? ??
?????? ???? ???. ????? xlt0 3!4
(x!3 zgt3) x3 4y !(34) - ?????? ??? ???? ?????? ?? ??????? ?? ??????????
?????? ?? ? ????? ????? ?? ????.
4????? (????) ??????
- ?? ????? (???????? ?? ?????) ????? ????? (????)
??? - ????? (????) ????? 34 ????? 7 ???.
- ?? ???? c ?? ????? ?????? ?? ???? ???? 1 ? ??
????? ?????? ?? ?????? ???? 0 ???? ???? ?? ???. - ???? 3gt4 ? 0 ???.
- ???? (4gt5 3gt2) ? 1 ???.
5????
- include ltstdio.hgt
- Void main()
-
- printf(d,(3 4))
-
????? ??? 1 ????? ???. ????? ??? 0 ????? ???.
lt
lt
6???? ?????? ?????? ?????????
7??? ???? ????
- ???? ?????? ??? ?? ????? ????
- 34lt50
- !034
- 011
- 3lt45gt70
- !30
- 3 71
- ???? ?? ???? ?? ???? ??? ?? ??????? ?????? ?????
?? ??? ??? ??? ?? ???? 1 ?? ??? ????? ?? ???.
8??????? ????
?? ?????? ????? ?? ?????? ?? ????? ???? ?????
???? ??? ?? ??? ???? ?????? ????. ???? ??????
?? ??????? ?? ???? ?? ?? ????? ?????? ???? ? ???
???? ?? ?? ??? ???.
include ltstdio.hgt void main() float
x scanf(f,x) ??
9??????? ???? ?? C
- ?? ??? ????? ???? ?? C ???? ????if? if-else ?
switch-case
if (????? ?????) ?? ?? ??? ????? if
(xlt0) y-x if (xlt0) y-x zy1
if (????? ?????) ?? ?? ??? ????? else ?? ??
??? ????? if (xlt0)
y-x else yx if (xlt0) y-x
zy1 else yx
- ????? ????? ???? ???? ?? ???? ?????? ????.
- ?? ????? ?? ??? ??? if ?? else ??? ??
- ?? ????? ????? ???? ??? ? ???? ?????.
10???? 1
- ?????? ??? ????
- include ltstdio.hgt
- void main( )
-
- float x
- printf(Enter the number)
- scanf(f,x)
- if (xlt0)
- printf(f,-x)
- else
- printf(f,x)
-
-
11???? 2
- ???? 2 ) ?????? ?? ???? ?????? sign(x)
- include ltstdio.hgt
- void main()
-
- float x
- int y
- printf("Enter a number")
- scanf("f",x)
- if (xgt0)
-
- y1
- printf("its signd",y)
-
- else
- if (xlt0)
-
- y-1
- printf("its signd",y)
-
?? ???? ??? if ??else ?? ????? ????? if ??
if-else ????? ???? ????. (if-else ??????-nested
if) ???? ?? if ?? if-else ?? ????? ??????
??????? ????? ??? ?? ????? ?? ????? ??? ?? ????
. ?? ???? ??? ?? ?????? ????? ???? else ??? ??
??????? ???? ???.
12Nested-if
- Nested if ?????? ???? ????????? ?????? ? ??????
??? ?? ?? ???. ?? ??? ???? ?????? ?????? ???????
?? ????? ??? ?? ????? ??? ??? ???? - ?? else ?? ????????? if ??? ?? ??? ?????? ???.
????? ?? ???? - ?? ???? ? ????? ???? ????
13???? 1
- ????? ???? ?????? ??? ?? ?? ??? ?????.
- x-3
- if (xgt0)
- if (xgt12)
- printf(X is greater than or equal 12)
- else
- printf(X is less than 12 and greater than 0)
- else
- printf(X is less than 0)
- ????? x is less than 0
14???? 2
- x-5
- if (xgt0)
-
- if (xgt12)
- printf(x is greater or equal than 12)
-
- else
- printf(x is less than 0)
- ????? x is less than 0 ??? ????? ??.
15??????
- ????? ??? ?? ?? ??? ??????
- If (xlt0)
- y3
- else
- y5
- ?? ??????? ?? ? ?? ???? ??? ??????? ?? ?? ???
??? ???? - yxlt0?35
- ??? ??? ?? ????? ????? ? ????? ?? ?? ???? ?? ???
? ????? ?? ???? ????? ???. - ??? ? ????? ???? ?? ???? (Ternary conditional
statement) ???? ?? ???.
16????? switch-case
- ??? ??? ??? ????? ?? ???? ??? ???
- switch ( ?? ??????? ????? ?? ??? ????)
-
- case ??? ???? ?? ???????
- ?????(??)
- break
- case ??? ???? ?? ???????
- ?????(??)
- break
- ..................
- .
- ..
- default
- ?????(??)
-
- ????? ?? ????? ???? ?? ?????? ????? ?? case ??
?????? ?? ???. ??? ?? ????? ??? ?? case ?? ??????
???? ??????? ???? ?? ???? ?? ???. ?? ???? ???
????? ?? ??? ?? ?? case ?? ??????? ??? default
???? ?? ???. - ????? ??? default ??????? ??? .
- ????? ?? ???? ???? ?? ??? ??????? case ??
????. - ????? break ?? ?????? ??????? ?? case ?????? ???.
17???? 1
- x1
- switch(x)
-
- case 1
- printf()
- break
- case 2
- printf()
- break
- case 3
- printf()
- break
- default
- printf(Error)
-
- ????? break ???? ???? ?? switch ?? ???.
- ??? ?? ?????? case ?? break ????? ???? ???? case
???? ???? ?? ???.
18???? 2
- char xb
- switch(x)
-
- case a
- printf(d,a)
- break
- case b
- printf(d,b)
- break
-
- ???? ??? ????? switch ??? ???? ?????? ???? ??
??????? ?? ??? ?? ???.