我试图创建一个1赫兹时钟信号的格子ICE40 FPGA。我正在用Verilog编写我的代码,并使用格子辐射软件。这个1Hz的时钟信号将被用来产生一个方波。
然而,我没有得到任何输出,无论是从引脚,时钟信号应该是在或从引脚,应该输出一个方波。我确信我正在检查正确的引脚。我也确信代码正在下载到董事会。我相信FPGA实际上并不是出于某种原因而产生时钟信号的。
这是我的代码:
module square (clk, x, y, z);
// Inputs and Outputs
input clk; // The clock signal
output x, y, z; // The square wave output
// Type Declaration
reg x; // x is a register
// Initialize x
initial
begin
x = 0;
end
// Run each time the clock transitions from low to high
always @(posedge clk)
begin
x = !x; // Flip x
end
// Outputs used to confirm the program is running
assign y = 0; //39A
assign z = 1; //41A
endmodule下面是我的综合约束文件(.ldc):
create_clock -name {clk} -period 1000000000 [get_ports clk]周期以纳秒为单位,所以这是一个1Hz的时钟。
谢谢。
发布于 2019-01-22 21:32:59
谢谢大家。我没有意识到我需要自己创造这个钟。我用高速振荡器功能创建了一个时钟:
// Initialize the high speed oscillator
HSOSC clock (
.CLKHFEN(1'b1), // Enable the output
.CLKHFPU(1'b1), // Power up the oscillator
.CLKHF(clk) // Oscillator output
);
// Divide the oscillator down to 6 MHz
defparam clock.CLKHF_DIV = "0b11";而且它似乎起作用了。
https://stackoverflow.com/questions/54312254
复制相似问题