?? ask_two.v
字號:
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:03:03 07/20/2007
// Design Name:
// Module Name: ASK_two
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module ASK_two(clk, reset, x, y);
input clk;
input reset;
input x;
output y;
reg y;
reg [2:0] cnt; //計數器
reg [2:0] m; // 記錄x的脈沖數數
always @(posedge clk) begin //完成cnt的循環計數
if(!reset) begin
cnt <= 3'b000;
end
else if(cnt == 3'b111)
cnt <= 3'b000;
else
cnt <= cnt +1 ;
end
always @(posedge x) begin // 此過程完成2_ASK信號的解調
if(!reset) begin
m <= 3'b000;
end
else begin
if(cnt == 3'b110) begin
if (m <= 3'b010) // 只要m計數器超過3,就判決為1
y <= 1'b0;
else
y <= 1'b1;
m <= 3'b000; // 清空m計數器
end
else
m <= m+1;
end
end
endmodule
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -