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
-
ERROR:Xst:2070 - If you are attempting to describe a dual-port block RAM with two separate write ports for signal <mem>, please use a shared variable instead. Coding guidelines are provided in the user manual.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
-
Mô phỏng thì lại được ??? cũng hơi là nhỉ em làm trên ISENguyê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
đây là testbenchCode:---------------------------------------------------------------------------------- -- 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
-
bởi Nexus 6Pe dùng KiCad 9.0 và đã xuất được file PDF mạch in gòi bác...
-
Channel: Điện tử công suất
hôm nay, 16:25 -
-
bởi bqvietBấm chuột vào các tệp sẽ bật ra chương trình tương ứng. Nên dùng bản KiCAD sau
https://kicad-downloads.s3.cern.ch/a...ll_version.exe-
Channel: Điện tử công suất
hôm nay, 14:57 -
-
bởi Nexus 6Pe cài KiCAD 2012 khi mở ra nó chỉ hiện ntn...
-
Channel: Điện tử công suất
hôm nay, 11:20 -
-
bởi bqvietThực tế bạn nào không tải được tệp nén thiết kế thì căn cứ theo ảnh sơ đồ mạch có thể vẽ lại sơ đồ bằng chương trình EDA nào đó rồi làm mạch được mà. Càng thêm quen thuộc với sơ đồ. Sau đó tùy ý chuyển sang TinySwitch-III hoặc TinySwitch-4.
-
Channel: Điện tử công suất
Hôm qua, 21:13 -
-
bởi Nexus 6PCó ai có bản in của mạch in không, cho em xin file để đi in với ạ
-
Channel: Điện tử công suất
Hôm qua, 14:37 -
-
bởi Nexus 6PLink hư rồi ạ, xin lại link của bản thiết kế cũ ạ...
-
Channel: Điện tử công suất
Hôm qua, 10:48 -
-
Trả lời cho Yêu thơ mê nhạc, mời các bác vào đây!bởi dinhthuong92Dạ, cảm ơn bác đã nghe qua và có lời khích lệ cháu ạ.
Thật lòng cháu không dám nhận hai danh hiệu Kỹ sư và Nhạc sĩ đâu ạ, vì phải thật hiểu sâu nắm vững cơ, chứ thực lực cháu đây chỉ là biết chút ít thôi à. Về phần...-
Channel: Tâm tình dân kỹ thuật
29-01-2026, 11:58 -
-
Trả lời cho Có mạch sạc nlmt nào có mppt không các bácbởi bqvietĐơn giản thì có trải nghiệm này
http://www.dientuvietnam.net/forums/...ch%C3%AA%CC%81
Chỉ phần cứng,...-
Channel: Điện tử công suất
27-01-2026, 21:32 -
-
Trả lời cho Có mạch sạc nlmt nào có mppt không các bácbởi Nexus 6Pphức tạp quá, nếu mà có mạch làm sẵn thì ngon, e dùng 2 tấm pv loại 18v 55w thôi bác
-
Channel: Điện tử công suất
26-01-2026, 08:52 -
-
Trả lời cho Có mạch sạc nlmt nào có mppt không các bácbởi Nexus 6Pcảm ơn bác nhiều nha, để e nghiên cứu
-
Channel: Điện tử công suất
26-01-2026, 07:38 -

Comment