[問題] verilog語法問題
最近剛學硬體描述語言
有個基本的語法問題想請教各位前輩
主要是希望能夠控制led燈跑的次數
如果是寫成這樣的話
always @(posedge clk)
begin
if(rst) // the rst is high
begin
if(count == 24'h3B8D80) // test for the delay
begin
count = 0; // clear the count
led = led << 1; // shift right one bit of the led rgister
if(led == 8'h00) // the led has shift 8 bits position
begin
led = 8'h01; // re-set the inital vaule of the led
end
end
else
begin
count = count + 1; // delay time + 1
end
end
燒出來的結果 led燈會由左跑到右 然後一直repeat
如果我希望控制它的次數
應該要怎樣修改這段程式呢
有想過在
if(count == 24'h3B8D80) // test for the delay
begin
兩行中間 加入如
if (right_number<=3)
又覺得似乎沒有這麼簡單
如果希望能夠讓led燈從右到左跑x次 再從左至右y次
應該要怎麼寫呢
感謝各位前輩幫忙!!!!
為聊表小弟感謝之意,願奉上1000p幣給好心幫忙的大大!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.40.161.214
※ 編輯: p7pp7 來自: 114.40.161.214 (04/19 04:33)
→
04/19 18:35, , 1F
04/19 18:35, 1F
→
04/19 18:36, , 2F
04/19 18:36, 2F
推
04/23 23:58, , 3F
04/23 23:58, 3F
討論串 (同標題文章)