You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
415 B
25 lines
415 B
//Task version
|
|
|
|
task automatic sigmoid_deriv_task;
|
|
input [7:0] x;
|
|
output [7:0] y;
|
|
begin
|
|
y = x * (1-x);
|
|
end
|
|
endtask
|
|
|
|
//Function version
|
|
|
|
function automatic [7:0] sigmoid_deriv_func;
|
|
input signed [7:0] x;
|
|
begin
|
|
sigmoid_deriv_func = x * (1-x);
|
|
end
|
|
endfunction
|
|
|
|
function automatic [7:0] sigmoid;
|
|
input signed [7:0] x;
|
|
begin
|
|
sigmoid = 1 / (1+ 2.71828**(-x));
|
|
end
|
|
endfunction |