完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
例子: 带使能信号和复位信号的加法器,由matlab给输入数据addin,en。 错误: VHDL仿真结果貌似是正确的,但是verilog语言仿真的结果addout应该延时输入的addin一个clk,为什么没有延时呢。!! 1. VHDL语言: LIBRARY ieee; USE ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity test is port ( rst_n : in std_logic; clk : in std_logic; en : in std_logic; addin : in std_logic_vector(11 downto 0); addout : out std_logic_vector (11 downto 0) ); END test; architecture rtl of test is signal add1 : std_logic_vector(11 downto 0); begin process(clk,rst_n) begin if rst_n ='0' then add1<=(others=>'0'); elsifclk'event and clk = '1' then if en = '1' then add1<=addin+'1'; else add1<=add1; endif; end if; end process; addout<=add1; end architecture; 2. Verilog语言 module test (clk, rst_n, addin, en, addout ); input clk; input rst_n; input en; input [11:0] addin; output [11:0] addout; reg [11:0] add1; assign addout=add1; always @ (posedge clk) begin if (!rst_n) begin add1=12'h0; end else if(en) begin add1=addin+1; end end endmodule
|
|
相关推荐
1个回答
|
|
|
这是我给的m文件,即输入的激励:
function [iport,tnext] = test(oport, tnow, portinfo) tnext=[]; iport=struct(); persistent inc; persistent rst; CLK_PERIOD = 1e-8; RST_MUL_TIME = 5; RST_TIME = RST_MUL_TIME * CLK_PERIOD; if isempty(inc) inc=0; iport.addin=dec2bin(0,12); iport.en=dec2bin(0,1); end inc =inc+1; if tnow <= RST_TIME rst = dec2bin(0, 1); inc=[]; else rst = dec2bin(1, 1); end if inc>=10 iport.addin=dec2bin(inc,12); iport.en=dec2bin(1,1); end if 30==mvl2dec(oport.addout) iport.en=dec2bin(0,1); end iport.rst_n=rst; end |
|
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
NVMe高速传输之摆脱XDMA设计50:主要功能测试结果与分析2 nvmePCIe高速存储
252 浏览 0 评论
NVMe高速传输之摆脱XDMA设计49:主要功能测试结果与分析1
1501 浏览 0 评论
907 浏览 0 评论
855 浏览 0 评论
658 浏览 0 评论
4426 浏览 63 评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 03:59 , Processed in 1.412902 second(s), Total 70, Slave 51 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
3382