vistaでquartus その9
概要
vistaでquartusやってみた。
zundokoやってみた。
環境
windows vista 32bit
quartus ii v13.0
ep2c5t144ボード
写真
サンプルコード
module test2(input clk, input rst, output tx);
localparam NEXT = 4'b0000;
localparam DONE = 4'b1111;
reg [7:0] r;
reg [3:0] n;
reg [7:0] char;
reg [3:0] state = NEXT;
reg send = 0;
reg [23:0] cnt;
wire clk2 = cnt[13];
tx1 tx1(.clk(clk), .rst(rst), .send(send), .data(char), .tx(tx), .ed(ed));
always @(posedge clk)
begin
cnt <= cnt + 1'b1;
end
always @(posedge clk2)
begin
send <= 0;
if (ed)
begin
if (rst == 0)
begin
state <= NEXT;
r <= 234;
n <= 0;
end
else if (state == NEXT)
begin
r <= r * 5 + 1;
state <= 1;
end
else if (state != DONE)
begin
if (n == 4)
begin
case (state)
1:
begin
char <= "d";
state <= state + 1;
end
2:
begin
char <= "o";
state <= state + 1;
end
3:
begin
char <= "k";
state <= state + 1;
end
4:
begin
char <= "o";
state <= state + 1;
end
5:
begin
char <= "k";
state <= state + 1;
end
6:
begin
char <= "i";
state <= state + 1;
end
7:
begin
char <= "y";
state <= state + 1;
end
8:
begin
char <= "o";
state <= state + 1;
end
9:
begin
char <= "s";
state <= state + 1;
end
10:
begin
char <= "i";
state <= DONE;
end
endcase
end
else if (r < 127)
begin
case (state)
1:
begin
char <= "z";
state <= state + 1;
end
2:
begin
char <= "u";
state <= state + 1;
end
3:
begin
char <= "n";
state <= state + 1;
end
4:
begin
char <= " ";
n <= n + 1;
state <= NEXT;
end
endcase
end
else
begin
case (state)
1:
begin
char <= "d";
state <= state + 1;
end
2:
begin
char <= "o";
state <= state + 1;
end
3:
begin
char <= "k";
state <= state + 1;
end
4:
begin
char <= "o";
state <= state + 1;
end
5:
begin
char <= " ";
n <= 0;
state <= NEXT;
end
endcase
end
send <= 1;
end
end
end
endmodule
module test2(input clk, input rst, output tx);
localparam NEXT = 4'b0000;
localparam DONE = 4'b1111;
reg [7:0] r;
reg [3:0] n;
reg [7:0] char;
reg [3:0] state = NEXT;
reg send = 0;
reg [23:0] cnt;
wire clk2 = cnt[13];
tx1 tx1(.clk(clk), .rst(rst), .send(send), .data(char), .tx(tx), .ed(ed));
always @(posedge clk)
begin
cnt <= cnt + 1'b1;
end
always @(posedge clk2)
begin
send <= 0;
if (ed)
begin
if (rst == 0)
begin
state <= NEXT;
r <= 234;
n <= 0;
end
else if (state == NEXT)
begin
r <= r * 5 + 1;
state <= 1;
end
else if (state != DONE)
begin
if (n == 4)
begin
case (state)
1:
begin
char <= "d";
state <= state + 1;
end
2:
begin
char <= "o";
state <= state + 1;
end
3:
begin
char <= "k";
state <= state + 1;
end
4:
begin
char <= "o";
state <= state + 1;
end
5:
begin
char <= "k";
state <= state + 1;
end
6:
begin
char <= "i";
state <= state + 1;
end
7:
begin
char <= "y";
state <= state + 1;
end
8:
begin
char <= "o";
state <= state + 1;
end
9:
begin
char <= "s";
state <= state + 1;
end
10:
begin
char <= "i";
state <= DONE;
end
endcase
end
else if (r < 127)
begin
case (state)
1:
begin
char <= "z";
state <= state + 1;
end
2:
begin
char <= "u";
state <= state + 1;
end
3:
begin
char <= "n";
state <= state + 1;
end
4:
begin
char <= " ";
n <= n + 1;
state <= NEXT;
end
endcase
end
else
begin
case (state)
1:
begin
char <= "d";
state <= state + 1;
end
2:
begin
char <= "o";
state <= state + 1;
end
3:
begin
char <= "k";
state <= state + 1;
end
4:
begin
char <= "o";
state <= state + 1;
end
5:
begin
char <= " ";
n <= 0;
state <= NEXT;
end
endcase
end
send <= 1;
end
end
end
endmodule
以上。
Author And Source
この問題について(vistaでquartus その9), 我々は、より多くの情報をここで見つけました https://qiita.com/ohisama@github/items/ab24020d0fb5568156f7著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .