본문 바로가기
HW Design/1. Verilog HDL Basic

[Function and Task] 3. 예제 풀이

by 한PU 2024. 1. 16.
728x90
반응형

1. task 와 function의 두 가지 차이점은?

 

더보기

A task can have ore than one output but a function can only have one. A function can not consume time but a task can.

 

2. normal 함수와 automatic 함수의 차이점은?

 

더보기

Normal verilog functions use static memory allocation whereas automatic functions use dynamic memory allocation.

 

3. integer inputs와 그 곱이 return인 함수를 작성하시오.

728x90
더보기
function integer product(input integer a, b, c);
	begin
		product = a * b * c;
	end
endfunction : product

 

4. 두 숫자의 합을 반환하는 task 코드를 작성하시오.
- 단, 결과가 반환되기 전에 일정 시간 지연이 필요함.
- task에는 지연시간 설정 time type과 두 정수의 세 가지 입력 필요.
- 하나의 출력 필요.

반응형
더보기
task add_delay;
	input time del;
	input integer a;
	input integer b;
	output integer c;
	begin
		#del c = a + b;
	end
endtask
728x90
반응형