EDA五位乘法器

2023-01-20 00:57:04 字數 4318 閱讀 8449

創新精神和實踐能力二者之中,實踐能力是基礎和根本。這是由於創新基於實踐、源於實踐,實踐出真知,實踐檢驗真理。實踐活動是創新的源泉,也是人才成長的必由之路。

通過課程設計的鍛鍊,要求學生掌握電路的一般設計方法,具備初步的獨立設計能力,提高綜合運用所學的理論知識獨立分析和解決問題的能力,培養學生的創新精神。

設計乙個兩個5位數相乘的乘法器。用發光二極體顯示輸入數值,用7段顯示器顯示十進位制結果。乘數和被乘數分兩次輸入。

在輸入乘數和被乘數時,要求顯示十進位制輸入資料。輸入顯示和計算結果顯示,採用分時顯示方式進行,可參見計算器的顯示功能。

3.基本原理

利用單獨按鍵通過高低訊號控制輸入乘數,被乘數以及顯示結果。與此同時將符號位分離並單獨運算得出輸出結果的符號,而乘數和被乘數數值部分通過乘法運算得出8位二進位制數,再通過二進位制轉十進位制運算將個十百位分別傳給數碼管前的解碼器,控制數碼管顯示數字,而且將符號位也通過專用數碼解碼器編譯,從而顯示出乘法的各個資料。

4.電路設計

4.1整體電路圖

24.2輸入選擇模組

vhdl語言如下

library ieee;

useentity shuruxuanze is

port

(a: in std_logic_vector(4 downto 0);

chengshu: in std_logic;

beichengshu: in std_logic;

x,y: out std_logic_vector(3 downto 0);

fx,fy:out std_logic

);end shuruxuanze;

architecture a of shuruxuanze is

begin

process(chengshu,a,beichengshu)

begin

if(chengshu='1' and beichengshu='0' ) then

x(3 downto 0)<=a(3 downto 0);

fx<=a(4);

end if;

if(chengshu='0' and beichengshu='1') then

y(3 downto 0)<=a(3 downto 0);

fy<=a(4);

end if;

end process;

end a;

波形**結果如下

34.3乘法模組(實現兩個4位二進位制數的乘法運算)

vhdl語言如下

library ieee;

useuseentity mul4 is

port(x,y:in std_logic_vector(3 downto 0);

p :out std_logic_vector(7 downto 0));

end mul4;

architecture a of mul4 is

signal temp1: std_logic_vector(3 downto 0);

signal temp2: std_logic_vector(4 downto 0);

signal te***: std_logic_vector(5 downto 0);

signal temp4: std_logic_vector(6 downto 0);

begin

temp1<=x when y(0)='1' else "0000";

temp2<=(x & '0') when y(1)='1' else "00000";

te***<=(x & "00") when y(2)='1' else "000000";

temp4<=(x & "000") when y(3)='1' else "0000000";

p<=temp1+temp2+te***+temp4;

end;

波形**如下

44.4輸入位數轉換(將輸入數值的4位二進位制轉換成等值的8位)

vhdl語言如下

library ieee;

useentity shuru1 is

port(a: in std_logic_vector(3 downto 0);

x: out std_logic_vector(7 downto 0));

end shuru1;

architecture act of shuru1 is

begin

x<= "0000"&a(3 downto 0);

end act;

波形**如下

54.5符號位運算模組

vhdl語言如下

library ieee;

useentity fuhaowei is

port(a,b:in std_logic;

s: out std_logic);

end fuhaowei;

architecture a of fuhaowei is

begin

process(a,b)

begin

s<=a xor b;

end process;

end a;

波形**如下

4.6顯示選擇模組(對乘數、被乘數、結果分別選擇,並將其傳送到數碼管的解碼器中)

6vhdl語言如下

library ieee;

useentity xianshixz is

port(k1,k2,k3:in std_logic_vector(7 downto 0);

rst,chenghao,denghao: in std_logic;

out1: out std_logic_vector(7 downto 0);

clk: in std_logic);

end xianshixz;

architecture act of xianshixz is

begin

process(rst,chenghao,clk,denghao)

begin

if(clk'event and clk='1') then

if(rst='1') then

out1<="00000000";

else

if(chenghao='1' and denghao='0') then

out1<=k1;

elsif(denghao='1' and chenghao ='0') then

out1<=k2;

else out1<=k3;

end if;

end if;

end if;

end process;

end act;

波形**如下

74.7二進位制轉十進位制模組(將傳送來的8位二進位制轉換成3位十進位制數,並將每位傳送給數碼管的解碼器)

verielog語言如下

module zhuanzhi(clk,db,q1,q2,q3);

input clk;

input[7:0] db;

output [3:0] q1,q2,q3;

reg [3:0] a1,a2,a3,q1,q2,q3;

reg [7:0] ldb;

reg [2:0] step;

always@(posedge clk)

begin

case(step)

0: begin

ldb[7:0]<=db;

step<=1;

a1<=0;

a2<=0;

a3<=0;

end1: begin

if(ldb>=100)

begin

a3<=a3+1;

ldb<=ldb-100;

8 end

else if((ldb>=10)&&(ldb<100))

begin

a2<=a2+1;

ldb<=ldb-10;

endelse if((ldb>=1)&&(ldb<10))

begin

a1<=ldb;

ldb<=0;

endelse

begin

step<=2;

endend2:begin

q1<=a1;

q2<=a2;

q3<=a3;

step<=0;

enddefault:step<=0;

endcase

endendmodule

波形**結果如下所示

94.8數值部分數碼管解碼模組

vhdl語言如下

library ieee;

useuse

EDA 模擬乘法器

摘要multisim是美國國家儀器 ni 推出的以windows為基礎的 工具,適用於板級的模擬 數字電路板的設計工作。它包含了電路原理圖的圖形輸入 電路硬體描述語言輸入方式,具有豐富的 分析能力。模擬乘法器是一種完成兩個模擬訊號 電壓或電流 相乘作用的電子器件。它具有兩個輸入端對和乙個輸出端對,是...

EDA1位全加器

課程名稱 eda技術與fpga應用設計 實驗專案 1位全加器 2012年 6 月 22 日 1 實驗目的 1 熟悉ispdesignexpert system quartus原理圖設計流程的全過程。2 學習簡單組合電路的設計方法 輸入步驟。3 學習層次化設計步驟。4 學習eda設計的 和硬體測試方法...

二位數乘法速算總匯

1 兩位數的十位相同的,而箇位的兩數則是相補的 相加等於10 如 78 72 37 33 56 54 43 47 28 22 46 44 1 分別取兩個數的第一位,而後乙個的要加上一以後,相乘。2 兩個數的尾數相乘,不滿十,十位添作0 78 72 5616 37 33 1221 56 54 3024...