게이트및스위치프리미티브 q predefined primitives v 정의나선언없이사용가능 v 단일출력을가짐 v 모듈내에서만사용가능 Ø initial과 always 구문내부에서는사용불가 Verilog 에서제공되는게이트및스위치프리미티브 n-input gates n-out

Size: px
Start display at page:

Download "게이트및스위치프리미티브 q predefined primitives v 정의나선언없이사용가능 v 단일출력을가짐 v 모듈내에서만사용가능 Ø initial과 always 구문내부에서는사용불가 Verilog 에서제공되는게이트및스위치프리미티브 n-input gates n-out"

Transcription

1 디지털시스템설계및실습 3. 게이트수준모델링 1

2 게이트및스위치프리미티브 q predefined primitives v 정의나선언없이사용가능 v 단일출력을가짐 v 모듈내에서만사용가능 Ø initial과 always 구문내부에서는사용불가 Verilog 에서제공되는게이트및스위치프리미티브 n-input gates n-output gates three-state gates pull gates MOS switches bidirectional switches and buf bufif0 pulldown cmos rtran nand not bufif1 pullup nmos rtranif0 nor notif0 pmos rtranif1 or notif1 rcoms tran xnor rnmos tranif0 xor rpmos tranif1 2

3 게이트프리미티브 q gate primitives v 인스턴스구문 primitive_gate_name [#(n1,n2)][instance_name](output, input1,..); v #(n1,n2) : 게이트프리미티브의지연. default 지연값은 0 Ø n1 : 상승지연, n2 : 하강지연 Ø min(n1, n2) : 출력이 x (unknown) 로변할때의지연 v instance_name : 생략가능 v 포트연결 : Ø 순서에의한매핑만사용가능 ( 이름에의한포트매핑불가능 ) Ø 출력포트가처음에오며, 입력신호들은임의의순서로나열 3

4 게이트프리미티브 and 게이트 and 0 1 x z x x x 0 x x x z 0 x x x or 게이트 or 0 1 x z x x x x 1 x x z x 1 x x xor 게이트 xor 0 1 x z x x x x x x x x x z x x x x nand 게이트 nand 0 1 x z x x x 1 x x x z 1 x x x nor 게이트 nor 0 1 x z x x x x 0 x x z x 0 x x xnor 게이트 xnor 0 1 x z x x x x x x x x x z x x x x 4

5 게이트프리미티브 and U1(out1, a, b); // 2입력 and 게이트 nand (out2, a, b); // 인스턴스이름을생략한경우 or U3(out3, a, b, c); // 3입력 or 게이트 nor #(2) U4(out4, a, b); // 2입력 nor 게이트 xor #(3, 4) U5(out5, c, b, a); // 3입력 xor 게이트 xnor U6(out6, a, b); // 2입력 xnor 게이트 // multiple instantiations module full_adder_g(a, b, cin, sum, cout); input a, b, cin; output sum, cout; wire s1, c1, c2; xor (s1, a, b); and (c1, a, b); and G3 (c2, s1, cin); xor G4 (sum, s1, cin); xor G5 (cout, c1, c2); module a b cin s1 c1 c2 sum cout 5

6 buf 와 not 게이트프리미티브 buf 게이트 not 게이트 input output input output buf input output x x z x not input output x x z x buf b1(out1, out2, in); not #5 inv(out, in); 6

7 3 상태버퍼프리미티브 v 포트연결 : Ø 순서에의한매핑만사용가능 Ø 출력포트, 데이터입력포트, 제어입력포트의순서로매핑 v 3 개의지연값지정 : #(n1, n2, n3) Ø n1 : 상승지연, n2 : 하강지연, n3 : z 로변할때의지연 Ø min(n1, n2, n3) : 출력이 x 로변할때의지연 v 2 개의지연값지정 : #(n1, n2) Ø n1 : 상승지연, n2 : 하강지연 Ø min(n1, n2) : 출력이 x 또는 z 로변할때의지연 bufif0 bf0(out0, in, control); bufif1 #(10,12,11) bf1(out1, in, control); 7

8 3 상태버퍼프리미티브 bufif1 bufif0 notif1 notif0 data out data out data out data out control control control control bufif1 D A T A CONTROL 0 1 x z 0 z 0 L L 1 z 1 H H x z x x x z z x x x notif0 D A T A CONTROL 0 1 x z 0 1 z H H 1 0 z L L x x z x x z x z x x L : 0 또는 z 가될수있는 unknown H : 1 또는 z 가될수있는 unknown 8

9 논리게이트인스턴스의배열 q 게이트인스턴스의배열 v 인스턴스이름뒤에배열의범위를지정하여반복회수를표현 nand #2 t_nand[0:7](... ); nand #2 x_nand[0:3](... ), y_nand[4:7](... ); module driver(in, out, en); input [3:0] in; input en; output [3:0] out; bufif0 ar[3:0](out, in, en); module // 3 상태버퍼의배열 코드 3.2 module driver_eq(in, out, en); // 코드 3.2와등가 input [3:0] in; input en; output [3:0] out; bufif0 ar3(out[3], in[3], en); // 3상태버퍼의개별적인인스턴스 bufif0 ar2(out[2], in[2], en); bufif0 ar1(out[1], in[1], en); bufif0 ar0(out[0], in[0], en); module 코드 3.3 9

10 게이트지연과 net 지연 q 게이트지연 v 게이트의입력에서부터출력까지의신호전달지연 (propagation delay) v 상승지연, 하강지연, 턴-오프 (turn-off) 지연 v defualt 값은 0 q net 지연 v net를구동하는 driver의값이변하는시점부터 net의값이갱신되는시점까지소요되는시간 v 상승지연, 하강지연, 턴-오프 (turn-off) 지연 v defualt 값은 0 q 관성지연 (inertial delay) v 지정된지연값보다입력신호의변화폭이작은경우에는입력신호가출력에영향을미치지않음 v Verilog HDL의 default 지연 10

11 게이트지연과 net 지연 From value: To value: 2 개의지연값 (d1, d2) 이사용된경우 3 개의지연값 (d1, d2, d3) 이사용된경우 0 1 d1 d1 0 x min(d1, d2) min(d1, d2, d3) 0 z min(d1, d2) d3 1 0 d2 d2 1 x min(d1, d2) min(d1, d2, d3) 1 z min(d1, d2) d3 x 0 d2 d2 x 1 d1 d1 x z min(d1, d2) d3 z 0 d2 d2 z 1 d1 d1 z x min(d1, d2) min(d1, d2, d3) 11

12 게이트지연과 net 지연 and #(10) a1(out, in1, in2); // only one delay and #(10,12) a2(out, in1, in2); // rise and fall delays bufif0 #(10,12,11) b3(out, in, ctrl); // rise, fall, turn-off delays module tri_latch(qout, qbout, clock, data, enable); output qout, qbout; 3 상태출력을갖는래치 input clock, data, enable; tri qout, qbout; not #5 n1(ndata, data); nand #(3,5) n2(wa, data, clock), n3(wb, ndata, clock); nand #(12,15) n4(q, qb, wa), n5(qb, q, wb); bufif1 #(3,7,13) q_drive(qout, q, enable), qb_drive(qbout, qb, enable); module data ndata wb qb qbout clock enable wa q qout 12

13 게이트지연과 net 지연 module inertial_delay_gate(); reg a, b; and #30(out, a, b); initial begin a = 1'b0; b = 1'b0; #50 a = 1'b1; b = 1'b1; #50 a = 1'b0; b = 1'b0; #50 a = 1'b1; b = 1'b1; #20 b = 1'b0; #50; module 게이트지연에서의관성지연 코드

14 디지털시스템설계및실습 4. 할당문 14

15 할당문 q 할당문 v 연속할당문 : net 형객체에값을할당 Ø assign 문 continuous_assign ::= assign [driving_strength] [delay] net_assignments; v 절차형할당문 : variable 형객체에값을할당 Ø always 블록, initial 블록, task, function 내부의할당문 Ø blocking 할당문 : 할당기호 = 을사용 Ø nonblocking 할당문 : 할당기호 <= 을사용 v 절차형연속할당문 (Procedural Continuous Assignment; PCA) Ø assign - deassign 문, force - release 문 15

16 할당문 할당문좌변의형태 할당문형태 연속할당 절차형할당 좌변 (Left-hand Side; LHS) Net (vector or scalar) Constant bit select of a vector net Constant part select of a vector net Constant indexed part select of a vector net Concatenation of any of the above four LHS Variables (vector or scalar) Bit-select of a vector reg, integer, or time variable Constant part select of a vector reg, integer, or time variable Memory word Indexed part select of vector reg, integer, or time variable Concatenation of regs; bit or part selects of regs 16

17 연속할당문 v assign 문을이용하여 net 형객체에값을할당 q v 우변의값에변화 (event) 가발생했을때좌변의객체에값의할당이일어남 v 단순한논리표현을이용한조합논리회로모델링에이용 함축적 (implicit) 연속할당문 v net 선언문에연속할당문을포함시킨경우 wire mynet = enable & data; 함축적연속할당문 wire mynet; assign mynet = enable & data; 함축적연속할당문과등가 assign na = ~(in1 & in2); assign out = (sel==1)? d1 : d0; assign carry = (cnt10==4 h9); assign sum = a + b; // 2 input NAND // 2-to-1 MUX // 덧셈회로 module adder (sum_out, carry_out, carry_in, ina, inb); output [3:0] sum_out; output carry_out; 연속할당문을이용한 4비트가산기 input [3:0] ina, inb; input carry_in; assign {carry_out, sum_out} = ina + inb + carry_in; module 코드

18 할당지연과 net 지연 q 연속할당문의지연값지정 v assign 뒤에지연연산자 (#) 를사용하여지정 v 우변피연산자값의변화가좌변에할당되기까지의시간간격지정 assign #10 wirea = a & b; wire #10 wirea = a & b; // 함축적연속할당문의지연 q net 지연 - net 선언문에서지연값을지정 Ø 지정된 net 지연이경과한후에할당이이루어짐 Ø 해당 net를구동하는모든구동자 ( 게이트프리미티브, 연속할당문 ) ) 등 ) 에영향을미침 wire #10 wirea; q 관성지연 (inertial delay) v Verilog HDL의 default 지연 v 지정된지연값보다입력신호의변화폭이작은경우, 입력신호의변화가출력에영향을미치지않음 v 관성지연은게이트수준모델링에도동일하게적용 18

19 할당지연과 net 지연 module inertial_delay(); reg a, b; assign #30 wirea = a & b; initial begin a = 1'b0; b = 1'b0; #50 a = 1'b1; b = 1'b1; #50 a = 1'b0; b = 1'b0; #50 a = 1'b1; b = 1'b1; #20 b = 1'b0; #50; module 연속할당문에서의관성지연 코드

20 절차형할당문 q 절차형할당문 v reg, integer, real, time, realtime 등 variable에값을갱신 v 지연을갖지않으며, 다음절차형할당문에의해값이갱신될때까지변수에할당된값을유지 v always, initial, task, function 등의프로시저 (procedure) 내부에서사용 v 문장의실행에의해좌변 variable에값이할당되는소프트웨어적인특성 Ø 우변수식의 event 발생과는무관 Ø 할당문들의순서가시뮬레이션결과에영향을미칠수있음 q 함축적변수할당문 v variable 선언문에서 variable에대한초기값을설정 v 배열에대한함축적변수할당은허용되지않음 20

21 절차형할당문 module proc_assignment(a, b, c, out); input a, b; output out; reg out, c; 절차형할당문 c) begin c = a & b; // blocking assignment out <= c; // nonblocking assignment module 코드 4.4 reg[3:0] areg = 4'h4; reg[3:0] areg; 함축적변수할당문과등가 initial areg = 4'h4; reg [3:0] array [3:0] = 0; //illegal ( 배열에대한함축적변수할당문 ) 21

22 디지털시스템설계및실습 5. 행위수준모델링 22

23 always 구문 q 행위수준모델링 v 조합논리회로와순차논리회로의설계, 설계된회로의시뮬레이션을위한 테스트벤치의작성에사용 v always 구문, initial 구문, task, function 내부에사용 q always 구문 always [@(sensitivity_list)] begin blocking_or_nonblocking statements; 는 always 문의실행을제어 Ø sensitivity_list ( 감지신호목록 ) 에나열된신호들중하나이상에변화 (event) 가 발생했을때 always 내부에있는 begin- 블록의실행이트리거됨 Ø begin- 블록은절차형문장들로구성 Ø blocking 할당문또는 nonblocking 할당문에따라실행방식이달라짐 Ø 시뮬레이션이진행되는동안무한히반복실행됨 23

24 always 구문 module sample(a, b, out); input a, b; output out; reg out; always 구문을이용한조합회로모델링 2 입력 OR 게이트 or b) begin if(a==1 b==1) out = 1; // blocking 할당문 else out = 0; // blocking 할당문 module 코드 5.1 module dff(clk, din, qout); input clk, din; output qout; reg qout; always 구문을이용한순차회로모델링 D 플립플롭 clk) qout <= din; module // Non-blocking 할당문 코드

25 always 구문 q always 구문의 sensitivity_list ( 감지신호목록 ) v 조합회로모델링 Ø always 구문으로모델링되는회로의입력신호가모두나열되어야함 Ø 일부신호가감지신호목록에서빠지면, 합성이전의 RTL 시뮬레이션결과와 합성후의시뮬레이션결과가다를수있음 Ø 함축적감지신호표현 (@*) 을사용가능 v 순차회로모델링 Ø 동기식셋 / 리셋을갖는경우 : 클록신호만포함 Ø 비동기식셋 / 리셋을갖는경우 : 클록신호, 셋, 리셋신호를포함 // equivalent or b or c or d or f) y =(a & b) (c & d) f; 25

26 always 구문 module mux21_bad(a, b, sel, out); input [1:0] a, b; input sel; output [1:0] out; reg [1:0] out; or b) // sel is omitted if(sel ==0) out = a; else out = b; module 감지신호목록에 sel 이빠진경우 코드

27 always 구문 q always 구문이테스트벤치에사용되는경우 v 시뮬레이션시간의진행에관련된제어가포함되어야함 v 그렇지않으면 zero-delay 무한루프 (infinite loop) 가발생되어교착상태 (deadlock) 에빠지게되어시뮬레이션이진행되지않음 always clk = ~clk; // zero-delay infinite loop always #20 clk = ~clk; // 주기가 40ns 인신호 clk 를생성 27

28 initial 구문 q initial 구문 initial begin blocking_or_nonblocking statements; v 시뮬레이션이실행되는동안한번만실행 v 절차형문장들로구성되며, 문장이나열된순서대로실행 v 논리합성이지원되지않으므로시뮬레이션을위한테스트벤치에사용 initial begin areg = 0; // initialize areg for(index = 0; index < size; index = index + 1) memory[index] = 0; //initialize memory word initial begin din = 6'b000000; // initialize at time zero #10 din = 6'b011001; // first pattern #10 din = 6'b011011; // second pattern #10 din = 6'b011000; // third pattern #10 din = 6'b001000; // last pattern 시뮬레이션입력벡터생성 28

29 initial 구문 module behave; reg a, b; 주기신호의생성 initial begin // 초기값지정 a = 1'b1; b = 1'b0; always #50 a = ~a; always #100 b = ~b; module 29

30 절차형할당문 q 절차형할당문 v reg, integer, time, real, realtime 자료형과메모리변수에값을갱신 v 문장이나열된순서대로실행 (execute) 되어할당문좌변의변수값을갱신하는소프트웨어적특성 Ø 연속할당 : 피연산자값에변화 (event) 가발생할때마다우변의식이평가되고, 그결과값이좌변의 net를구동 (drive) 하는하드웨어적특성 v Blocking 할당문 Ø 할당기호 = 을사용 v Nonblocking 할당문 Ø 할당기호 <= 을사용 30

31 절차형할당문 q Blocking 할당문 - 현재할당문의실행이완료된이후에그다음의할당문이실행되는순차적흐름을가짐 reg_lvalue = [delay_or_event_operator] expression; initial begin rega = 0; regb[3] = 1; regc[3:5] = 7; {carry, acc} = rega + regb; // reg형변수에대한할당 // 단일비트에대한할당 // 부분비트에대한할당 // 결합에대한할당 q Nonblocking 할당문 reg_lvalue <= [delay_or_event_operator] expression; v 나열된할당문들이순차적흐름에대한 blocking 없이정해진할당스케줄 (assignment scheduling) 에의해값이할당 v 할당문들은우변이동시에평가된후, 문장의나열순서또는지정된지연값에따른할당스케줄에의해좌변의객체에값이갱신 31

32 절차형할당문 module non_blk1; output out; reg a, b, clk; initial begin a = 0; b = 1; clk = 0; always clk = #5 ~clk; clk) begin a <= b; b <= a; module 코드 5.5-(a) module blk1; output out; reg a, b, clk; initial begin a = 0; b = 1; clk = 0; always clk = #5 ~clk; clk) begin a = b; // a=1 b = a; // b=a=1 module 코드 5.5-(b) 32

33 Nonblocking 할당문 Nonblocking 할당문의시뮬레이션결과 Blocking 할당문의시뮬레이션결과 33

34 절차형할당문 module non_block2; reg a, b, c, d, e, f; // blocking assignments // with intra-assignment delay initial begin a = #10 1; // assigned 1, time 10 b = #2 0; // assigned 0, time 12 c = #4 1; // assigned 1, time 16 // non-blocking assignments // with intra-assignment delay initial begin d <= #10 1; // assigned 1, time 10 e <= #2 0; // assigned 0, time 2 f <= #4 1; // assigned 1, time 4 module module non_block3; reg a, b, c, d, e, f; // blocking assignments with delay initial begin #10 a = 1; // assigned 1, time 10 #2 b = 0; // assigned 0, time 12 #4 c = 1; // assigned 1, time 16 // non-blocking assignments with delay initial begin #10 d <= 1; // assigned 1, time 10 #2 e <= 0; // assigned 0, time 12 #4 f <= 1; // assigned 1, time 16 module 34

35 Nonblocking 할당문 non_block2 의시뮬레이션결과 non_block3 의시뮬레이션결과 35

36 Nonblocking 할당문 Nonblocking 할당문의내부지연 module multiple2; reg a; 코드 5.7 initial a = 1; initial begin a <= #4 1; // schedules a = 1 at time 4 a <= #4 0; // schedules a = 0 at time 4 #20 $stop; // At time 4, a = 0 module 36

37 if 조건문 if(expression) statement_true; [else statement_false;] v 조건식이참 (0 이아닌알려진값 ) 이면, statement_true 부분실행 v 조건식이거짓 (0, x, z) 이면, statement_false 부분실행 v else 부분이없으면, 변수는이전에할당받은값을유지 (latch 동작 ) v if 문의내포 (nested) ( 즉, if 문내부에또다른 if 문이있는경우 ) Ø if 문내부에하나이상의 else 문장이생략되는경우, 내부의 else 문은이전의 가장가까운 if 와결합됨 if(index Ø 들여쓰기 > 0) 또는 begin 로// 명확하게 IF-1 표현 if(rega > regb) // IF-2 result = rega; else // else of the IF-2 result = regb; if(index > 0) begin if(rega > regb) result = rega; else result = regb; // IF-1 // IF-2 // else of the IF-1 37

38 if 조건문 module mux21_if(a, b, sel, out); input [1:0] a, b; input sel; output [1:0] out; reg [1:0] out; or b or sel) if(sel == 1'b0) // 또는 if(!sel) out = a; else out = b; module if 조건문을이용한 2:1 멀티플렉서 코드

39 if 조건문 module dff_sr_async(clk, d, rb, sb, q, qb); input clk, d, rb, sb; output q, qb; reg q; clk or negedge rb or negedge sb) begin if(rb==0) q <= 0; else if(sb==0) q <= 1; else q <= d; assign qb = ~q; module 비동기 set/reset 을갖는 D 플립플롭 코드

40 case 문 case(expression) case_item {, case_item} : statement_or_null; default [:] statement_or_null; case v case 조건식의값과일치하는 case_item 의문장이실행 Ø 각비트가 0, 1, x, z 를포함하여정확히같은경우에만일치로판단 Ø case 문의조건식과모든 case_item 의비트크기는큰쪽에맞추어져야함 v 모든 case_item 들에대한비교에서일치되는항이없는경우에는 default 항이실행 v default 항이없으면변수는이전에할당받은값을유지 v 하나의 case 문에서여러개의 default 를사용하는것은허용되지않음 40

41 case 문 case 문을이용한 2:1 멀티플렉서 module mux21_case(a, b, sel, out); input [1:0] a, b; case문을이용한디코더 input sel; reg [15:0] rega; output [1:0] out; reg [9:0] result; reg [1:0] out; or b or sel) begin case(sel) 0 : out = a; 1 : out = b; case module begin case(rega) 16'd0: result = 10'b ; 16'd1: result = 10'b ; 16'd2: result = 10'b ; 16'd3: result = 10'b ; 16'd4: result = 10'b ; 16'd5: result = 10'b ; 16'd6: result = 10'b ; 16'd7: result = 10'b ; 16'd8: result = 10'b ; 16'd9: result = 10'b ; default: result = 10'bx; case 41

42 case 문 q don't care 를갖는 case 문 v casez 문 : z 를 don t - care 로취급하여해당비트를비교에서제외 Ø don't care 조건으로? 기호사용가능 v casex 문 : x 와 z 를 don t - care 로취급하여해당비트를비교에서제외 reg [7:0] ir; casez(ir) 8'b1???????: instruction1(ir); 8'b01??????: instruction2(ir); 8'b00010???: instruction3(ir); 8'b000001??: instruction4(ir); case 42

43 case 문 casex 문을이용한 3 비트우선순위인코더 (priority encoder) module pri_enc_casex(encode, enc); input [3:0] encode; output [1:0] enc; reg [1:0] enc; begin casex(encode) 4'b1xxx : enc = 2'b11; 4'b01xx : enc = 2'b10; 4'b001x : enc = 2'b01; 4'b0001 : enc = 2'b00; case module 코드

44 case 문 case 조건식에상수값을사용한 3 비트우선순위인코더 module pri_enc_case(encode, enc); input [3:0] encode; output [1:0] enc; reg [1:0] enc; 코드 5.13 begin case(1) encode[3]: enc = 2'b11; encode[2]: enc = 2'b10; encode의해당비트가 1이될때 encode[1]: enc = 2'b01; encode[0]: enc = 2'b00; default : $display("error: One of the bits expected ON"); case module 44

45 반복문 forever statement; repeat(expression) statement; while(expression) statement; for(variable_assign); expression; variable_assign) statement; v forever 문 : 문장이무한히반복적으로실행 v repeat 문 : 지정된횟수만큼문장이반복실행 Ø 반복횟수를나타내는수식이 x 또는 z 로평가되면반복횟수는 0 이되고, 문장은실행되지않음 v while 문 : 조건식의값이거짓이될때까지문장이반복실행 Ø 조건식의초기값이거짓이면문장은실행되지않음 v for 문 : 반복횟수를제어하는변수에의해문장이반복실행 45

46 반복문 repeat 문을이용한 shift-add 방식의승산기 module multiplier_8b(opa, opb, result); parameter SIZE = 8, LongSize = 2*SIZE; input [SIZE-1:0] opa, opb; output [LongSize-1:0] result; reg [LongSize-1:0] result, shift_opa, shift_opb; or opb) begin shift_opa = opa; // multiplicand shift_opb = opb; // multiplier result = 0; repeat(size) begin if(shift_opb[0]) result = result + shift_opa; shift_opa = shift_opa << 1; shift_opb = shift_opb >> 1; module 코드

47 반복문 8 비트입력 rega 에포함된 1 을계수하는회로 module cnt_one(rega, count); input [7:0] rega; output [3:0] count; reg [7:0] temp_reg; reg [3:0] count; begin count = 0; temp_reg = rega; while(temp_reg) begin if(temp_reg[0]) count = count + 1; temp_reg = temp_reg >> 1; module 코드

48 반복문 for 문을이용한 8 비트우선순위인코더 (priority encoder) 코드 5.16 module enc_for(in, out); input [7:0] in; output [2:0] out; reg [2:0] out; integer i; begin : LOOP out=0; for(i = 7; i >= 0; i = i-1) begin if(in[i]) begin out=i; disable LOOP; module 입력 in[7:0] 출력 out[2:0] 0000_ _ _ _ _ _ _ _

49 반복문 module tb_dff ; reg clk, d; forever 문을이용한주기신호생성 dff U1 (clk, d, q); initial begin clk = 1'b0; forever #10 clk = ~clk; initial begin d = 1'b0; forever begin #15 d = 1'b1; #20 d = 1'b0; #30 d = 1'b1; #20 d = 1'b0; module 49

50 절차형할당의타이밍제어 q 절차형할당의실행제어 v 지연제어 : Ø delay operator : # Ø 특정절차형할당문의실행순서가된시점과그문장이실제실행되는시점 사이의시간간격을지정 ( 문장의실행을지연시킴 ) Ø 지연값이 x 또는 z 인경우에는지연이 0 으로처리 Ø 음수지연값이지정된경우에는 2 의보수 unsigned 정수로해석 #10 rega = regb; #d rega = regb; // d is defined as a parameter #((d+e)/2) rega = regb; // delay is average of d and e v event 제어 Ø event operator Ø 시뮬레이션 event 가발생될때까지문장의실행을지연시킴 Ø net 나변수의값변화가순차문의실행을트리거하기위한 event 로사용가능 50

51 절차형할당의타이밍제어 v 에지천이검출 Ø negedge:1에서 0, x, z로변화, 또는 x, z에서 0으로변화에서 event 발생 Ø posedge:0에서 x, z, 1로변화, 또는 x, z에서 1로변화에서 event 발생 Ø event 발생수식의결과가 1비트이상인경우에는, 에지천이는결과의 LSB에서검출 posedge 와 negedge event 의발생 From To 0 1 x z 0 No edge posedge posedge posedge 1 negedge No edge negedge negedge x negedge posedge No edge No edge z negedge posedge No edge No edge 51

52 절차형할당의타이밍제어 상승에지로동작하는 D 플립플롭 module dff(clk, d, q); input clk, d; output q; reg q; clk) q <= d; module 코드

