This commit is contained in:
2025-08-18 07:18:32 +03:00
commit 12dcc9d232
27 changed files with 1910 additions and 0 deletions

22
chapter2/fibonacci.v Normal file
View File

@@ -0,0 +1,22 @@
module fibonacci (
input clk,
input rst,
output reg [31:0] num
);
reg [31:0] nums [1:0];
always @(posedge clk) begin
if (rst) begin
num <= 32'd1;
nums[0] <= 32'd0;
nums[1] <= 32'd0;
end
else begin
nums[1] <= nums[0];
nums[0] <= num;
num <= nums[0] + nums[1];
end
end
endmodule