[問題]新手發問 FPGA啟動開關已刪文
小弟不才 剛開始學verilog 就遇到瓶頸
題目是這樣子
將L四個4-bits的加法器在FPGA上實作,使用Nexys4開發板上從右到左每四個
Switches當作一個input,當按下Button(BTNC),就會將加法器四個input相加結果以binary
形式更新到LEDs上,相加結果以6-bits來表示
`timescale 1ns / 1ps
module top(
input CLK100MHZ,//clk
input [15:0]SW,
input BTNC,
output [5:0]LED
);
wire [3:0] a, b, c, d;
wire [5:0] sum;
assign a = SW[3:0];
assign b = SW[7:4];
assign c = SW[11:8];
assign d = SW[15:12];
assign LED = sum ;
endmodule
請問版上各位大大可以給我點提示那個按鈕該怎麼處理?
------------------------
之後改這樣但跑不動
`timescale 1ns / 1ps
module top(
input CLK100MHZ,//clk
input [15:0]SW,
input BTNC,
output [5:0]LED
);
wire [3:0] a, b, c, d;
wire [5:0] sum;
assign a = SW[3:0];
assign b = SW[7:4];
assign c = SW[11:8];
assign d = SW[15:12];
/*****your design******/
reg s [5:0];
assign sum = a+b+c+d;
always @(posedge BTNC)begin
s = sum;
end
assign LED = s;
/**********************/
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.39.208.237 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Electronics/M.1631946827.A.552.html
※ 編輯: tcbt32 (42.75.81.109 臺灣), 09/18/2021 14:34:57
推
09/18 15:10,
2年前
, 1F
09/18 15:10, 1F
可以再多給一點提示嗎?
reg [5:0] sum1;
always @(postdge CLK100MHZ or postdge BTNC )begin
sum1 = a+b+c+d;
end
assign sum =sum;
assign LED = sum1;
不太確定應該要怎麼寫
※ 編輯: tcbt32 (114.39.208.237 臺灣), 09/18/2021 16:05:34
※ 編輯: tcbt32 (42.75.81.109 臺灣), 09/18/2021 16:27:35
推
09/18 19:08,
2年前
, 2F
09/18 19:08, 2F
→
09/18 19:09,
2年前
, 3F
09/18 19:09, 3F
→
09/18 19:15,
2年前
, 4F
09/18 19:15, 4F
→
09/18 19:15,
2年前
, 5F
09/18 19:15, 5F
※ 編輯: tcbt32 (114.39.208.237 臺灣), 09/18/2021 19:47:05