53 절차형할당의타이밍제어 q event or 연산자 v 다수의 event 들은키워드 or 또는콤마 (,) 로결합 clk_a or posedge clk_b or trig) rega = regb; clk_a, posedge clk_b, trig) rega = regb; q wait 문 v 조건을평가하여참이면 wait 문에속하는절차형할당문이실행되며, 조건이거짓이면절차형할당문의실행이중지 wait(expression) statement_or_null; begin wait(!enable) #10 a = b; #10 c = d; 53

54 절차형할당의타이밍제어 q intra-assignment 타이밍제어 v 지연과 event 제어가순차할당문안에포함 v 우변의수식에대한평가를먼저실행한후, 좌변의객체에새로운값이할당되는시점을지정된지연만큼지연시킴 a <= clk) data; 54

55 절차형할당의타이밍제어 intra-assignment event 제어 module intra_delay1(clk, d, out); input clk, d; output out; reg out; out = clk) d; module module intra_delay1_eq(clk, d, out); input clk, d; output out; reg out,temp; begin temp = clk) out = temp; module 등가코드 코드 5.19 코드

56 절차형할당의타이밍제어 코드 5.19 의시뮬레이션결과 56

57 절차형할당의타이밍제어 Equivalent model of Intra-assignment timing control With intra-assignment construct a = #5 b; a clk) b; a = clk) b; Without intra-assignment construct begin temp = b; #5 a = temp; begin temp = clk) a = temp; begin temp = clk) a = temp; 57

58 블록문 q 블록문 v 두개이상의문장을그룹으로묶어구문적으로하나의문장처럼처리 v begin- 절차형할당문블록 Ø 문장이나열된순서에의해순차적으로실행 Ø 시작시간 : 첫번째문장이실행될때 Ø 종료시간 : 마지막문장이실행될때 Ø 각절차형할당문의실행은이전문장의지연시간에대해상대적으로결정됨 v fork-join 병렬문블록 Ø 문장의나열순서에무관하게동시에실행 Ø 시작시간 : 블록내의모든문장의시작시간이동일 Ø 종료시간 : 각문장의지연이고려되어시간적으로마지막에실행되는문장의실행이완료된시점 Ø 각문장의지연은블록에들어가는시뮬레이션시간을기준으로결정됨 Ø 시뮬레이션파형생성에유용함 58

59 블록문 parameter d = 50; reg [7:0] r; begin // a waveform controlled by sequential delay #d r = 8'h35; #d r = 8'hE2; #d r = 8'h00; #d r = 8'hF7; #d -> _wave; //trigger an event called _wave fork join #50 r = 8'h35; #100 r = 8'hE2; #150 r = 8'h00; #200 r = 8'hF7; #250 -> _wave; 등가코드 fork join #250 -> _wave; #200 r = 8'hF7; #150 r = 8'h00; #100 r = 8'hE2; #50 r = 8'h35; 59

60 디지털시스템설계및실습 6. 구조적모델링 60

61 모듈 (module) Verilog 모듈의구성 module module_name (port_list); port 선언 reg 선언 wire 선언 parameter 선언 머리부 선언부 하위모듈인스턴스게이트프리미티브 always 문, initial 문 assign 문 function, task 정의 function, task 호출 몸체 module 61

62 모듈포트선언 v 포트목록에나열된포트들은선언부에서포트선언을통해 input, output, inout( 양방향 ) 으로선언 v signed와범위에대한정의를포함한포트에관한모든다른속성들이포트선언에포함될수있음 inout_declaration ::= inout [ net_type ][ signed ][ range ] list_of_port_identifiers input_declaration ::= input [ net_type ][ signed ][ range ] list_of_port_identifiers output_declaration ::= output [ net_type ][ signed ][ range ] ist_of_port_identifiers output [ reg ][ signed ][ range ] list_of_port_identifiers output reg [ signed ][ range ] list_of_variable_port_identifiers output [ output_variable_type ] list_of_port_identifiers output output_variable_type list_of_variable_port_identifiers list_of_port_identifiers ::= port_identifier {, port_identifier } 62

63 모듈포트선언 input aport; input aport; output aport; // First declaration - okay. // Error - multiple port declaration // Error - multiple port declaration module test(a, b, c, d, e, f, g, h); input [7:0] a, b; // no explicit declaration - net is unsigned input signed [7:0] c, d; // no explicit net declaration - net is signed output [7:0] e, f; // no explicit declaration - net is unsigned output signed [7:0] g, h; // no explicit net declaration - net is signed wire signed [7:0] b; // port b inherits signed attribute from net decl. wire [7:0] c; // net c inherits signed attribute from port reg signed [7:0] f; // port f inherits signed attribute from reg decl. reg [7:0] g; // reg g inherits signed attribute from port module complex_ports({c,d},.e(f)); // Nets {c,d} receive the first port bits. // Name 'f' is declared inside the module. // Name 'e' is defined outside the module. // Can't use named port connections of first port. 63

64 모듈포트선언 module split_ports(a[7:4], a[3:0]); // First port is upper 4 bits of 'a'. // Second port is lower 4 bits of 'a'. // Can't use named port connections because of part-select port 'a'. module same_port(.a(i),.b(i)); // Name 'i' is declared inside the module as a inout port. // Names 'a' and 'b' are defined for port connections. module renamed_concat(.a({b,c}), f,.g(h[1])); // Names 'b', 'c', 'f', 'h' are defined inside the module. // Names 'a', 'f', 'g' are defined for port connections. // Can use named port connections. module same_input(a, a); input a; // This is legal. The inputs are ored together. 64

65 포트선언목록 v 포트선언목록에서포트를선언 v 포트선언목록으로선언된포트들은모듈의선언부에서재선언되지않음 module test( input [7:0] a, input signed [7:0] b, c, d, output [7:0] e, output signed reg [7:0] f, g, output signed [7:0] h ) ; // illegal to redeclare any ports of the module in the body of the module. 65

66 모듈인스턴스 q 구조적모델링 v 다른모듈의인스턴스와포트매핑을통한모델링 v 범위지정을통한인스턴스배열의생성가능 v 모듈인스턴스이름은생략할수없음 Ø 게이트프리미티브의인스턴스이름은생략가능 q 포트순서에의한포트매핑 v 모듈의포트목록에나열된포트순서와 1:1로대응되어연결 v 포트에연결되는신호가없는경우에는해당위치를빈칸으로남겨둔다 q 포트이름에의한포트매핑 v 포트이름과그포트에연결되는신호이름을명시적으로지정 v 포트의비트선택, 부분선택, 결합등을사용할수없음.port_name([expression]) 66

67 모듈인스턴스 module topmod; wire [4:0] v; wire c, w; 순서에의한포트매핑 modb b1(v[0], v[3], w, v[4]); module 코드 6.3 module modb(wa, wb, c, d); inout wa, wb; input c, d; tranif1 g1(wa, wb, cinvert); not #(2, 6) n1(cinvert, int); and #(6, 5) g2(int, c, d); module module topmod; wire [4:0] v; wire a,b,c,w; 이름에의한포트매핑 modb b1(.wb(v[3]),.wa(v[0]),.d(v[4]),.c(w)); module 코드

68 모듈인스턴스 인스턴스배열을이용한구조적모델링 module bus_driver(busin, bushigh, buslow, enh, enl); input [15:0] busin; input enh, enl; output [7:0] bushigh, buslow; driver busar3(busin[15:12], bushigh[7:4], enh); driver busar2(busin[11:8], bushigh[3:0], enh); driver busar1(busin[7:4], buslow[7:4], enl); driver busar0(busin[3:0], buslow[3:0], enl); module driver busar[3:0] (.in(busin),.out({bushigh, buslow}),.en({enh, enh, enl, enl}) ); module 코드 6.2-(a) 모듈인스턴스의배열을이용 코드 6.2-(b) 68

69 모듈인스턴스 1 비트전가산기의구조적모델링 a b cin Half Adder temp_sum Half Adder temp_c1 temp_c2 module half_adder(a, b, sum, cout); input a, b; output sum, cout; wire cout_bar; // 생략가능 (1-bit wire) sum cout 반가산기모듈 xor U0 (sum, a, b); nand (cout_bar, a, b); // 인스턴스이름생략가능 (gate primitive) not U1 (cout, cout_bar); module 코드 6.6-(a) 69

70 모듈인스턴스 module full_adder(a, b, cin, sum, cout); input a, b, cin; output sum, cout; wire temp_sum, temp_c1, temp_c2; // 생략가능 // half_adder 모듈의 instantiation half_adder u0(a, b, temp_sum, temp_c1); // 순서에의한포트연결 half_adder u1(.a(temp_sum),.b(cin),.sum(sum),.cout(temp_c2) ); // 이름에의한포트연결 or u2(cout, temp_c1, temp_c2); // 게이트프리미티브인스턴스 module 코드 6.6-(b) 70

71 모듈인스턴스 // 1 비트 full_adder 모듈의시뮬레이션 testbench module tb_full_adder ; reg a, b, cin; // initial 블록에서값을받으므로 reg 로선언 integer k; 코드 6.7 full_adder U0(a, b, cin, sum, cout); // 모듈인스턴스 initial begin // 시뮬레이션을위한파형생성 forever for(k = 0; k < 8; k = k+1) begin cin = k/4; b =(k%4)/2; a = k%2; #10; module 71

72 모듈인스턴스 q 실수형값의포트연결 v real 자료형은직접포트에연결될수없음 v 시스템함수인 $realtobit와 $bittoreal를통해 real 자료형을비트자료형으로변환한후모듈포트에적용 module driver(net_r); output net_r; real r; wire [64:1] net_r = $realtobits(r); module 코드 6.8 module receiver(net_r); input net_r; wire [64:1] net_r; real r; initial assign r = $bitstoreal(net_r); module 코드

73 모듈 parameter q 모듈 parameter v variable 또는 net 범주에속하지않는상수 v 모듈이인스턴스될때값을변경시킬수있음 Ø 구조적설계에서모듈인스턴스의개별화 (customize) 를위한유용한수단 Ø localparam 으로선언된 parameter 는그값을변경할수없음 q 모듈 parameter 값의변경 v defparam 문을이용하는방법 v 모듈인스턴스를통해 parameter 값을변경하는방법 v 위의두가지방법에의한 parameter 값변경이충돌되는경우, defparam 문에의해설정된값이사용됨 73

74 모듈 parameter 모듈 parameter 값의변경 module foo(a, b); real r1, r2; parameter [2:0] A = 3'h2; // 자료형과범위가지정된 parameter 선언 parameter B = 3'h2; // 자료형과범위가지정되지않은 parameter 선언 initial begin r1 = A; r2 = B; $display("r1 is %f, r2 is %f",r1,r2); module 코드 6.10-(a) module bar; // parameter overriding using defparam wire a, b; defparam U0.A = ; // A는 3으로변경됨 defparam U0.B = ; // B는 로변경됨 foo U0(a, b); module // module instantiation 코드 6.10-(b) 74

75 모듈 parameter q defparam 문 v parameter의계층적이름을사용하여전체설계에걸친모듈인스턴스의 parameter 값을변경 Ø 인스턴스배열의하부계층구조에있는 defparam 문은계층구조밖의 parameter 값을변경시킬수없음 v 모든 parameter 변경문들을함께묶어독립된모듈로정의할때유용 75

76 모듈 parameter defparam 문에의한 parameter 값의변경 module top; reg clk; reg [0:4] in1; reg [0:9] in2; wire [0:4] o1; wire [0:9] o2; vdff m1(o1, in1, clk); vdff m2(o2, in2, clk); module module vdff(out, in, clk); parameter size = 1, delay = 1; input [0:size-1] in; input clk; output [0:size-1] out; reg [0:size-1] out; clk) # delay out = in; module module annotate; defparam top.m1.size = 5, top.m1.delay = 10, top.m2.size = 10, top.m2.delay = 20; module 코드

77 모듈 parameter q 모듈인스턴스의 parameter 값변경 v 순서화된 parameter 목록에의한방법 (ordered_parameter_assignment) #(expression {, expression,} ) v parameter 이름에의한방법 (named_parameter_assignment) #(.parameter_name([expression])) v 단일모듈인스턴스문에서이들두가지방법을혼용하여사용할수없음 v 기호 # : delay operator 로도사용됨 77

78 모듈 parameter 모듈 parameter 값의변경 module dffn(q, d, clk); parameter BITS = 1; input [BITS-1:0] d; input clk; output [BITS-1:0] q; DFF dff_array [BITS-1:0] (q, d, clk); // instance array module module MxN_pipeline(in, out, clk); parameter M = 3, N = 4; // M=width,N=depth input [M-1:0] in; output [M-1:0] out; input clk; wire [M*(N-1):1] t; // #(M) 은모듈 dffn 의 Parameter BITS 값을재설정 dffn #(M) p [1:N] ({out, t}, {t, in}, clk); module 코드

79 모듈 parameter 모듈 parameter 값의변경 79

80 모듈 parameter module vdff(out, in, clk); parameter size = 5, delay = 1; input [0:size-1] in; input clk; output [0:size-1] out; reg [0:size-1] out; clk) # delay out = in; // # 은 delay operator 임 module module m; reg clk; wire [0:4] out_c, in_c; wire [1:10] out_a, in_a; wire [1:5] out_b, in_b; 코드 6.13-(a) vdff #(10,15) mod_a(out_a, in_a, clk); vdff mod_b(out_b, in_b, clk); // default parameter values vdff #(.delay(12)) mod_c(out_c, in_c, clk); module 코드 6.13-(b) 80

81 생성문 q 생성문 (Generate statement) v generate-generate 블록으로모델링 Ø 반복생성문 (generate-for) Ø 조건생성문 (generate-if) Ø case 생성문 (generate-case) v 모듈, 사용자정의프리미티브 (UDP), 게이트프리미티브, 연속할당문, initial 블록과 always 블록등의인스턴스를하나또는다수개생성 v net, reg, integer, real, time, realtime, event 등의자료형선언가능 v 생성된인스턴스와자료형은고유의식별자를가지며계층적으로참조가능 v 순서또는이름에의한 parameter 값의변경또는 defparam 문에의한 parameter 재정의가능 Ø defparam 문은생성범위내에서선언된 parameter 의값에만영향을미침 v 생성문에서 parameter, local parameter, input, output, inout, specify block 등의선언은허용되지않음 81

82 genvar 선언 q genvar 선언 v 생성문내에서만사용될수있는인덱스변수의선언에사용 v genvar로선언되는변수는정수형 Ø 선언된변수를인덱스로갖는반복생성문내에서만사용되는지역변수 Ø genvar의값은 parameter 값이참조될수있는어떤문장에서도참조가능 Ø 시뮬레이터또는논리합성툴의 elaboration 과정동안에만정의되며, 시뮬레이션또는합성이진행되는동안에는존재하지않음 v elaboration 과정 : 시뮬레이션이나합성을위해모듈을분석하는과정 Ø 구문의오류검출, 인스턴스된모듈의연결 (link), parameter 값의전달, 계층적인참조에대한분해등을수행하는과정 82

83 반복생성문 q 반복생성문 (generate-for 문 ) v generate-generate 구문내부에 for 문을사용하여특정모듈또는블록을반복적으로인스턴스 Ø variable 선언, 모듈, UDP, 게이트프리미티브, 연속할당문, initial 블록, always 블록등을인스턴스할수있음 v 생성문내부의 for-loop에서사용되는인덱스변수는 genvar로선언 v for 문의 begin 뒤에생성문블록식별자 (:identifier) 를붙여야함 83

84 반복생성문 gray-to-binary 변환기 10 진수 gray 이진부호 generate-for 문을이용한 gray-to-binary 변환기 module gray2bin1(bin, gray); parameter SIZE = 4; output [SIZE-1:0] bin; input [SIZE-1:0] gray; genvar i; generate for(i=0; i<size; i=i+1) begin : bit assign bin[i] = ^gray[size-1:i]; generate module 코드

85 반복생성문 generate-for 문을이용한 gray-to-binary 변환기 module gray2bin2(bin, gray); parameter SIZE = 4; output [SIZE-1:0] bin; input [SIZE-1:0] gray; reg [SIZE-1:0] bin; genvar i; generate for(i=0; i<size; i=i+1) begin :bit bin[i] = ^gray[size-1:i]; generate module 코드

86 반복생성문 생성루프외부에 2 차원 net 선언을갖는 ripple-carry 가산기 module adder_gen1(co, sum, a, b, ci); parameter SIZE = 4; output [SIZE-1:0] sum; output co; input [SIZE-1:0] a, b; input ci; wire [SIZE :0] c; wire [SIZE-1:0] t [1:3]; // 2차원 net 선언 genvar i; assign c[0] = ci; generate for(i=0; i<size; i=i+1) begin :bit xor g1( t[1][i], a[i], b[i]); xor g2( sum[i], t[1][i], c[i]); and g3( t[2][i], a[i], b[i]); and g4( t[3][i], t[1][i], c[i]); or g5( c[i+1], t[2][i], t[3][i]); generate assign co = c[size]; module 코드

87 반복생성문 생성루프내부에 2 차원 net 선언을갖는 ripple-carry 가산기 module adder_gen2(co, sum, a, b, ci); parameter SIZE = 4; output [SIZE-1:0] sum; output co; input [SIZE-1:0] a, b; input ci; wire [SIZE :0] c; genvar i; assign c[0] = ci; generate for(i=0; i<size; i=i+1) begin :bit wire t1, t2, t3; // generated net declaration xor g1( t1, a[i], b[i]); xor g2( sum[i], t1, c[i]); and g3( t2, a[i], b[i]); and g4( t3, t1, c[i]); or g5( c[i+1], t2, t3); generate assign co = c[size]; module 코드

88 반복생성문 code 6.16, code 6.17 의시뮬레이션결과 88

89 조건생성문 q 조건생성문 (generate-if 문 ) v generate-generate 블록내에 if-else-if의조건문을사용하여조건에따라특정모듈또는블록을선택적으로인스턴스 Ø 모듈, UDP, 게이트프리미티브, 연속할당문, initial 블록, always 블록등을인스턴스할수있음 v 인스턴스가선택되는조건은 elaboration 되는시점에서의값에의해결정 89

90 조건생성문 if 생성문을이용한파라미터화된곱셈기 module multiplier(a, b, product); parameter a_width = 8, b_width = 8; localparam product_width = a_width+b_width; // can not be modified directly with defparam or // module instance statement # input [a_width-1:0] a; input [b_width-1:0] b; output [product_width-1:0] product; generate if((a_width < 8) (b_width < 8)) CLA_mul #(a_width, b_width) u1(a, b, product); // instance a CLA multiplier else WALLACE_mul #(a_width, b_width) u1(a, b, product); // instance a Wallace-tree multiplier generate module 코드

91 case 생성문 q case 생성문 (generate-case 문 ) v generate-generate 블록내에 case 문을사용하여조건에따라특정모듈또는블록을선택적으로인스턴스 Ø 모듈, UDP, 게이트프리미티브, 연속할당문, initial 블록, always 블록등을인스턴스할수있음 v 인스턴스가선택되는조건은 elaboration 되는시점에서의값에의해결정 3 이하의비트폭을처리하기위한 case 생성문 generate case(width) 1: adder_1bit x1(co, sum, a, b, ci); // 1-bit adder 2: adder_2bit x1(co, sum, a, b, ci); // 2-bit adder default: adder_cla #(WIDTH) x1(co, sum, a, b, ci); // carry look-ahead adder case generate 코드

92 Verilog HDL 을이용한디지털시스템설계및실습 7. task 와함수 92

93 Task 와함수 q Task 와함수 q 장점 q 종류 v 반복되는행위수준모델링부분을독립된코드의 task나함수 (function) 로정의하고, 이들을호출하여사용 v 규모가큰행위수준모델링을작은부분들로분할하여 task 또는함수로표현함 v 소스코드의가독성 (readability) 과디버깅을용이하게함 v 사용자정의 task, 함수 v 시스템 task, 함수 93

94 Task 와함수 Function 적어도 1 개이상의 input 인수가필요 output, inout 인수를가질수없음 항상 1 개의결과값을 return 함 함수명을통해값을 return zero delay 를갖는조합회로구현 다른 function 호출가능 (task 는불가 ) zero simulation delay delay, event, timing control 문포함불가 Task 0 개이상의 input, output, inout 인수포함 값을 return 하지않을수있음 output, inout 을통해다수개의값을 return delay, timing, event 를갖고, multiple output 을반환하는 source code 에적용가능 task 의 I/O 에정의되지않은 module 내 reg 로선언된변수 access 가능 다른 task 나 function 호출가능 non-zero simulation time 수행가능 delay, event, timing control 문포함가능 variable 자료형만가질수있으며, net 자료형은가질수없음 assign 문, 게이트프리미티브와모듈인스턴스는사용할수없음 initial 문과 always 문을포함할수없음 behavioral 문만포함가능함 94

95 Task 와함수 q function 과 task 의정의및호출 module test (..); function [n-1:0] func_name; // 함수정의 input ; // 인수순서중요. begin. func_name = ;. function... = func_name( ); // 함수호출 module module test (..); task task_name; // task 정의 input ; // 인수순서중요 output.; inout ;. begin.. task. task_name( ); // task 호출 module 95

96 Task q Task 의정의 task task_identifier(task_port_list); {block_item_declaration} statement; task task task_identifier; {task_item_declaration} statement; task // task 의입력, 출력인수를선언 q Task 의호출 task_enable ::= task_identifier [(expression {, expression} )]; v 인수의순서는 task 정의에서선언된인수목록의순서와일치되어야함 96

97 Task task my_task; input a, b; inout c; output d, e; begin... // task의기능을수행하는문장들 task c = foo1; d = foo2; e = foo3; // 결과값을 reg 변수에할당하는문장들 task my_task(input a, b, inout c, output d, e); begin... // task 의기능을수행하는문장들 선언부에서인수를선언 my_task(v, w, x, y, z); // 인수는순서대로매핑 task 호출문 97

98 Task task 를이용한 1 의개수계수 module bit_counter (data_word, bit_count); input [7:0] data_word; output [3:0] bit_count; reg [3:0] bit_count; count_ones(data_word, bit_count); // task 호출 코드 7.1 task count_ones; input [7:0] reg_a; // 인수가여러개인경우, 순서가중요함. output [3:0] count; reg [3:0] count; reg [7:0] temp_reg; begin count=0; temp_reg=reg_a; while (temp_reg) begin if (temp_reg[0]) count=count+ 1; temp_reg = temp_reg >> 1; task module 98

99 Task module traffic_lights; reg clock, red, amber, green; parameter on = 1, off = 0, red_tics = 350, amber_tics = 30, green_tics = 200; //initialize colors. initial red = off; initial amber = off; initial green = off; 코드 7.2 always begin // sequence to control the lights. red = on; // turn red light on and wait. light(red, red_tics); green = on; // turn green light on and wait. light(green, green_tics); amber = on; // turn amber light on and wait. light(amber, amber_tics); 99

100 Task // task to wait for 'tics' positive edge clocks before turning 'color' light off. task light; output color; input [31:0] tics; begin clock); task always begin color = off; // turn light off. // waveform for the clock. #100 clock = 0; #100 clock = 1; module 코드

101 함수 q 함수의정의 function [signed][range_type] function_identifier(function_port_list); {block_item_declaration} statement; function function [signed][range_type] function_identifier ; {function_item_declaration} statement; function v 함수결과값의속성및범위지정 : [signed][range_type] Ø 별도의지정이없으면, default 로 1 비트 reg 형이됨 v 함수가정의되면함수이름과동일한이름의변수가함수내부에선언됨 Ø 함수가정의되는영역에서함수이름과동일한이름의다른객체를선언하는것이허용되지않음 101

102 함수 q 함수의호출 ftn_call ::= hierarchical_ftn_identifier{attribute_inst}(expr {,expr}) q 함수의규칙 v 함수는적어도하나이상의입력인수를포함해야한다. v 함수는 output과 inout으로선언된어떠한인수도가질수없다. v 함수는시간제어문장을가질수없다. Ø 함수내부의어떠한구문도타이밍제어 또는 wait 등 ) 를포함할수없다. v 함수는 task를호출할수없다. v 함수는함수이름과동일한이름의내부변수에함수의결과값을할당하는문장을포함한다. v 함수는 nonblocking 할당을가질수없다. 102

103 함수 function [7:0] getbyte; 선언부에서인수를선언 input [15:0] address; begin // code to extract low-order byte from addressed word... getbyte = result_expression; function function [7:0] getbyte(input [15:0] address); begin // code to extract low-order byte from addressed word... getbyte = result_expression; function word = control? {getbyte(msbyte), getbyte(lsbyte)}:0; 함수호출 103

104 함수 module word_aligner (word_in, word_out); input [7:0] word_in; output [7:0] word_out; 코드 7.3 function [7:0] word_align; input [7:0] word; begin word_align = word; if (word_align!= 0) while (word_align[7] == 0) word_align=word_align << 1; function assign word_out = word_align (word_in); // 함수호출 module 104

105 함수 module tryfact; // define the function function automatic integer factorial; input [31:0] operand; integer i; if(operand >= 2) factorial = factorial(operand - 1) * operand; else factorial = 1; function 0 factorial=1 1 factorial=1 2 factorial=2 3 factorial=6 4 factorial=24 5 factorial=120 6 factorial=720 7 factorial=5040 // test the function integer result; integer n; initial begin for(n = 0; n <= 7; n = n+1) begin result = factorial(n); $display("%0d factorial=%0d", n, result); module 코드

106 디지털시스템설계및실습 8. 컴파일러지시어 106

