在您的乘数过程中,您正在使用一些奇怪的异步启用:
elsif en ='1'然后tempA tempB
完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛扫一扫,分享给好友
|
我在下面有这个代码,我无法确定我是否在我的端口图上做了正确的事情。
我得到的是我的res的“00000000”输出。 我使用的组件正常运行。 请帮我修复我的代码。 谢谢。 库IEEE;使用IEEE.STD_LOGIC_1164.ALL;使用IEEE.STD_LOGIC_ARITH.ALL;使用IEEE.STD_LOGIC_UNSIGNED.ALL; ----如果在此代码中实例化----任何Xilinx原语,则取消注释以下库声明.-- library UNISIM ; - 使用UNISIM.VComponents.all;实体乘数为Port(clk:在STD_LOGIC中; rst:在STD_LOGIC中; en:在STD_LOGIC中; opA:在STD_LOGIC_VECTOR中(3 downto 0); opB:在STD_LOGIC_VECTOR中(3 downto 0); res:out STD_LOGIC_VECTOR(7 downto 0); done:out STD_LOGIC); end multiplier;架构乘数的行为号码:STD_LOGIC_VECTOR(3 downto 0):=“0001”;信号tempA:STD_LOGIC_VECTOR(3 downto 0);信号tempB :STD_LOGIC_VECTOR(3 downto 0);信号tempC:STD_LOGIC_VECTOR(3 downto 0);信号tempD:STD_LOGIC_VECTOR(3 downto 0);信号tempE:STD_LOGIC; COMPONENT clahead_addr PORT(clk:IN std_logic; operandA:IN std_logic_vector(3 downto 0) ); operandB:IN std_logic_vector(3 downto 0); carry_in:IN std_logic; sum:OUT std_logic_vector(3 downto 0); carry_out:OUT std_logic); 结束组成部分; COMPONENT移位器PORT(clk:IN std_logic; rst:IN std_logic; op1:IN std_logic_vector(3 downto 0); op2:IN std_logic_vector(3 downto 0); din:IN std_logic; out1:OUT std_logic_vector(3 downto 0); out2 :OUT std_logic_vector(3 downto 0)); 结束组成部分; --Inputs SIGNAL operand1:std_logic_vector(3 downto 0); SIGNAL operand2:std_logic_vector(3 downto 0); SIGNAL done1:std_logic; - 输出SIGNAL sum:std_logic_vector(3 downto 0); SIGNAL carry_out1:std_logic; SIGNAL carry_out2:std_logic; SIGNAL outA:std_logic_vector(3 downto 0); SIGNAL outB:std_logic_vector(3 downto 0); begin uut1:clahead_addr PORT MAP(clk => clk,operandA => operand1,operandB => operand2,carry_in =>'0',sum => sum,carry_out => carry_out1); uut2:移位器端口映射(clk => clk,rst => rst,op1 => sum,op2 => tempB,out1 => outA,out2 => outB,din => carry_out1);进程(rst,en,clk, tempB,number,tempA,outA,outB)如果rst ='1'则开始,然后res operand1 operand2 tempA tempB tempC tempD tempE elsif en ='1'然后tempA tempB elsif clk'event和clk ='1'然后如果tempB(0) )='1'和数字=“0001”然后操作数2操作数1 tempB数字elsif tempB(0)='1'和数字=“0010”然后操作数2操作数1 tempB数字elsif tempB(0)='1'和数字=“0100 “然后operand2 operand1 tempB number elsif tempB(0)='1'和number =”1000“then operand2 operand1 tempB number elsif tempB(0)='0'且number =”0001“then operand2 operand1 tempB number elsif tempB(0 )='0'和数字=“0010”然后操作数2操作数1 tempB数字elsif tempB(0)='0'和数字=“0100”然后操作数2操作数1 tempB数字elsif tempB(0)='0'和数字=“1000 “然后操作数2操作数1 tempB数字elsif数=”0000“然后res(7)res(3)数字结束if; 万一; 结束过程;结束行为; 消息adrialex于08-09-2009 12:38 AM编辑 以上来自于谷歌翻译 以下为原文 I have this code below and i can't determine whether or not i did the right thing on my portmaps. All i get is a "00000000" output for my res. The components that I used are functioning right. Pls help me fix my code. Thank You. library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; ---- Uncomment the following library declaration if instantiating ---- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity multiplier is Port ( clk : in STD_LOGIC; rst : in STD_LOGIC; en : in STD_LOGIC; opA : in STD_LOGIC_VECTOR (3 downto 0); opB : in STD_LOGIC_VECTOR (3 downto 0); res : out STD_LOGIC_VECTOR (7 downto 0); done : out STD_LOGIC); end multiplier; architecture Behavioral of multiplier is signal number : STD_LOGIC_VECTOR (3 downto 0) := "0001"; signal tempA : STD_LOGIC_VECTOR (3 downto 0); signal tempB : STD_LOGIC_VECTOR (3 downto 0); signal tempC : STD_LOGIC_VECTOR (3 downto 0); signal tempD : STD_LOGIC_VECTOR (3 downto 0); signal tempE : STD_LOGIC; COMPONENT clahead_addr PORT( clk : IN std_logic; operandA : IN std_logic_vector(3 downto 0); operandB : IN std_logic_vector(3 downto 0); carry_in : IN std_logic; sum : OUT std_logic_vector(3 downto 0); carry_out : OUT std_logic ); END COMPONENT; COMPONENT shifter PORT( clk : IN std_logic; rst : IN std_logic; op1 : IN std_logic_vector(3 downto 0); op2 : IN std_logic_vector(3 downto 0); din : IN std_logic; out1 : OUT std_logic_vector(3 downto 0); out2 : OUT std_logic_vector(3 downto 0) ); END COMPONENT; --Inputs SIGNAL operand1 : std_logic_vector(3 downto 0); SIGNAL operand2 : std_logic_vector(3 downto 0); SIGNAL done1 : std_logic; --Outputs SIGNAL sum : std_logic_vector(3 downto 0); SIGNAL carry_out1 : std_logic; SIGNAL carry_out2 : std_logic; SIGNAL outA : std_logic_vector(3 downto 0); SIGNAL outB : std_logic_vector(3 downto 0); begin uut1: clahead_addr PORT MAP( clk => clk, operandA => operand1, operandB => operand2, carry_in => '0', sum => sum, carry_out => carry_out1 ); uut2: shifter PORT MAP( clk => clk, rst => rst, op1 => sum, op2 => tempB, out1 => outA, out2 => outB, din => carry_out1 ); process (rst, en, clk, tempB, number, tempA, outA, outB) begin if rst = '1' then res <= "00000000"; operand1 <= "0000"; operand2 <= "0000"; tempA <= "0000"; tempB <= "0000"; tempC <= "0000"; tempD <= "0000"; tempE <= '0'; elsif en = '1' then tempA <= opA; tempB <= opB; elsif clk'event and clk = '1' then if tempB(0) = '1' and number = "0001" then operand2 <= tempA; operand1 <= outA; tempB <= outB; number <= "0010"; elsif tempB(0) = '1' and number = "0010" then operand2 <= tempA; operand1 <= outA; tempB <= outB; number <= "0100"; elsif tempB(0) = '1' and number = "0100" then operand2 <= tempA; operand1 <= outA; tempB <= outB; number <= "1000"; elsif tempB(0) = '1' and number = "1000" then operand2 <= tempA; operand1 <= outA; tempB <= outB; number <= "0000"; elsif tempB(0) = '0' and number = "0001" then operand2 <= "0000"; operand1 <= outA; tempB <= outB; number <= "0010"; elsif tempB(0) = '0' and number = "0010" then operand2 <= "0000"; operand1 <= outA; tempB <= outB; number <= "0100"; elsif tempB(0) = '0' and number = "0100" then operand2 <= "0000"; operand1 <= outA; tempB <= outB; number <= "1000"; elsif tempB(0) = '0' and number = "1000" then operand2 <= "0000"; operand1 <= outA; tempB <= outB; number <= "0000"; elsif number = "0000" then res(7) <= operand1(3); res(6) <= operand1(2); res(5) <= operand1(1); res(4) <= operand1(0); res(3) <= tempB(3); res(2) <= tempB(2); res(1) <= tempB(1); res(0) <= tempB(0); number <= "0001"; end if; end if; end process; end Behavioral; Message Edited by adrialex on 08-09-2009 12:38 AM |
|
相关推荐
3个回答
|
|
|
嗨adrialex,
在您的乘数过程中,您正在使用一些奇怪的异步启用: elsif en ='1'然后tempA tempB |
|
|
|
|
|
我在我的测试台上使用我的en进行了适当的信号处理。
我无法弄清楚为什么我的输出始终为0.我的rst在一个时钟周期后回到0并且在我的rst变为0之后我的en变为1并且在一个时钟周期之后返回到0。 请帮助我。 谢谢 以上来自于谷歌翻译 以下为原文 I have proper signal handling using my en in my test bench. I can't figure out why my output is always 0. My rst goes back to 0 after one clock cycle and my en goes to 1 after my rst becomes 0 and goes back to 0 after one clock cycle. Pls help me. Thank You |
|
|
|
|
|
adrialex写道:我在我的测试台上使用我的en进行了正确的信号处理。
我无法弄清楚为什么我的输出始终为0.我的rst在一个时钟周期后回到0并且在我的rst变为0之后我的en变为1并且在一个时钟周期之后返回到0。 请帮助我。 谢谢当然,您的代码将正确模拟,因为您的流程中的构造是合法的VHDL。 但是,您的代码推断异步复位(如果rst ='1'然后....)以及异步加载(elsif en ='1'则...)。 FPGA体系结构不支持异步加载,如果您返回并查看综合报告,您应该看到一些关于此问题的投诉,如果不是完全错误消息的话。 也: 在同步过程中,应该在灵敏度列表上的ONLY信号是时钟和异步复位。 没有其他的。 无论如何,很明显为什么你的res输出始终保持为零 - 我假设你的测试平台断言异步复位,它清除res,operand1和operand2以及tempX信号。 请注意,您的代码未明确重置信号编号(也未声明),因此其模拟中的值将为“U”,因此if / elsif语句都不会匹配,因此不会对任何内容进行任何新的分配。 当你断言en时,唯一发生的事情是对tempA和tempB的两个赋值。 当然没有声明opA和opB的声明,所以假设将发出另一个编译器投诉。 -一个 ----------------------------是的,我这样做是为了谋生。 以上来自于谷歌翻译 以下为原文 adrialex wrote: Of course your code will simulate correctly, as the construct in your process is legal VHDL. However, your code infers both an asynchronous reset (if rst = '1' then ....) as a well as an asynchronous load (elsif en = '1' then ...). The FPGA architecture does not support an asynchronous load, and if you go back and look at your synthesis report, you should see some complaints about this, if not outright error messages. ALSO: In a synchronous process, the ONLY signals that should be on the sensitivity list are the clock and the asynchronous reset. Nothing else. Anyways, it is obvious why your res output remains zero all the time -- I assume that your test bench asserts the asynchronous reset, which clears res, operand1 and operand2 as well as the tempX signals. Note that your code does NOT explicitly reset the signal number (which isn't declared, either) so its value in simulation will be "U", so none of the if/elsif statements will match and therefore no new assignments to anything occur. When you DO assert en, the only things that happens are the two assignments to tempA and tempB. Of course there is no declaration of the signals opA and opB, so one assumes another compiler complaint will be issued. -a ----------------------------Yes, I do this for a living. |
|
|
|
|
只有小组成员才能发言,加入小组>>
3142 浏览 7 评论
3436 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2897 浏览 9 评论
4097 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
3082 浏览 15 评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
1359浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
1197浏览 1评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-12 23:25 , Processed in 2.011100 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
995
