module glfff(f_clk,p,choose,data);
input [5:0] p;
input choose;
input f_clk;
output [7:0] data;
wire [7:0]data;
reg [5:0] addr,address;
reg [5:0] i;
reg f_out;
initial
begin
i<=0;
addr<=0;
f_out<=0;
end
always @(posedge f_clk)
begin
if(i==p)
begin
i=0;
f_out=~f_out;
end
else
i=i+1;
end
function [7:0] romout;
input[5:0] address;
case(address)
0 : romout = 255;
1 : romout = 255;
2 : romout = 255;
3 : romout = 255;
4 : romout = 128;
5 : romout = 128;
6 : romout = 128;
7 : romout = 128;
8 : romout = 64;
9 : romout = 64;
10: romout = 64;
11: romout = 64;
12: romout = 0;
13: romout = 0;
14: romout = 0;
15: romout = 0;
16 : romout = 255;
17 : romout = 255;
18 : romout = 255;
19 : romout = 255;
20 : romout = 255;
21 : romout = 255;
22 : romout = 255;
23 : romout = 255;
24 : romout = 0;
25 : romout = 0;
26: romout = 0;
27: romout = 0;
28: romout = 0;
29: romout = 0;
30: romout = 0;
31: romout = 0;
default : romout = 10'hxx;
endcase
endfunction
[url]http://always@(posedge[/url] f_out)
begin
if(addr==16)
addr=0;
else
addr=addr+1;
case(choose)
0: address=addr;
1: address=addr+16;
endcase
end
assign data = romout(address);
endmodule
input [5:0] p;
input choose;
input f_clk;
output [7:0] data;
wire [7:0]data;
reg [5:0] addr,address;
reg [5:0] i;
reg f_out;
initial
begin
i<=0;
addr<=0;
f_out<=0;
end
always @(posedge f_clk)
begin
if(i==p)
begin
i=0;
f_out=~f_out;
end
else
i=i+1;
end
function [7:0] romout;
input[5:0] address;
case(address)
0 : romout = 255;
1 : romout = 255;
2 : romout = 255;
3 : romout = 255;
4 : romout = 128;
5 : romout = 128;
6 : romout = 128;
7 : romout = 128;
8 : romout = 64;
9 : romout = 64;
10: romout = 64;
11: romout = 64;
12: romout = 0;
13: romout = 0;
14: romout = 0;
15: romout = 0;
16 : romout = 255;
17 : romout = 255;
18 : romout = 255;
19 : romout = 255;
20 : romout = 255;
21 : romout = 255;
22 : romout = 255;
23 : romout = 255;
24 : romout = 0;
25 : romout = 0;
26: romout = 0;
27: romout = 0;
28: romout = 0;
29: romout = 0;
30: romout = 0;
31: romout = 0;
default : romout = 10'hxx;
endcase
endfunction
[url]http://always@(posedge[/url] f_out)
begin
if(addr==16)
addr=0;
else
addr=addr+1;
case(choose)
0: address=addr;
1: address=addr+16;
endcase
end
assign data = romout(address);
endmodule