107 컴파일러지시어 q 컴파일러지시어 (Compiler directive) v Verilog 소스코드의컴파일과정에영향을미치는명령어 v accent grave 문자 ( ` ) 로시작된위치에서부터다른컴파일러지시어에의해대체되거나또는컴파일이완료되기까지전체소스파일에영향을미침 Ø 단일인용부호 ( ) 와혼동하지않도록주의 Verilog 컴파일러지시어 `celldefine `default_nettype `define `else `elsif `celldefine `if `ifdef `ifndef `include `line `nounconnected_drive `resetall `timescale `unconnected_drive `undef 107

108 `define 과 `undefine q define v 문자치환을위한문자매크로생성에사용 Ø C 프로그래밍언어의 #define 과유사 v 문자매크로치환 Ø 자주사용되는문자또는상수를의미있는이름으로정의하고, 문자매크로치환을통해정의된값을사용 Ø 특정상수 ( 비트폭, 지연등 ) 가회로모델링전체에걸쳐반복적으로사용되는경우에, 문자매크로정의를사용하면소스코드의수정및관리가용이 Ø macro_name을이용하여소스코드에사용 v 인수를갖는문자매크로를정의할수있으며, 매크로사용의개별화가가능 define wait_state 3'b010 // No semicolon 108

109 `define 과 `undefine text_macro_definition ::= define text_macro_name macro_text text_macro_name ::= text_macro_identifier [ ( list_of_formal_arguments ) ] list_of_formal_arguments ::= formal_argument_identifier {, formal_argument_identifier } text_macro_identifier ::= simple_identifier 문자매크로정의 text_macro_usage ::= text_macro_identifier [ ( list_of_actual_arguments ) ] list_of_actual_arguments ::= actual_argument {, actual_argument } actual_argument ::= expression 문자매크로사용 109

110 `define 과 `undefine define wordsize 8 reg [1: wordsize] data; //define a nand with variable delay define var_nand(dly) nand #dly 인수를갖는문자매크로 var_nand(2) g121(q21, n10, n11); var_nand(5) g122(q22, n10, n11); q undefine v 이전에정의된문자매크로를해제 Ø 'define 으로정의되지않은문자매크로에대해 undef 를정의하면컴파일 시경고메시지가출력 undefine_compiler_directive ::= undef text_macro_identifier 110

111 `ifdef, `else, `elsif 등 q ifdef, 'else, 'elsif, 'if, 'ifndef v Verilog HDL 소스코드의일부를조건적으로컴파일하기위해사용 Ø 소스의어느곳에서든사용될수있음 Ø 모듈에대한여러가지 ( 행위적모델링, 구조적모델링, 스위치수준모델링등 ) 모델링중하나를선택하여컴파일하는경우 Ø 여러가지의타이밍정보나구조적정보 ( 비트폭등 ) 중하나를선택하여컴파일하는경우 Ø 시뮬레이션을위해여러가지입력벡터들중하나를선택하는경우 v ifdef Ø 매크로이름이정의되어있으면, ifdef 이후의소스코드가컴파일에포함 Ø 매크로이름이정의되어있지않고 else가있으면, else 이후의소스코드가컴파일에포함 v if Ø 조건적으로컴파일되는소스코드의경계를나타냄 111

112 `ifdef, `else, `elsif 등 v ifndef Ø 매크로이름이정의되어있지않으면, ifndef 이후의코드가컴파일에포함 Ø 매크로이름이정의되어있고 else 지시어가있으면, else 이후의코드가 컴파일에포함 module and_op(a, b, c); output a; input b, c; ifdef behavioral wire a = b & c; else and a1(a,b,c); if module 코드

113 `ifdef, `else, `elsif 등 module test(out); output out; define wow define nest_one define second_nest define nest_two ifdef wow initial $display( wow is defined ); ifdef nest_one initial $display( nest_one is defined ); ifdef nest_two initial $display( nest_two is defined ); else initial $display( nest_two is not defined ); if else initial $display( nest_one is not defined ); if else initial $display( wow is not defined ); ifdef second_nest initial $display( nest_two is defined ); else initial $display( nest_two is not defined ); if if module 코드

114 `include q include v 파일삽입컴파일러지시어 Ø 소스파일의내용전체를다른소스파일에포함시켜컴파일할때사용 Ø 자주사용되는정의나 task 등을별도의파일에만든후, 컴파일과정에서포함시킬때사용 Ø Verilog 소스코드내의어느곳에서든지정의될수있음 Ø 삽입되는파일은또다른 include 컴파일러지시어를포함할수있음 Ø 설계전체에대한구성관리를통합적으로처리할수있음 Ø Verilog 소스코드의효율적인구성및관리가능 include_compiler_directive ::= include filename include parts/count.v include fileb // including fileb 114

115 `timescale q timescale v 시간과지연값의측정단위와정밀도를지정 Ø 다른 timescale 지시어가나타나기전까지효력을유지 timescale_compiler_directive ::= timescale time_unit / time_precision 시간정밀도단위 Character string s ms us ns ps fs Unit of measurement seconds milliseconds microseconds nanoseconds picoseconds femtoseconds 115

116 `timescale timescale 1 ns / 1 ps timescale 10 us / 100 ns timescale 10 ns / 1 ns module test; reg set; parameter d = 1.55; //16ns 의지연으로변환 initial begin #d set = 0; //16ns 에서 set 에 0 이할당 #d set = 1; //32ns 에서 set 에 1 이할당 module 코드

117 `timescale Timescale directive (unit/precision) Delay specification Simulator time step delay value used in sim. Conversion 1 ns / ns #4 1 ns 4 ns 4 x 1 1 ns / 100 ps #4 100 ps 4.0 ns 4 x 1 10 ns / 100 ps #4 100 ps 40.0 ns 4 x ns / ns #4 1 ns 40 ns 4 x ns / ns #4 1 ns 400 ns 4 x ns / 100 ps # ps 46.3 ns round to ns / 1 ns # ns 46 ns round to ns / 10 ns # ns 50 ns round to

Microsoft PowerPoint - M02_VerilogHDL02.ppt [호환 모드]

Microsoft PowerPoint - M02_VerilogHDL02.ppt [호환 모드] Verilog HDL 을이용한디지털시스템설계및실습 5. 행위수준모델링 Ver1.0 (2008) 1 5.1.1 always 구문 행위수준모델링 조합논리회로와순차논리회로의설계, 설계된회로의시뮬레이션을위한 테스트벤치의작성에사용 always 구문, initial 구문, task, function 내부에사용 always 구문 always [@(sensitivity_list)]

More information

Microsoft PowerPoint - DSD02_verilog2a.pptx

Microsoft PowerPoint - DSD02_verilog2a.pptx 한국기술교육대학교 장영조 한국기술교육대학교전기전자통신공학부 2 1. 구조적모델링 1. 모듈인스턴스와포트사양 2. 프리미티브게이트 3. 게이트지연시간 4. 파라미터 5. 인스턴스배열 6. generate 블록 2. 데이터플로우모델링 1. 연속할당문 2. 할당지연 3. 동작적모델링 1. 절차형블록 2. 절차형할당문 3. if~else문 4. case 문 5. 반복문

More information

Microsoft PowerPoint - DSD02_verilog2b.pptx

Microsoft PowerPoint - DSD02_verilog2b.pptx 한국기술교육대학교 장영조 한국기술교육대학교전기전자통신공학부 2 1. 구조적모델링 1. 모듈인스턴스와포트사양 2. 프리미티브게이트 3. 게이트지연시간 4. 파라미터 5. 인스턴스배열 6. generate 블록 2. 데이터플로우모델링 1. 연속할당문 2. 할당지연 3. 동작적모델링 1. 절차형블록 2. 절차형할당문 3. if~else문 4. case 문 5. 반복문

More information

Microsoft PowerPoint - hw4.ppt [호환 모드]

Microsoft PowerPoint - hw4.ppt [호환 모드] 4.1 initial 과 always Chapter 4 Verilog의특징 보통의 programming언어와같은 procedural statement을제공 추상적인 behavioral model 기술에사용 순차적으로수행하는보통의 programming 언어와는다르게병렬적으로수행하는언어임 module Behavioral Model 논리설계 병렬수행 module

More information

Microsoft PowerPoint - M01_VerilogHDL01.ppt [호환 모드]

Microsoft PowerPoint - M01_VerilogHDL01.ppt [호환 모드] Verilog HDL 을이용한디지털시스템설계및실습 1. Verilog HDL 개요 Ver1.0 (2008)1 Verilog HDL 의역사 Verilog HDL 1983 년 Gateway Design Automation 사에서하드웨어기술언어인 HiLo 와 C 언어의특징을기반으로개발 1991 년 Cadence Design Systems 가 Open Verilog

More information

Microsoft PowerPoint - DSD03_verilog3b.pptx

Microsoft PowerPoint - DSD03_verilog3b.pptx 한국기술교육대학교 장영조 한국기술교육대학교전기전자통신공학부 2 . 조합회로설계 2. 순차회로설계 3. FSM 회로설계 4. ASM 을사용한설계 한국기술교육대학교전기전자통신공학부 3 input clk 유한상태머신 (Finite State Machine; FSM) 지정된수의상태로상태들간의천이에의해출력을생성하는회로 디지털시스템의제어회로구성에사용 Moore 머신 :

More information

歯Chap1-Chap2.PDF

歯Chap1-Chap2.PDF ASIC Chip Chip Chip Proto-Type Chip ASIC Design Flow(Front-End) ASIC VHDL Coding VHDL Simulation Schematic Entry Synthesis Test Vector Gen Test Vector Gen Pre-Simulation Pre-Simulation Timing Verify Timing

More information

Microsoft PowerPoint - DSD03_verilog3a.pptx

Microsoft PowerPoint - DSD03_verilog3a.pptx 한국기술교육대학교 장영조 한국기술교육대학교전기전자통신공학부 2 1. 조합회로설계 2. 순차회로설계 3. FSM 회로설계 4. ASM 을사용한설계 한국기술교육대학교전기전자통신공학부 3 조합논리회로의형태와설계에사용되는 Verilog 구문 조합논리회로의형태 조합논리회로설계에사용되는 Verilog 구문 논리합성이지원되지않는 Verilog 구문 논리게이트 Multiplexer

More information

Microsoft PowerPoint - verilog문법new.ppt

Microsoft PowerPoint - verilog문법new.ppt Verilog HDL Syntax HDL 이란? HDL(Hardware Description Language) VLSI 설계가복잡도증가및 time-to-market 감소 GLM 의 schematic 설계불가능 HDL 언어를이용한시스템및회로수준구현보편화 하드웨어기술언어논리회로의프로그래밍언어에의한표현네트리스트및프로그래밍언어적표현 다양한하드웨어설계방법지원 Structural

More information

wire [n-1:0] a, b, c, d, e, f, g, h; wire [n-1:0] x; // internal wires wire [n-1:0] tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; mux_2to1 mux001 (.x(tmp0),.a(a

wire [n-1:0] a, b, c, d, e, f, g, h; wire [n-1:0] x; // internal wires wire [n-1:0] tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; mux_2to1 mux001 (.x(tmp0),.a(a [2010 년디지털시스템설계및실험중간고사 1 답안지 ] 출제 : 채수익 Verilog 문법채점기준 ( 따로문제의채점기준에명시되어있지않아도적용되어있음 ) (a) output이 always 문에서사용된경우, reg로선언하지않은경우 (-1 pts) (b) reg, wire를혼동하여사용한경우 (-1 pts) (c) always @( ) 에서모든 input을 sensitivity

More information

Microsoft PowerPoint - Verilog_Summary.ppt

Microsoft PowerPoint - Verilog_Summary.ppt Verilog HDL Summury by 강석태 2006 년 3 월 1 Module module < 모듈이름 >(< 포트리스트 >) < 모듈내용 > endmodule C 언어의함수 (Function) 와같은개념. 대소문자구분. 예약어는소문자로만쓴다. 이름은영문자, 숫자, 언더바 (_) 만허용한다. 문장의끝은항상세미콜론 (;) 으로끝난다. end~ 로시작하는예약어에는

More information

Microsoft PowerPoint - hw8.ppt [호환 모드]

Microsoft PowerPoint - hw8.ppt [호환 모드] 8.1 데이터경로와제어장치 Chapter 8 데이터경로와제어장치 많은순차회로의설계는다음의두부분으로구성 datapath: data의이동및연산을위한장치 control unit에상태신호제공 control ol unit: datapath th 에서적절한순서로 data 이동및연산을수행할수있도록제어신호제공. 먼저, datapath를설계 다음에, control unit

More information

OCW_C언어 기초

OCW_C언어 기초 초보프로그래머를위한 C 언어기초 4 장 : 연산자 2012 년 이은주 학습목표 수식의개념과연산자및피연산자에대한학습 C 의알아보기 연산자의우선순위와결합방향에대하여알아보기 2 목차 연산자의기본개념 수식 연산자와피연산자 산술연산자 / 증감연산자 관계연산자 / 논리연산자 비트연산자 / 대입연산자연산자의우선순위와결합방향 조건연산자 / 형변환연산자 연산자의우선순위 연산자의결합방향

More information

슬라이드 1

슬라이드 1 보안회로설계 모델심설치 & Verilog testbench 기초문법 Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr 모델심설치 ModelSim ModelSim Made by Mentor HDL simulator VHDL, Verilog, System Verilog and optional SystemC HDL 에의해합성될회로의동작과정과결과예상

More information

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt 변수와상수 1 변수란무엇인가? 변수 : 정보 (data) 를저장하는컴퓨터내의특정위치 ( 임시저장공간 ) 메모리, register 메모리주소 101 번지 102 번지 변수의크기에따라 주로 byte 단위 메모리 2 기본적인변수형및변수의크기 변수의크기 해당컴퓨터에서는항상일정 컴퓨터마다다를수있음 short

More information

MAX+plus II Getting Started - 무작정따라하기

MAX+plus II Getting Started - 무작정따라하기 무작정 따라하기 2001 10 4 / Version 20-2 0 MAX+plus II Digital, Schematic Capture MAX+plus II, IC, CPLD FPGA (Logic) ALTERA PLD FLEX10K Series EPF10K10QC208-4 MAX+plus II Project, Schematic, Design Compilation,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Verilog: Finite State Machines CSED311 Lab03 Joonsung Kim, joonsung90@postech.ac.kr Finite State Machines Digital system design 시간에배운것과같습니다. Moore / Mealy machines Verilog 를이용해서어떻게구현할까? 2 Finite State

More information

Microsoft PowerPoint - DSD01_verilog1a.pptx

Microsoft PowerPoint - DSD01_verilog1a.pptx 한국기술교육대학교 장영조 한국기술교육대학교전기전자통신공학부 2 1. Verilog HDL 개요 2. Verilog 첫걸음 3. Verilog 어휘규칙 4. 모듈 5. 데이터형 6. 연산자 7. 인스턴스 8. 시스템태스크와함수 9. 컴파일러지시어 한국기술교육대학교전기전자통신공학부 3 Verilog HDL 1983 년 Gateway Design Automation

More information

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi

[ 마이크로프로세서 1] 2 주차 3 차시. 포인터와구조체 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Functi 2 주차 3 차시포인터와구조체 학습목표 1. C 언어에서가장어려운포인터와구조체를설명할수있다. 2. Call By Value 와 Call By Reference 를구분할수있다. 학습내용 1 : 함수 (Function) 1. 함수의개념 입력에대해적절한출력을발생시켜주는것 내가 ( 프로그래머 ) 작성한명령문을연산, 처리, 실행해주는부분 ( 모듈 ) 자체적으로실행되지않으며,

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

비트와바이트 비트와바이트 비트 (Bit) : 2진수값하나 (0 또는 1) 를저장할수있는최소메모리공간 1비트 2비트 3비트... n비트 2^1 = 2개 2^2 = 4개 2^3 = 8개... 2^n 개 1 바이트는 8 비트 2 2

비트와바이트 비트와바이트 비트 (Bit) : 2진수값하나 (0 또는 1) 를저장할수있는최소메모리공간 1비트 2비트 3비트... n비트 2^1 = 2개 2^2 = 4개 2^3 = 8개... 2^n 개 1 바이트는 8 비트 2 2 비트연산자 1 1 비트와바이트 비트와바이트 비트 (Bit) : 2진수값하나 (0 또는 1) 를저장할수있는최소메모리공간 1비트 2비트 3비트... n비트 2^1 = 2개 2^2 = 4개 2^3 = 8개... 2^n 개 1 바이트는 8 비트 2 2 진수법! 2, 10, 16, 8! 2 : 0~1 ( )! 10 : 0~9 ( )! 16 : 0~9, 9 a, b,

More information

Microsoft PowerPoint - additional01.ppt [호환 모드]

Microsoft PowerPoint - additional01.ppt [호환 모드] 1.C 기반의 C++ part 1 함수 오버로딩 (overloading) 디폴트매개변수 (default parameter) 인-라인함수 (in-line function) 이름공간 (namespace) Jong Hyuk Park 함수 Jong Hyuk Park 함수오버로딩 (overloading) 함수오버로딩 (function overloading) C++ 언어에서는같은이름을가진여러개의함수를정의가능

More information

Microsoft PowerPoint - ch07 - 포인터 pm0415

Microsoft PowerPoint - ch07 - 포인터 pm0415 2015-1 프로그래밍언어 7. 포인터 (Pointer), 동적메모리할당 2015 년 4 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) Outline 포인터 (pointer) 란? 간접참조연산자

