blob: 752c0b6cd2f2bef42cda40784e4c2d87f2edc746 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
`include "utils.svh"
module fibseq
#( BITS = 8
)
( input bit clk
, input bit reset
, input bit ready `define ready `past(ready)
, output bit valid
, output bit [BITS-1:0] data
);
bit [BITS-1:0] a;
bit [BITS-1:0] b;
always_ff @(posedge clk) begin
if (reset) begin
valid = 0;
a = 0;
b = 1;
end else begin
if (`ready) valid = 0;
if (!valid) begin
valid = 1;
data = a;
{a, b} = {b, a + b};
end
end
end
endmodule
|