-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMulti_freq_bar.v
More file actions
47 lines (41 loc) · 1.17 KB
/
Copy pathMulti_freq_bar.v
File metadata and controls
47 lines (41 loc) · 1.17 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
`timescale 1ns / 1ps
module Multi_freq_bar(
input clk,rst,enb ,input [1:0]mode,
output reg f_2,
output reg f_4,
output reg f_8,
output reg f_16
);
reg [3:0] counter_internal;
always@(posedge clk) begin
if(rst)
counter_internal <= 0;
else if(enb)
counter_internal <= counter_internal +1'b1;
else
counter_internal <= counter_internal;
end
always@(posedge clk)
begin
case(mode)
2'b00 : begin
f_2 <= counter_internal[0];
end
2'b01 : begin
f_4 <= counter_internal[1];
end
2'b10 : begin
f_8 <= counter_internal[2];
end
2'b11 : begin
f_16 <= counter_internal[3];
end
default : begin
f_2 <= 0;
f_4 <= 0;
f_8 <= 0;
f_16 <= 0;
end
endcase
end
endmodule