Ctrinh mô phỏng không báo lỗi đâu, bạn thử đi
Thông báo
Collapse
No announcement yet.
thiết kê FIFO dựa trên synch dual port ram
Collapse
X
-
Nguyên văn bởi jefflieu Xem bài viếtCtrinh mô phỏng không báo lỗi đâu, bạn thử đi
-->
Tình hình là thế này, nếu viết độc lập code của em viết trong 1 project thì nó hiện ra lỗi này, còn nếu viết trong 1 project mà nó không phải thành phần chính , tức là cái project này là cho cái code trên mạng kia, nhưng em tạo thêm 1 cái new source nữa và dán code do em viết ra( em có thói quen là nhưng cái nào gần giống nhau, kiểm ram như thế này thì em cho vào 1 project) thì khi tổng hợp lại không bị lỗi ????Last edited by boyzzun; 19-06-2014, 16:11.
Comment
-
Trong 2 processes:
always@(posedge clk)
begin
if(ce1='1')
A <= B&C;
end
always@(posedge clk)
begin
if(ce2='1')
A <= D & F;
end
Ở cái process 1, sẽ sinh ra 1 Flip-flop (thành phần cơ bản tren FPGA), cổng CE của Flop sẽ nối với cổng ce1, cổng D nối với đầu ra của cổng AND = B & C.
Ở cái process 2, sẽ sinh ra 1 flip-flop, cổng CE nối với ce2, ...v.v
Mà bạn cho 2 Flip flop này cùng 1 tên A, nên nó bị chỏi ... không synthesize được ...
Bạn search "HDL Coding Guidelines Xilinx" rồi đọc tài liệu ...
Comment
-
Nguyên văn bởi jefflieu Xem bài viếtBạn mô phỏng nó đi (dùng Xilinx ISIM hoặc Altera ModelSim)
ak còn cái này nữa là cái fifo mà có sử dụng bộ đếm để tạo ra tín hiệu full hay empty ý, thì cái bộ đếm em tạo ra lại là 1 bộ đếm thông thường dạng tuần hoàn, tức là nó cứ đếm từ 0 tới max rồi lại về 0 rồi đến max, cứ như thế thành ra là không đúng, em đang nghĩ đến việc tạo 1 bộ đếm mà nó chỉ đếm 1 lần (từ 0 đến max rồi không quay về 0 nữa) thì không biết phải làm thế nào
đây là code fifo
Code:---------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 11:14:20 06/19/2014 -- Design Name: -- Module Name: dual_ram2 - Behavioral -- Project Name: -- Target Devices: -- Tool versions: -- Description: -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- ---------------------------------------------------------------------------------- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use ieee.std_logic_unsigned.all; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --use IEEE.NUMERIC_STD.ALL; -- Uncomment the following library declaration if instantiating -- any Xilinx primitives in this code. --library UNISIM; --use UNISIM.VComponents.all; entity dual_ram2 is generic ( addr_ram : integer:=4); port ( clk : in std_logic; addra : in std_logic_vector(3 downto 0); addrb : in std_logic_vector(3 downto 0); data_a : in std_logic_vector(7 downto 0); data_b : in std_logic_vector( 7 downto 0); data_a_out : out std_logic_vector(7 downto 0); data_b_out : out std_logic_vector(7 downto 0); ena : in std_logic; enb : in std_logic; re : in std_logic; wr : in std_logic); end dual_ram2; architecture Behavioral of dual_ram2 is constant ram_depth:integer:=2**addr_ram ; type ram is array(integer range<>) of std_logic_vector(7 downto 0); signal mem : ram( 0 to ram_depth-1); begin process(clk,wr) begin if rising_edge(clk) then if wr='1' and ena='1' then mem(conv_integer(addra))<=data_a; end if; end if; end process; process(clk,re) begin if rising_edge(clk) then if re='1' and enb='1' then data_b_out<=mem(conv_integer(addrb)); end if; end if; end process; end Behavioral; library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity fifo_dual is port ( clk : in std_logic; wr : in std_logic; re : in std_logic; data_in : in std_logic_vector(7 downto 0); data_out : out std_logic_vector(7 downto 0); fifo_full: out std_logic; fifo_empty : out std_logic); end fifo_dual; architecture fpga of fifo_dual is signal c : std_logic_vector(3 downto 0):="0000"; signal we : std_logic; signal rd :std_logic; signal addra : std_logic_vector(3 downto 0):="0000"; signal addrb : std_logic_vector(3 downto 0):="0000"; signal ea : std_logic; signal eb : std_logic; signal full : std_logic; signal empty : std_logic; signal data_inb,data_outb:std_logic_vector(7 downto 0); component dual_ram2 is generic ( addr_ram : integer:=4); port ( clk : in std_logic; addra : in std_logic_vector(3 downto 0); addrb : in std_logic_vector(3 downto 0); data_a : in std_logic_vector(7 downto 0); data_b : in std_logic_vector( 7 downto 0); data_a_out : out std_logic_vector(7 downto 0); data_b_out : out std_logic_vector(7 downto 0); ena : in std_logic; enb : in std_logic; re : in std_logic; wr : in std_logic); end component; begin u1 : dual_ram2 port map (clk=> clk, addra=>addra, addrb=>addrb, data_a=>data_in, data_b=>data_inb, data_a_out=>data_outb, data_b_out=>data_out, ena=>ea, enb=>eb, wr=>wr, re=>re ); full <= '1' when c="1111" else 'Z'; empty <= '1' when c="0000" else 'Z'; fifo_full<=full; fifo_empty<=empty; process(clk,c,addra) begin if rising_edge(clk) then if wr='1' and c="1111" then ea<='0'; else c<=c+1; ea<='1'; addra<=addra+1; end if; if re='1' and c="0000" then eb<='0'; else c<=c-1; eb<='1'; addrb<=addrb+1; end if; end if; end process; --process(clk,c,addrb) -- begin -- if rising_edge(clk) then -- if re='1' then -- if c="0000" then -- eb<='0'; -- else -- c<=c-1; -- eb<='1'; -- end if; -- addrb<=addrb+1; -- end if; -- end if; --end process; end fpga;
Code:-------------------------------------------------------------------------------- -- Company: -- Engineer: -- -- Create Date: 10:24:42 06/21/2014 -- Design Name: -- Module Name: E:/New folder/practice/FIFO_2/FIFO_tb.vhd -- Project Name: FIFO_2 -- Target Device: -- Tool versions: -- Description: -- -- VHDL Test Bench Created by ISE for module: fifo_dual -- -- Dependencies: -- -- Revision: -- Revision 0.01 - File Created -- Additional Comments: -- -- Notes: -- This testbench has been automatically generated using types std_logic and -- std_logic_vector for the ports of the unit under test. Xilinx recommends -- that these types always be used for the top-level I/O of a design in order -- to guarantee that the testbench will bind correctly to the post-implementation -- simulation model. -------------------------------------------------------------------------------- LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.ALL; ENTITY FIFO_tb IS END FIFO_tb; ARCHITECTURE behavior OF FIFO_tb IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT fifo_dual PORT( clk : IN std_logic; wr : IN std_logic; re : IN std_logic; data_in : IN std_logic_vector(7 downto 0); data_out : OUT std_logic_vector(7 downto 0); fifo_full : OUT std_logic; fifo_empty : OUT std_logic ); END COMPONENT; --Inputs signal clk : std_logic := '0'; signal wr : std_logic := '0'; signal re : std_logic := '0'; signal data_in : std_logic_vector(7 downto 0) := (others => '0'); --Outputs signal data_out : std_logic_vector(7 downto 0); signal fifo_full : std_logic; signal fifo_empty : std_logic; -- Clock period definitions constant clk_period : time := 10 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: fifo_dual PORT MAP ( clk => clk, wr => wr, re => re, data_in => data_in, data_out => data_out, fifo_full => fifo_full, fifo_empty => fifo_empty ); -- Clock process definitions clk_process :process begin clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; end process; -- Stimulus process stim_proc: process begin -- hold reset state for 100 ns. wait for clk_period ; wr<='1'; data_in<="00000000"; wait for clk_period; data_in<="00000001"; wait for clk_period; data_in<="00000010"; wait for clk_period; data_in<="00000011"; wait for clk_period; data_in<="00000100"; wait for clk_period; data_in<="00000101"; wait for clk_period; data_in<="00000110"; wait for clk_period; data_in<="00000111"; wait for clk_period; data_in<="00001000"; wait for clk_period; data_in<="00001001"; wait for clk_period; data_in<="00001010"; wait for clk_period; data_in<="00001011"; wait for clk_period; data_in<="00001100"; wait for clk_period; data_in<="00001101"; wait for clk_period; data_in<="00001110"; wait for clk_period; data_in<="00001111"; wait for clk_period; data_in<="11110000"; wait for clk_period; re<='1'; -- insert stimulus here wait; end process; END;
Last edited by boyzzun; 21-06-2014, 17:55.
Comment
Bài viết mới nhất
Collapse
-
Trả lời cho Cần Cao Thủ Giải Bài Tập Lý Thuyết Mạchbởi SangchunhatAi tốt môn này không ạ, hỗ trợ e phát
-
Channel: Hỗ trợ học tập
hôm nay, 09:51 -
-
bởi SangchunhatEm cần cao thủ giỏi giải bài tập đề thi Lý Thuyết Mạch
Bác nào làm được inboxx em với
Có gửi cafe cảm ơn
Xin cảm ơn ạ-
Channel: Hỗ trợ học tập
hôm nay, 08:56 -
-
Trả lời cho Hàn chì thiếc lên nhôm.bởi vi van phamSai bét. Bà í không biết cầm mỏ hàn điện (phải viết to chữ điện), nên tui ra chơi với diễn đàn . Chớ thấy vậy mà chê bai tui.
...
-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 20:54 -
-
Trả lời cho Biết gì nói nấy, cãi chửi thoải máibởi nhathung1101Và mai tôi lại phải bay...
Chỉ mong muốn anh em hiểu: Là đừng làm dối lòng, khiến đàn em nức nở..
Cứ cãi nhau, ra việc lớn. Chứ đừng vì cái "tôi" rồi làm hỏng bọn chúng..
Ai hiểu cứ nói. Ai thấy sai cứ cãi. Kỹ thuật là vậy. Chỉ đúng khi có kết quả.-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 20:37 -
-
Trả lời cho Biết gì nói nấy, cãi chửi thoải máibởi nhathung1101Xin thưa là tôi rất dốt món Ing Lịch. Chỉ là các bạn đưa lên những từ không ai hiểu, nên tôi phải theo.
Chứ ngày xưa được huấn luyện, cũng không như bạn nói đâu, và bạn Mỹ của tôi, hiểu như người nhà.
Bạn học giỏi thì đưa mấy từ lên đây đi, về điện tử thuần túy để anh em nghiên cứu....-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 19:59 -
-
Trả lời cho Biết gì nói nấy, cãi chửi thoải máibởi nhathung1101Tôi "cũng tưởng thế". Nhưng giờ tôi sẽ để họ hiểu "Phổ biến kiến thức đường phố" nó khác thế nào.
Mời bạn theo dõi tiếp....-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 19:53 -
-
Trả lời cho Biết gì nói nấy, cãi chửi thoải máibởi nhathung1101Lão lại quên: Nhất Thủy nhì Hỏa
Hà Nội lụt thì toi cả quần chip....-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 19:49 -
-
Trả lời cho Biết gì nói nấy, cãi chửi thoải máibởi nhathung1101Cứ cãi chửi nhau đi mà...
Nhưng nhớ là vào đây cãi chửi nhau, chứ mấy luồng kỹ thuật bên ngoài thì làm cho đúng.
Ai thích cãi chửi nhau cứ vào đây gặp tôi!-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 19:45 -
-
Trả lời cho Hàn chì thiếc lên nhôm.bởi nhathung1101
Lão lại bị bà í bắt ngủ riêng rồi....
...
-
Channel: Tâm tình dân kỹ thuật
Hôm qua, 19:38 -
-
Trả lời cho Sạc bình acquy 30ahbởi nhathung11014r có luồng "Đánh giá...." sao không đăng???
Đề nghị bqv chuyển luôn. Và xóa bài của tôi luôn cho gọn....-
Channel: Điện tử dành cho người mới bắt đầu
Hôm qua, 19:32 -
Comment