More information

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770> 연습문제해답 5 4 3 2 1 0 함수의반환값 =15 5 4 3 2 1 0 함수의반환값 =95 10 7 4 1-2 함수의반환값 =3 1 2 3 4 5 연습문제해답 1. C 언어에서의배열에대하여다음중맞는것은? (1) 3차원이상의배열은불가능하다. (2) 배열의이름은포인터와같은역할을한다. (3) 배열의인덱스는 1에서부터시작한다. (4) 선언한다음, 실행도중에배열의크기를변경하는것이가능하다.

More information

<BFACBDC0B9AEC1A6C7AEC0CC5F F E687770>

<BFACBDC0B9AEC1A6C7AEC0CC5F F E687770> IT OOKOOK 87 이론, 실습, 시뮬레이션 디지털논리회로 ( 개정 3 판 ) (Problem Solutions of hapter 9) . T 플립플롭으로구성된순서논리회로의해석 () 변수명칭부여 F-F 플립플롭의입력 :, F-F 플립플롭의출력 :, (2) 불대수식유도 플립플롭의입력 : F-F 플립플롭의입력 : F-F 플립플롭의출력 : (3) 상태표작성 이면,

More information

디지털시스템설계및실습 1. Verilog HDL 문법 한국기술교육대학교전기전자통신공학부 Ver1.0 (2008)1

디지털시스템설계및실습 1. Verilog HDL 문법 한국기술교육대학교전기전자통신공학부 Ver1.0 (2008)1 디지털시스템설계및실습 1. Verilog HDL 문법 Ver1.0 (2008)1 Verilog HDL 의역사 q Verilog HDL v 1983년 Gateway Design Automation사에서하드웨어기술언어인 HiLo와 C 언어의특징을기반으로개발 v 1991년 Cadence Design Systems가 Open Verilog International

More information

Microsoft PowerPoint - DSD01_verilog1b.pptx

Microsoft PowerPoint - DSD01_verilog1b.pptx 한국기술교육대학교 장영조 한국기술교육대학교전기전자통신공학부 2 1. Velilog HDL 개요 2. Verilog 첫걸음 3. Velilog 어휘규칙 4. 모듈 5. 데이터형 6. 연산자 7. 인스턴스 8. 시스템태스크와함수 9. 컴파일러지시어 한국기술교육대학교전기전자통신공학부 3 설계의기본단위 모듈구성 module module_name (port_list);

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 14. 포인터와함수에대한이해 2013.10.09. 오병우 컴퓨터공학과 14-1 함수의인자로배열전달 기본적인인자의전달방식 값의복사에의한전달 val 10 a 10 11 Department of Computer Engineering 2 14-1 함수의인자로배열전달 배열의함수인자전달방식 배열이름 ( 배열주소, 포인터 ) 에의한전달 #include

More information

C# Programming Guide - Types

C# Programming Guide - Types C# Programming Guide - Types 최도경 lifeisforu@wemade.com 이문서는 MSDN 의 Types 를요약하고보충한것입니다. http://msdn.microsoft.com/enus/library/ms173104(v=vs.100).aspx Types, Variables, and Values C# 은 type 에민감한언어이다. 모든

More information

Microsoft PowerPoint - VHDL08.ppt [호환 모드]

Microsoft PowerPoint - VHDL08.ppt [호환 모드] VHDL 프로그래밍 8. 조합논리회로설계 한동일 학습목표 테스트벤치의용도를알고작성할수있다. 간단한조합논리회로를설계할수있다. 하나의로직회로에대해서다양한설계방식을구사할수있다. 제네릭을활용할수있다. 로직설계를위한사양을이해할수있다. 주어진문제를하드웨어설계문제로변환할수있다. 설계된코드를테스트벤치를이용하여검증할수있다. 2/37 테스트벤치 (test bench) 테스트벤치

More information

Microsoft PowerPoint - chap05-제어문.pptx

Microsoft PowerPoint - chap05-제어문.pptx int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); 1 학습목표 제어문인,, 분기문에 대해 알아본다. 인 if와 switch의 사용 방법과 사용시 주의사항에 대해 알아본다.

More information

Microsoft Word - logic2005.doc

Microsoft Word - logic2005.doc 제 8 장 Counters 실험의목표 - Catalog counter 의동작원리에대하여익힌다. - 임의의 counter를통하여 FSM 구현방법을익힌다. - 7-segment display 의동작원리를이해한다. 실험도움자료 1. 7-segment display 7-segment는디지털회로에서숫자를표시하기위하여가장많이사용하는소자이다. 이름에서알수있듯이 7개의 LED(

More information

슬라이드 1

슬라이드 1 Pairwise Tool & Pairwise Test NuSRS 200511305 김성규 200511306 김성훈 200614164 김효석 200611124 유성배 200518036 곡진화 2 PICT Pairwise Tool - PICT Microsoft 의 Command-line 기반의 Free Software www.pairwise.org 에서다운로드후설치

More information

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx #include int main(void) { int num; printf( Please enter an integer "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 을 작성하면서 C 프로그램의

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 System Software Experiment 1 Lecture 5 - Array Spring 2019 Hwansoo Han (hhan@skku.edu) Advanced Research on Compilers and Systems, ARCS LAB Sungkyunkwan University http://arcs.skku.edu/ 1 배열 (Array) 동일한타입의데이터가여러개저장되어있는저장장소

More information

디지털공학 5판 7-8장

디지털공학 5판 7-8장 Flip-Flops c h a p t e r 07 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.10 7.11 292 flip flop Q Q Q 1 Q 0 set ON preset Q 0 Q 1 resetoff clear Q Q 1 2 SET RESET SET RESET 7 1 crossednand SET RESET SET RESET

More information

슬라이드 1

슬라이드 1 보안회로설계 순차회로 Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr 조합과순차 조합회로 (combinational circuit) Memory가없다. 입력한값에따른출력 출력 = f ( 입력 ) 순차회로 (sequential circuit) Memory가있다. Memory에는회로의현상태가저장 출력은입력과현상태에의해결정

More information

Microsoft PowerPoint - chap04-연산자.pptx

Microsoft PowerPoint - chap04-연산자.pptx int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); } 1 학습목표 수식의 개념과 연산자, 피연산자에 대해서 알아본다. C의 를 알아본다. 연산자의 우선 순위와 결합 방향에

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 06 반복문 01 반복문의필요성 02 for문 03 while문 04 do~while문 05 기타제어문 반복문의의미와필요성을이해한다. 대표적인반복문인 for 문, while 문, do~while 문의작성법을 알아본다. 1.1 반복문의필요성 반복문 동일한내용을반복하거나일정한규칙으로반복하는일을수행할때사용 프로그램을좀더간결하고실제적으로작성할수있음.

More information

4 CD Construct Special Model VI 2 nd Order Model VI 2 Note: Hands-on 1, 2 RC 1 RLC mass-spring-damper 2 2 ζ ω n (rad/sec) 2 ( ζ < 1), 1 (ζ = 1), ( ) 1

4 CD Construct Special Model VI 2 nd Order Model VI 2 Note: Hands-on 1, 2 RC 1 RLC mass-spring-damper 2 2 ζ ω n (rad/sec) 2 ( ζ < 1), 1 (ζ = 1), ( ) 1 : LabVIEW Control Design, Simulation, & System Identification LabVIEW Control Design Toolkit, Simulation Module, System Identification Toolkit 2 (RLC Spring-Mass-Damper) Control Design toolkit LabVIEW

More information

슬라이드 1

슬라이드 1 정적메모리할당 (Static memory allocation) 일반적으로프로그램의실행에필요한메모리 ( 변수, 배열, 객체등 ) 는컴파일과정에서결정되고, 실행파일이메모리에로드될때할당되며, 종료후에반환됨 동적메모리할당 (Dynamic memory allocation) 프로그램의실행중에필요한메모리를할당받아사용하고, 사용이끝나면반환함 - 메모리를프로그램이직접관리해야함

More information

Microsoft PowerPoint - C프로그래밍-chap03.ppt [호환 모드]

