【问题标题】:Tying to do frequency scaling of 50 MHz signal to 1MHz with below code. "endmodule" error occurs使用以下代码将 50 MHz 信号频率缩放至 1MHz。发生“endmodule”错误
【发布时间】:2023-03-14 14:09:01
【问题描述】:
module PWM_Gen(

input clk,             // Clock input
input [7:0]DUTY_CYCLE, // Input Duty Cycle
output PWM_OUT         // Output PWM
);

reg [7:0]counter_out; // 8-bit counter

always @(posedge clk)   
begin
   if (DUTY_CYCLE > counter_out)
   PWM_OUT = 1;
   else
   PWM_OUT = 0;
end
counter counter_inst(   
.clk(clk),
.counter_out(counter_out)
)

endmodule

错误是 -

错误 (10170):PWM_Gen.v(51) 附近文本处的 Verilog HDL 语法错误: “端模块”;期待“;”。

第二季度。我不明白时钟输入是如何与占空比相关的以及我如何在代码中实现它? Q3.我不明白我将如何获得 1MHz 的输出?

【问题讨论】:

  • 编译问题 --> 请将 counter_out 声明为wire。使用 wire [7:0] counter_out 并在 counter_inst 的右括号后添加分号,即 /*Previous code*/ .counter_out(counter_out) ) ; //这里加分号
  • 请用代码解释我,因为我是 vhdl 的新手

标签: c verilog quartus


【解决方案1】:

这是一个错字,您需要在 counter_inst 实例化之后添加一个 ;

【讨论】:

  • 试过了,但还是一样。错误 (10170):PWM_Gen.v 附近文本的 Verilog HDL 语法错误:“endmodule”;期待“;”。
  • 你到底在哪里添加 ; ?
  • counter counter_inst( 在这行之后我添加了 ;
猜你喜欢
  • 1970-01-01
  • 2016-07-30
  • 2021-08-28
  • 2020-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多