Re: [請益] FPGA(VHDL)實現雙輸入單輸出開關

看板Electronics作者 (神手的同學)時間12年前 (2011/12/15 16:07), 編輯推噓1(1015)
留言16則, 4人參與, 最新討論串2/2 (看更多)
大家好~ 我後來嘗試採用下列的語法來實現電路, library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity mul is port ( sig1, sig2, ck13, ck132 : in std_logic; Output : out std_logic ); end entity mul; architecture Behavioral of mul is signal temp : std_logic_vector(1 downto 0); begin temp<= ck13 & ck132; process(temp) is begin case temp is when "10" => Output <= sig1; when "01" => Output <= sig2; when others => Output <= '0'; end case; end process; end architecture Behavioral; 不過會出現下面的錯誤: Warning (10492): VHDL Process Statement warning at mul.vhd(20): signal "sig1" is read inside the Process Statement but isn't in the Process Statement's sensitivity list Warning (10492): VHDL Process Statement warning at mul.vhd(21): signal "sig2" is read inside the Process Statement but isn't in the Process Statement's sensitivity list 請問大家有什麼建議嗎??~謝謝大家!!!! ※ 引述《c137596 (神手的同學)》之銘言: : 大家好~ : 小弟第一次接觸FPGA,所以很多地方不懂 : 需要實現的電路圖如下面的網址: : http://imageshack.us/photo/my-images/828/ck13.jpg/ : SIGNAL1 和SIGNAL2是輸入的訊號,兩顆MOS是用來當作開關 : CK13 和 CK13-是用開控制開關的訊號,目的是要讓SINGAL1.2 : 分別在CK13 和CK13-輸出到VOUT, : 是使用QUARTUS II作模擬,本來以為用內建的BLOCK就可以兜出來 : 不過後來這個部分沒有 MODEL可以叫,因此要採用VHDL來實現 : 目前我打得語法是: : library ieee; : use ieee.std_logic_1164.all; : entity swich2 is : port(sig1 : in std_logic; : sig2 : in std_logic; : ck13 : in std_logic; : ck132 : in std_logic; : vout : out std_logic); : end swich2; : architecture sig2 of swich2 is : begin : if ck13='1' then : vout<= sig1; : elsif ck132='1' then : vout<= sig2; : else : vout<='0'; : end if; : end sig2; : 請問是否有哪邊有問題呢? : 沒有學過VHDL相關的課程= =~只能對著講義照感覺打@@ : 謝謝囉!!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.114.23.67

12/15 17:05, , 1F
VHDL檢查比較嚴謹. 不影響的.
12/15 17:05, 1F

12/15 17:09, , 2F
請問是否只要不出現ERROR基本上都是OK的呢?謝謝
12/15 17:09, 2F

12/15 22:02, , 3F
不是 但你這一個應該沒問題
12/15 22:02, 3F

12/15 22:02, , 4F
但其實你直接查MUX要怎麼用就好了 XD
12/15 22:02, 4F

12/15 22:03, , 5F
我不太懂你 CASE 132 13為什麼要這樣寫
12/15 22:03, 5F

12/15 22:03, , 6F
這不就是一個inverter的羅輯 ? 如果要實現功能
12/15 22:03, 6F

12/15 22:03, , 7F
其實這些線都不用寫
12/15 22:03, 7F

12/15 22:12, , 8F
原來這個就是MUX阿@@~~哈哈~
12/15 22:12, 8F

12/15 22:12, , 9F
您是說用 CK13 和 not CK13嗎??
12/15 22:12, 9F

12/15 22:13, , 10F
不好意思~~都沒有碰過VHDL@@~~
12/15 22:13, 10F

12/15 23:31, , 11F
不是啊 在判斷句 ...不用input not ck13
12/15 23:31, 11F

12/15 23:32, , 12F
你只要一個input就可以決定誰開誰關了是吧
12/15 23:32, 12F

12/15 23:32, , 13F
1 是一種 0是另一種
12/15 23:32, 13F

12/16 00:01, , 14F
對耶!!!!!~~我都沒發現XDD~謝謝囉!^^
12/16 00:01, 14F

08/13 19:20, , 15F
但其實你直接查MUX要 https://noxiv.com
08/13 19:20, 15F

09/17 23:14, , 16F
其實這些線都不用寫 https://daxiv.com
09/17 23:14, 16F
文章代碼(AID): #1EwQhNK8 (Electronics)
文章代碼(AID): #1EwQhNK8 (Electronics)