Microsoft PowerPoint - C프로그래밍-chap03.ppt [호환 모드] Chapter 03 변수와자료형 2009 한국항공대학교항공우주기계공학부 (http://mercury.kau.ac.kr/sjkwon) 1 변수와자료유형 변수 프로그램에서자료값을임시로기억할수있는저장공간을변수 (variables) 변수 (Variables) 는컴퓨터의메모리인 RAM(Random Access Memory) 에저장 물건을담는박스라고생각한다면박스의크기에따라담을물건이제한됨

More information

목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2

목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2 제 8 장. 포인터 목차 포인터의개요 배열과포인터 포인터의구조 실무응용예제 C 2 포인터의개요 포인터란? 주소를변수로다루기위한주소변수 메모리의기억공간을변수로써사용하는것 포인터변수란데이터변수가저장되는주소의값을 변수로취급하기위한변수 C 3 포인터의개요 포인터변수및초기화 * 변수데이터의데이터형과같은데이터형을포인터 변수의데이터형으로선언 일반변수와포인터변수를구별하기위해

More information

Microsoft PowerPoint - a10.ppt [호환 모드]

Microsoft PowerPoint - a10.ppt [호환 모드] Structure Chapter 10: Structures t and Macros Structure 관련된변수들의그룹으로이루어진자료구조 template, pattern field structure를구성하는변수 (cf) C언어의 struct 프로그램의 structure 접근 entire structure 또는 individual fields Structure는

More information

VHDL 기초 VHDL 두원공과대학정보통신미디어계열이무영

VHDL 기초 VHDL 두원공과대학정보통신미디어계열이무영 기초 두원공과대학정보통신미디어계열이무영 2! 담당 : 이무영, 본관 325 호, mylee@doowon.ac.kr! 강의교재! 3 월 : 기존교재복습 ( 기초와응용, 홍릉과학출판사, 이대영외 3 명공저 )! 4 월이후 : 추후공지! 실습도구! 한백전자 HBE-DTK-240! www.hanback.co.kr ( 디지털 -FPGA) 자료참고할것임.! 천안공대류장열교수님온라인컨텐츠

More information

C++-¿Ïº®Çؼ³10Àå

C++-¿Ïº®Çؼ³10Àå C C++. (preprocessor directives), C C++ C/C++... C++, C. C++ C. C C++. C,, C++, C++., C++.,.. #define #elif #else #error #if #itdef #ifndef #include #line #pragma #undef #.,.,. #include #include

More information

Microsoft PowerPoint - C++ 5 .pptx

Microsoft PowerPoint - C++ 5 .pptx C++ 언어프로그래밍 한밭대학교전자. 제어공학과이승호교수 연산자중복 (operator overloading) 이란? 2 1. 연산자중복이란? 1) 기존에미리정의되어있는연산자 (+, -, /, * 등 ) 들을프로그래머의의도에맞도록새롭게정의하여사용할수있도록지원하는기능 2) 연산자를특정한기능을수행하도록재정의하여사용하면여러가지이점을가질수있음 3) 하나의기능이프로그래머의의도에따라바뀌어동작하는다형성

More information

Microsoft PowerPoint - chap06-2pointer.ppt

Microsoft PowerPoint - chap06-2pointer.ppt 2010-1 학기프로그래밍입문 (1) chapter 06-2 참고자료 포인터 박종혁 Tel: 970-6702 Email: jhpark1@snut.ac.kr 한빛미디어 출처 : 뇌를자극하는 C프로그래밍, 한빛미디어 -1- 포인터의정의와사용 변수를선언하는것은메모리에기억공간을할당하는것이며할당된이후에는변수명으로그기억공간을사용한다. 할당된기억공간을사용하는방법에는변수명외에메모리의실제주소값을사용하는것이다.

More information

Microsoft PowerPoint - M07_RTL.ppt [호환 모드]

Microsoft PowerPoint - M07_RTL.ppt [호환 모드] 제 7 장레지스터이동과데이터처리장치 - 디지털시스템의구성 data path 모듈 : 데이터처리, 레지스터, 연산기, MUX, control unit 모듈 : 제어신호발생, 연산의순서지정 - register transfer operation : reg 데이터이동 / 처리 reg set,operation, sequence control - micro-operation

More information

<BFACBDC0B9AEC1A6C7AEC0CC5F F E687770>

<BFACBDC0B9AEC1A6C7AEC0CC5F F E687770> IT OOKOOK 87 이론, 실습, 시뮬레이션 디지털논리회로 ( 개정 3 판 ) (Problem Solutions of hapter 7) . 반감산기와전감산기를설계 반감산기반감산기는한비트의 2진수 에서 를빼는회로이며, 두수의차 (difference, ) 와빌림수 (barrow, ) 를계산하는뺄셈회로이다. 에서 를뺄수없으면윗자리에서빌려와빼야하며, 이때빌려오는수는윗자리에서가져오므로

More information

<4D F736F F F696E74202D20332EB5F0C1F6C5D0C8B8B7CEBFCD20B1B8C7F62E >

<4D F736F F F696E74202D20332EB5F0C1F6C5D0C8B8B7CEBFCD20B1B8C7F62E > 디지털회로 디지털논리의표현 디지털회로 디지털회로구현 dolicom@naver.com http://blog.naver.com/dolicom 논리 논리게이트 논리게이트 논리게이트 (Logic gate) 또는 로구성된 2 진정보를취급하는논리회 (logic circuit) 일반적으로 2 개이상의입력단자와하나의출력단자 기본게이트 : AND OR NOT 기본게이트로부터

More information

Microsoft PowerPoint - ICCAD_Digital_lec02.ppt [호환 모드]

Microsoft PowerPoint - ICCAD_Digital_lec02.ppt [호환 모드] IC-CAD CAD 실험 Lecture 2 장재원 주문형반도체 (ASIC * ) 설계흐름도개요 Lecture 1 REVIEW ASIC Spec. Front-end design Logic design Logic synthesis Behavioral-level design Structural-level design Schematic editor *Analog 회로설계시

More information

PowerPoint Presentation

PowerPoint Presentation Class - Property Jo, Heeseung 목차 section 1 클래스의일반구조 section 2 클래스선언 section 3 객체의생성 section 4 멤버변수 4-1 객체변수 4-2 클래스변수 4-3 종단 (final) 변수 4-4 멤버변수접근방법 section 5 멤버변수접근한정자 5-1 public 5-2 private 5-3 한정자없음

More information

Microsoft Word - logic2005.doc

Microsoft Word - logic2005.doc 제 7 장 Flip-Flops and Registers 실험의목표 - S-R Latch 의동작을이해하도록한다. - Latch 와 Flip-flop 의차이를이해한다. - D-FF 과 JK-FF 의동작원리를이해한다. - Shift-register MSI 의동작을익히도록한다. - Timing 시뮬레이션방법에대하여습득한다. 실험도움자료 1. Universal Shift

More information

학습목차 2.1 다차원배열이란 차원배열의주소와값의참조

학습목차 2.1 다차원배열이란 차원배열의주소와값의참조 - Part2- 제 2 장다차원배열이란무엇인가 학습목차 2.1 다차원배열이란 2. 2 2 차원배열의주소와값의참조 2.1 다차원배열이란 2.1 다차원배열이란 (1/14) 다차원배열 : 2 차원이상의배열을의미 1 차원배열과다차원배열의비교 1 차원배열 int array [12] 행 2 차원배열 int array [4][3] 행 열 3 차원배열 int array [2][2][3]

More information

한국기술교육대학교장영조 한국기술교육대학교전기전자통신공학부 1

한국기술교육대학교장영조 한국기술교육대학교전기전자통신공학부 1 한국기술교육대학교장영조 한국기술교육대학교전기전자통신공학부 1 본슬라이드는 M. Morris Mano and Charles Kime 의 Logic and Computer Design Fundamentals 의내용을참조하였습니다. 한국기술교육대학교전기전자통신공학부 2 1. 레지스터전송과데이터처리장치 2. 순차진행과제어 3. 명령어구조 (Instruction Set

More information

API 매뉴얼

API 매뉴얼 PCI-DIO12 API Programming (Rev 1.0) Windows, Windows2000, Windows NT and Windows XP are trademarks of Microsoft. We acknowledge that the trademarks or service names of all other organizations mentioned

More information

<4D F736F F F696E74202D20C1A63036C0E520BCB1C5C3B0FA20B9DDBAB928B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20C1A63036C0E520BCB1C5C3B0FA20B9DDBAB928B0ADC0C729205BC8A3C8AF20B8F0B5E55D> Power Java 제 6 장선택과반복 이번장에서학습할내용 조건문이란? if 문 if, else 문 중첩 if 문 switch 문 break문 continue문 지금까지는문장들이순차적으로실행된다고하였다. 하지만필요에따라서조건이만족되면문장의실행순서를변경할수있는기능이제공된다. 3 가지의제어구조 조건문 문장이실행되는순서에영향을주는문장 조건에따라서여러개의실행경로가운데하나를선택

More information

Microsoft PowerPoint - 30.ppt [호환 모드]

Microsoft PowerPoint - 30.ppt [호환 모드] 이중포트메모리의실제적인고장을고려한 Programmable Memory BIST 2010. 06. 29. 연세대학교전기전자공학과박영규, 박재석, 한태우, 강성호 hipyk@soc.yonsei.ac.kr Contents Introduction Proposed Programmable Memory BIST(PMBIST) Algorithm Instruction PMBIST

More information

adfasdfasfdasfasfadf

adfasdfasfdasfasfadf C 4.5 Source code Pt.3 ISL / 강한솔 2019-04-10 Index Tree structure Build.h Tree.h St-thresh.h 2 Tree structure *Concpets : Node, Branch, Leaf, Subtree, Attribute, Attribute Value, Class Play, Don't Play.

More information

ºÎ·ÏB

ºÎ·ÏB B B.1 B.2 B.3 B.4 B.5 B.1 2 (Boolean algebra). 1854 An Investigation of the Laws of Thought on Which to Found the Mathematical Theories of Logic and Probabilities George Boole. 1938 MIT Claude Sannon [SHAN38].

More information

T100MD+

T100MD+ User s Manual 100% ) ( x b a a + 1 RX+ TX+ DTR GND TX+ RX+ DTR GND RX+ TX+ DTR GND DSR RX+ TX+ DTR GND DSR [ DCE TYPE ] [ DCE TYPE ] RS232 Format Baud 1 T100MD+

More information

tut_modelsim(student).hwp

tut_modelsim(student).hwp ModelSim 사용법 1. ModelSim-Altera 를이용한 Function/RTL 시뮬레이션 1.1. 테스트벤치를사용하지않는명령어기반시뮬레이션 1.1.1. 시뮬레이션을위한하드웨어 A B S C 그림 1. 반가산기 1.1.2. 작업디렉토리 - File - Change Directory 를클릭하여작업디렉토리지정. 1.1.3. 소스파일작성 - 모델심편집기나기타편집기가능

More information

프로그래밍개론및실습 2015 년 2 학기프로그래밍개론및실습과목으로본내용은강의교재인생능출판사, 두근두근 C 언어수업, 천인국지음을발췌수정하였음

프로그래밍개론및실습 2015 년 2 학기프로그래밍개론및실습과목으로본내용은강의교재인생능출판사, 두근두근 C 언어수업, 천인국지음을발췌수정하였음 프로그래밍개론및실습 2015 년 2 학기프로그래밍개론및실습과목으로본내용은강의교재인생능출판사, 두근두근 C 언어수업, 천인국지음을발췌수정하였음 CHAPTER 9 둘중하나선택하기 관계연산자 두개의피연산자를비교하는연산자 결과값은참 (1) 아니면거짓 (0) x == y x 와 y 의값이같은지비교한다. 관계연산자 연산자 의미 x == y x와 y가같은가? x!= y

More information

Microsoft PowerPoint - VHDL01_chapter1.ppt [호환 모드]

Microsoft PowerPoint - VHDL01_chapter1.ppt [호환 모드] VHDL 프로그래밍 1. 문법기초 - 간단한조합회로및문법 학습목표 VHDL 기술과소프트웨어와차이파악 Signal assignment 의의미파악 Architecture body 의개념파악 Entity declaration 의개념파악 Process 문의사용법 Variable 과 signal 의차이파악 Library, Use, Package 의사용법 2/53 간단한논리회로예제

More information

<4D F736F F F696E74202D C61645FB3EDB8AEC7D5BCBA20B9D720C5F8BBE7BFEBB9FD2E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D C61645FB3EDB8AEC7D5BCBA20B9D720C5F8BBE7BFEBB9FD2E BC8A3C8AF20B8F0B5E55D> VHDL 프로그래밍 D. 논리합성및 Xilinx ISE 툴사용법 학습목표 Xilinx ISE Tool 을이용하여 Xilinx 사에서지원하는해당 FPGA Board 에맞는논리합성과정을숙지 논리합성이가능한코드와그렇지않은코드를구분 Xilinx Block Memory Generator를이용한 RAM/ ROM 생성하는과정을숙지 2/31 Content Xilinx ISE

More information

hwp

hwp BE 8 BE 6 BE 4 BE 2 BE 0 y 17 y 16 y 15 y 14 y 13 y 12 y 11 y 10 y 9 y 8 y 7 y 6 y 5 y 4 y 3 y 2 y 1 y 0 0 BE 7 BE 5 BE 3 BE 1 BE 16 BE 14 BE 12 BE 10 y 32 y 31 y 30 y 29 y 28 y 27 y 26 y 25 y 24 y 23

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

untitled

untitled Logic and Computer Design Fundamentals Chapter 4 Combinational Functions and Circuits Functions of a single variable Can be used on inputs to functional blocks to implement other than block s intended

More information

Microsoft PowerPoint - chap12-고급기능.pptx

Microsoft PowerPoint - chap12-고급기능.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 가 제공하는 매크로 상수와 매크로

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

. 고성능마이크로프로세서 LU 와레지스터 파일의구조 (2.). 직접디지털주파수합성기 (FS) 의구조 3. 고성능마이크로프로세서부동소수점연산기 (Floating-Point Unit) 구조 (2) (2.) (2.) 2. 암호화를위한 VLSI 구조와설계의개요 (2.) 다음참

. 고성능마이크로프로세서 LU 와레지스터 파일의구조 (2.). 직접디지털주파수합성기 (FS) 의구조 3. 고성능마이크로프로세서부동소수점연산기 (Floating-Point Unit) 구조 (2) (2.) (2.) 2. 암호화를위한 VLSI 구조와설계의개요 (2.) 다음참 이비디오교재는정보통신부의 999년도정보통신학술진흥지원사업에의하여지원되어연세대학교전기전자공학과이용석교수연구실에서제작되었습니다 고성능마이크로프로세서 LU ( rithmetic Logic Unit) 와 Register File의구조 2. 연세대학교전기전자공학과이용석교수 Homepage: http://mpu.yonsei.ac.kr E-mail: yonglee@yonsei.ac.kr

More information

Microsoft PowerPoint - [2009] 02.pptx

Microsoft PowerPoint - [2009] 02.pptx 원시데이터유형과연산 원시데이터유형과연산 원시데이터유형과연산 숫자데이터유형 - 숫자데이터유형 원시데이터유형과연산 표준입출력함수 - printf 문 가장기본적인출력함수. (stdio.h) 문법 ) printf( Test printf. a = %d \n, a); printf( %d, %f, %c \n, a, b, c); #include #include

