lattice diamond中使用时钟源demo 我一直以为使用时钟源 OSCH 需要配置ip核什么的, 实际上不需要配置. 直接在代码里写 OSCH OSCH_inst(…) 即可. 默认就引用. 参考代码如下. 无需任何额外的配置. 登录后复制 `timescale 10ns / 1ps module inter_clk ( output[1:0] led ); localparam TIME1MHZ_DIV = 38000_000; wire sys_clk; defparam OSCH_inst.NOM_FREQ = "38.00"; OSCH OSCH_inst( .STDBY(1'b0), // 0=Enabled, 1=Disabled // also Disabled with Bandgap=OFF .OSC (sys_clk), .SEDSTDBY() ); reg[31:0] led_blink_count; always @(posedge sys_clk) begin if(led_blink_count == TIME1MHZ_DIV) led_blink_count <= 0; else led_blink_count <= led_blink_count+ 1'd1; end reg led_temp; always @(posedge sys_clk) begin if(led_blink_count == TIME1MHZ_DIV) led_temp <= ~led_temp; else led_temp <= led_temp; end assign led[0] = led_temp; assign led[1] = ~led_temp; endmodule 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. 原创作者: u_15353042 转载于: https://blog.51cto.com/u_15353042/11722635