我正在使用Verilog構建萊迪思CPLD的VGA控制器。過去我接觸過Verilog,但已經有一段時間了,而且我很生鏽,並且在控制顯示器所需的同步線沒有被驅動的地方(使用O.Scope進行檢查),以及我不確定爲什麼不。CPLD引腳不被驅動
我試圖模擬Active-HDL中的代碼,但我得到一個奇怪的錯誤消息(無法爲非阻塞事務分配內存)並得到警告,計數器沒有負載(我相信我可以忽略在這種情況下)的代碼如下下方,如果它有助於使代碼更清楚我試圖按照時序圖是靠近(但不完全相同)這個? - >click here
module CtrlLines(NRST, CLK, H_SYNC, V_SYNC);
input wire CLK; /*< CLK input from Top module >*/
input wire NRST; /*< Reset input from Top module >*/
output reg H_SYNC;
output reg V_SYNC;
reg [10:0] h_counter; /*< Tracks amount of pulses from CLK >*/
reg [10:0] v_counter; /*< Tracks amount of pulses from H_SYNC >*/
`define H_FRONT_PORCH 10'd95
`define H_BACK_PORCH 10'd720
`define H_COUNT_MAX 10'd800
`define V_FRONT_PORCH 10'd2
`define V_BACK_PORCH 10'd514
`define V_COUNT_MAX 10'd528
always @(negedge NRST, posedge CLK) begin
if (!NRST) begin
h_counter <= 10'b00;
end
else begin
h_counter <= h_counter + 1'b1;
case (h_counter)
`H_FRONT_PORCH: H_SYNC <= 1; /*< If the counter has reached Front Porch, go High >*/
`H_BACK_PORCH : H_SYNC <= 0; /*< If the counter has reached Back Porch, go Low >*/
`H_COUNT_MAX : h_counter <= 0; /*< If the counter has reached Max, Reset >*/
endcase /*< Else, remain at current level >*/
end
end
always @(negedge NRST, negedge H_SYNC) begin
if (!NRST) begin
v_counter <= 10'b00;
end
else begin
v_counter <= v_counter +1'b1;
case (v_counter)
`V_FRONT_PORCH : V_SYNC <= 1;
`V_BACK_PORCH : V_SYNC <= 0;
`V_COUNT_MAX : v_counter <= 0;
endcase
end
end
endmodule
不知道答案,但有一些想法:1.您的計數器註冊聲明太大1(11位),但我認爲這不是一個致命的問題。 2.你確定你的CPLD允許使用任意信號作爲時鐘嗎? (re:'negedge H_SYNC')。可能更好地寫出所有基於'posedge CLK'的同步邏輯。 3.我不確定那個模擬器的錯誤,是它給你的全文嗎?它是編譯還是運行時錯誤? – Tim 2013-03-17 20:16:12