More information

PowerPoint Template

PowerPoint Template 16-1. 보조자료템플릿 (Template) 함수템플릿 클래스템플릿 Jong Hyuk Park 함수템플릿 Jong Hyuk Park 함수템플릿소개 함수템플릿 한번의함수정의로서로다른자료형에대해적용하는함수 예 int abs(int n) return n < 0? -n : n; double abs(double n) 함수 return n < 0? -n : n; //

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

Microsoft PowerPoint - chap03-변수와데이터형.pptx

Microsoft PowerPoint - chap03-변수와데이터형.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num %d\n", num); return 0; } 1 학습목표 의 개념에 대해 알아본다.

More information

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074> Chap #2 펌웨어작성을위한 C 언어 I http://www.smartdisplay.co.kr 강의계획 Chap1. 강의계획및디지털논리이론 Chap2. 펌웨어작성을위한 C 언어 I Chap3. 펌웨어작성을위한 C 언어 II Chap4. AT89S52 메모리구조 Chap5. SD-52 보드구성과코드메모리프로그래밍방법 Chap6. 어드레스디코딩 ( 매핑 ) 과어셈블리어코딩방법

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 08 함수 01 함수의개요 02 함수사용하기 03 함수와배열 04 재귀함수 함수의필요성을인식한다. 함수를정의, 선언, 호출하는방법을알아본다. 배열을함수의인자로전달하는방법과사용시장점을알아본다. 재귀호출로해결할수있는문제의특징과해결방법을알아본다. 1.1 함수의정의와기능 함수 (function) 특별한기능을수행하는것 여러가지함수의예 Page 4 1.2

More information

Microsoft PowerPoint - chap06-1Array.ppt

Microsoft PowerPoint - chap06-1Array.ppt 2010-1 학기프로그래밍입문 (1) chapter 06-1 참고자료 배열 박종혁 Tel: 970-6702 Email: jhpark1@snut.ac.kr 한빛미디어 출처 : 뇌를자극하는 C프로그래밍, 한빛미디어 -1- 배열의선언과사용 같은형태의자료형이많이필요할때배열을사용하면효과적이다. 배열의선언 배열의사용 배열과반복문 배열의초기화 유연성있게배열다루기 한빛미디어

More information

Microsoft PowerPoint - chap06-5 [호환 모드]

Microsoft PowerPoint - chap06-5 [호환 모드] 2011-1 학기프로그래밍입문 (1) chapter 06-5 참고자료 변수의영역과데이터의전달 박종혁 Tel: 970-6702 Email: jhpark1@seoultech.ac.kr h k 한빛미디어 출처 : 뇌를자극하는 C프로그래밍, 한빛미디어 -1- ehanbit.net 자동변수 지금까지하나의함수안에서선언한변수는자동변수이다. 사용범위는하나의함수내부이다. 생존기간은함수가호출되어실행되는동안이다.

More information

Microsoft PowerPoint - ICCAD_Analog_lec01.ppt [호환 모드]

Microsoft PowerPoint - ICCAD_Analog_lec01.ppt [호환 모드] Chapter 1. Hspice IC CAD 실험 Analog part 1 Digital circuit design 2 Layout? MOSFET! Symbol Layout Physical structure 3 Digital circuit design Verilog 를이용한 coding 및 function 확인 Computer 가알아서해주는 gate level

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 실습 1 배효철 th1g@nate.com 1 목차 조건문 반복문 System.out 구구단 모양만들기 Up & Down 2 조건문 조건문의종류 If, switch If 문 조건식결과따라중괄호 { 블록을실행할지여부결정할때사용 조건식 true 또는 false값을산출할수있는연산식 boolean 변수 조건식이 true이면블록실행하고 false 이면블록실행하지않음 3

More information

CAN-fly Quick Manual

CAN-fly Quick Manual adc-171 Manual Ver.1.0 2011.07.01 www.adc.co.kr 2 contents Contents 1. adc-171(rn-171 Pack) 개요 2. RN-171 Feature 3. adc-171 Connector 4. adc-171 Dimension 5. Schematic 6. Bill Of Materials 7. References

More information

[2010 년디지털시스템설계및실험중간고사 2 답안지 ] 출제 : 채수익 1. (a) (10 pts) Robertson diagram Quotient 와 remainder 의 correction 을뒤로미루는것이 non-restoring division 이다. 즉, q =

[2010 년디지털시스템설계및실험중간고사 2 답안지 ] 출제 : 채수익 1. (a) (10 pts) Robertson diagram Quotient 와 remainder 의 correction 을뒤로미루는것이 non-restoring division 이다. 즉, q = [2010 년디지털시스템설계및실험중간고사 2 답안지 ] 출제 : 채수익 1. (a) (10 pts) Robertson diagram Quotient 와 remainder 의 correction 을뒤로미루는것이 non-restoring division 이다. 즉, q = 1, 2r 0 1, 2r

More information

11장 포인터

11장 포인터 누구나즐기는 C 언어콘서트 제 9 장포인터 이번장에서학습할내용 포인터이란? 변수의주소 포인터의선언 간접참조연산자 포인터연산 포인터와배열 포인터와함수 이번장에서는포인터의기초적인지식을학습한다. 포인터란? 포인터 (pointer): 주소를가지고있는변수 메모리의구조 변수는메모리에저장된다. 메모리는바이트단위로액세스된다. 첫번째바이트의주소는 0, 두번째바이트는 1, 변수와메모리

More information

4장.문장

4장.문장 문장 1 배정문 혼합문 제어문 조건문반복문분기문 표준입출력 입출력 형식화된출력 [2/33] ANSI C 언어와유사 문장의종류 [3/33] 값을변수에저장하는데사용 형태 : < 변수 > = < 식 > ; remainder = dividend % divisor; i = j = k = 0; x *= y; 형변환 광역화 (widening) 형변환 : 컴파일러에의해자동적으로변환

More information

Microsoft Word - 제6장 Beyond Simple Logic Gate.doc

Microsoft Word - 제6장 Beyond Simple Logic Gate.doc 제 6 장 Beyond Simple Logic Gate 실험의목표 - MUX, DEMUX의동작을이해하도록한다. - encoder 와 decoder 의원리를익히고 MUX, DEMUX 와비교를해본다. - MUX 를이용하여조합회로를설계해본다. - tri-state gate 와 open-collector gate 의특성에대하여알아본다. 잘못된사용법에대하여어떤결과가발생하는지확인해본다.

More information

C 프로그래밍 언어 입문 C 프로그래밍 언어 입문 김명호저 숭실대학교 출판국 머리말..... C, C++, Java, Fortran, Python, Ruby,.. C. C 1972. 40 C.. C. 1999 C99. C99. C. C. C., kmh ssu.ac.kr.. ,. 2013 12 Contents 1장 프로그래밍 시작 1.1 C 10 1.2 12

More information

A Dynamic Grid Services Deployment Mechanism for On-Demand Resource Provisioning

A Dynamic Grid Services Deployment Mechanism for On-Demand Resource Provisioning C Programming Practice (I) Contents 변수와상수 블록과변수의범위 수식과연산자 제어문과반복문 문자와문자열 배열, 포인터, 메모리관리 구조체 디버거 (gdb) 사용법 2/17 Reference The C Programming language, Brian W. Kernighan, Dennis M. Ritchie, Prentice-Hall

More information

Slide 1

Slide 1 Clock Jitter Effect for Testing Data Converters Jin-Soo Ko Teradyne 2007. 6. 29. 1 Contents Noise Sources of Testing Converter Calculation of SNR with Clock Jitter Minimum Clock Jitter for Testing N bit

More information

Data Structure

Data Structure Function & Pointer C- 언어의활용을위한주요기법 (3) Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr 함수의인자전달 함수의인자전달 함수의인자전달방식 인자전달의기본방식은복사다. 함수호출시전달되는값을매개변수를통해서전달받는데, 이때에값의복사가일어난다. int main(void) int val = 10;

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 생체계측 디지털논리회로 Prof. Jae Young Choi ( 최재영교수 ) 생체계측 (2014 Fall) Prof. Jae Young Choi Section 01 논리게이트 디지털컴퓨터에서모든정보는 0 또는 1 을사용하여표현 게이트 (gate) 0, 1 의이진정보를처리하는논리회로여러종류가존재동작은부울대수를이용하여표현입력과출력의관계는진리표로표시 2 ND 게이트

More information

Infinity(∞) Strategy

Infinity(∞) Strategy 반복제어 표월성 passwd74@cherub.sungkyul.edu 개요 for() 문 break문과 continue문 while문 do-while문 for() 문 for() 문형식 for( 표현식1; 표현식2; 표현식3) 여러문장들 ; 표현식 1 : 초기화 (1 번만수행 ) 표현식 2 : 반복문수행조건 ( 없으면무한반복 ) 표현식 3 : 반복문수행횟수 for()

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

Microsoft PowerPoint - lec2.ppt

Microsoft PowerPoint - lec2.ppt 2008 학년도 1 학기 상지대학교컴퓨터정보공학부 고광만 강의내용 어휘구조 토큰 주석 자료형기본자료형 참조형배열, 열거형 2 어휘 (lexicon) 어휘구조와자료형 프로그램을구성하는최소기본단위토큰 (token) 이라부름문법적으로의미있는최소의단위컴파일과정의어휘분석단계에서처리 자료형 자료객체가갖는형 구조, 개념, 값, 연산자를정의 3 토큰 (token) 정의문법적으로의미있는최소의단위예,

More information

수없기때문에간단한부분으로나눠서구현하고, 이를다시합침으로써전체를구현하게 된다. 실험에서는이미구현된 4-Bit ALU인 74LS181 Chip을사용한다. 이 Chip은 4-bit의 Data input A, B와 Selection input 4 bit, Carry In 1

수없기때문에간단한부분으로나눠서구현하고, 이를다시합침으로써전체를구현하게 된다. 실험에서는이미구현된 4-Bit ALU인 74LS181 Chip을사용한다. 이 Chip은 4-bit의 Data input A, B와 Selection input 4 bit, Carry In 1 Experiment 6. Use of Arithmetic Logic Unit and Flip-Flops Abstract 본실험에서는현대 CPU의가장근간이되는 Unit인산술및논리연산기 (Arithmetic Logic Unit, ALU) 와순차회로 (Sequential Circuit) 을이루는대표적인기억소자인플립플롭 (Flip-flop) 의기능을익히며, 간단한연산회로와순차회로를구현해본다.

More information

8장 조합논리 회로의 응용

8장 조합논리 회로의 응용 8 장연산논리회로 가산기 반가산기와전가산기 반가산기 (Half Adder, HA) 8. 기본가 / 감산기 비트의 개 진수를더하는논리회로. 개의입력과출력으로구성. 개입력은피연산수 와연산수 y 이고, 출력은두수를합한결과인합 S(sum) 과올림수 C(carry) 를발생하는회로. : 피연산수 : 연산수 : 합 y C S y S C 올림수 올림수 전가산기 : 연산수

More information

Microsoft PowerPoint - 2주차-1차시 (강의자료) ch01 - C Programming 기초 (part 2)

Microsoft PowerPoint - 2주차-1차시 (강의자료) ch01 - C Programming 기초 (part 2) 일반적인프로그램의기본구성형태 데이터를받아서 ( 입력단계 ), 데이터를처리한후에 ( 처리단계 ), 결과를화면에출력 ( 출력단계 ) 한다. 데이터입력 데이터처리 결과출력 1-23 덧셈프로그램 #1 주석 전처리기지시어 /* 두개의숫자의합을계산하는프로그램 */ #include 함수 int main(void) { int x; int y; int sum;

More information

슬라이드 1

슬라이드 1 마이크로컨트롤러 2 (MicroController2) 2 강 ATmega128 의 external interrupt 이귀형교수님 학습목표 interrupt 란무엇인가? 기본개념을알아본다. interrupt 중에서가장사용하기쉬운 external interrupt 의사용방법을학습한다. 1. Interrupt 는왜필요할까? 함수동작을추가하여실행시키려면? //***

More information

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과

임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 임베디드시스템설계강의자료 6 system call 2/2 (2014 년도 1 학기 ) 김영진 아주대학교전자공학과 System call table and linkage v Ref. http://www.ibm.com/developerworks/linux/library/l-system-calls/ - 2 - Young-Jin Kim SYSCALL_DEFINE 함수

More information