The following Verilog code defines a function that computes the factorial of a number recursively. The automatic

Question:

The following Verilog code defines a function that computes the factorial of a number recursively. The automatic keyword is used to allow the function to be called recursively. Fill in the missing code that follows.
module factorial_test;
function automatic integer factorial;
input [31:0] num;
/*
Insert your code to implement factorial
*/
endfunction
integer result;
initial begin
/*
Insert your code to compute the factorial of 9
*/
$display("factorial = %d", result);
end
endmodule

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Digital Systems Design Using Verilog

ISBN: 978-1285051079

1st edition

Authors: Charles Roth, Lizy K. John, Byeong Kil Lee

Question Posted: