اطلاعیه

Collapse
No announcement yet.

ایراد شبیه سازی(تست بنچ در ISE)!!

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    ایراد شبیه سازی(تست بنچ در ISE)!!

    این کد زیری قراره این کارو بکنه: پالسی که در ورودی می گیره اگر دوره تناوبش بیشتر از 1ms بود عینا به خروجی منتقل کنه و اگر دوره تناوب ورودی کمتر از 1ms بود موجی با دوره تناوب 1ms به خروجی بده . برنامه تو سنتز error و warning نمیده اما شبیه سازیش درست نیست یعنی وقتی ورودی با دوره تناوب بیشتر از 1ms تو تست بنچ بهش میدم عینا به خروجی نمیده(زمان یک بودن ورودی ام x می شه!) چرااااااااا؟؟؟؟؟؟؟؟؟؟؟ تست بنچ و کد اصلی و عکس شبیه سازی رو گذاشتم.
    [code=vhdl]----------------------------------------------------------------------------------
    -- Company:
    -- Engineer:
    --
    -- Create Date: 1942 06/13/2015
    -- Design Name:
    -- Module Name: limit_s - 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;

    -- 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 limit_s is
    Port ( in1 : inout STD_LOGIC:='0';
    out1 : out STD_LOGIC:='0';
    clk : in STD_LOGIC);
    end limit_s;

    architecture Behavioral of limit_s is
    signal d: std_logic:='0';
    signal flag: std_logic:='0';
    signal cnt : integer range 0 to 50000;
    signal cnt1 : integer range 0 to 25000;

    begin
    process(clk)
    begin
    if (rising_edge(clk))then
    cnt1<=cnt1+1;
    if (cnt1=25000)then
    cnt1<=0;
    d<=not d;
    end if;
    if (in1='1&#039then
    cnt<=cnt+1;
    if(cnt>=25000)then
    flag<='1';
    else
    flag<='0';
    end if;
    end if;
    end if;
    end process;

    process(clk)
    begin
    if (rising_edge(clk))then
    if (flag='1&#039then
    out1<=in1;
    else
    out1<=d;
    end if;
    end if;
    end process;
    end Behavioral;

    [/code]

    و تست بنچ:

    [code=vhdl]--------------------------------------------------------------------------------
    -- Company:
    -- Engineer:
    --
    -- Create Date: 23:32:23 06/13/2015
    -- Design Name:
    -- Module Name: D:/ISE_PROJECTS/speed_limit/speed_limit_tb.vhd
    -- Project Name: speed_limit
    -- Target Device:
    -- Tool versions:
    -- Description:
    --
    -- VHDL Test Bench Created by ISE for module: limit_s
    --
    -- 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 speed_limit_tb IS
    END speed_limit_tb;

    ARCHITECTURE behavior OF speed_limit_tb IS

    -- Component Declaration for the Unit Under Test (UUT)

    COMPONENT limit_s
    PORT(
    in1 : INOUT std_logic:='0';
    out1 : OUT std_logic;
    clk : IN std_logic
    );
    END COMPONENT;


    --Inputs
    signal clk : std_logic := '0';

    --BiDirs
    signal in1 : std_logic;
    signal out1 : std_logic;

    BEGIN

    -- Instantiate the Unit Under Test (UUT)
    uut: limit_s PORT MAP (
    in1 => in1,
    out1 => out1,
    clk => clk
    );

    -- Clock process definitions
    clk_process :process
    begin
    clk <= '0';
    wait for 10 ns;
    clk <= '1';
    wait for 10 ns;
    end process;


    process
    begin
    in1 <= '0';
    wait for 0.6 ms;
    in1 <= '1';
    wait for 0.6 ms;
    end process;


    END;
    [/code]

    #2
    پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

    خوب برنامه ننوشتی. مثلا
    in1 : inout STD_LOGIC:='0';
    یعنی چی؟ چرا in1 رو این جوری تعریف کردی؟ در صورتی که ورودیه؟
    :='0' یعنی چی؟ اصلا معنی نداره.
    مهم نيست که کجايي هستي، چه رنگي هستي، به چه زبوني حرف مي زني. مهم اينه که انسان باشي.
    http://baranelec.mihanblog.com/
    آینده ای خواهم ساخت که گذشته ام در برابرش زانو بزند...

    دیدگاه


      #3
      پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

      برنامه درست:
      فایل VHDL
      کد:
      ----------------------------------------------------------------------------------
      -- Company: 
      -- Engineer: 
      -- 
      -- Create Date:  19:39:42 06/13/2015 
      -- Design Name: 
      -- Module Name:  limit_s - 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;
       
      -- 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 limit_s is
        Port ( in1 : in STD_LOGIC;
            out1 : out STD_LOGIC;
                   clk : in STD_LOGIC);
      end limit_s;
       
      architecture Behavioral of limit_s is
      signal d: std_logic:='0';
      signal flag: std_logic:='0';
      signal cnt : integer range 0 to 50000;
      signal cnt1 : integer range 0 to 25000;
       
      begin
      process(clk)
          begin
          if (rising_edge(clk))then
            cnt1<=cnt1+1;
              if (cnt1=25000)then
               cnt1<=0;
               d<=not d;
              end if;
              if (in1='1')then
                  cnt<=cnt+1;
                  if(cnt>=25000)then
                      flag<='1';           
                      else
                      flag<='0';
                  end if;     
              end if; 
          end if;
      end process;
       
      process(clk)
      begin
      if (rising_edge(clk))then
          if (flag='1')then
              out1<=in1;
              else
              out1<=d;
          end if;
      end if;
      end process;
      end Behavioral;

      برنامه تست بنچ

      کد:
      --------------------------------------------------------------------------------
      -- Company: 
      -- Engineer:
      --
      -- Create Date:  19:39:33 06/24/2015
      -- Design Name:  
      -- Module Name:  D:/cnt_eca/tb_limit_s.vhd
      -- Project Name: cnt_eca
      -- Target Device: 
      -- Tool versions: 
      -- Description:  
      -- 
      -- VHDL Test Bench Created by ISE for module: limit_s
      -- 
      -- 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 tb_limit_s IS
      END tb_limit_s;
       
      ARCHITECTURE behavior OF tb_limit_s IS 
       
        -- Component Declaration for the Unit Under Test (UUT)
       
        COMPONENT limit_s
        PORT(
           in1 : IN std_logic;
           out1 : OUT std_logic;
           clk : IN std_logic
          );
        END COMPONENT;
        
      
        --Inputs
        signal in1 : std_logic := '0';
        signal clk : std_logic := '0';
      
       	--Outputs
        signal out1 : std_logic;
      
        -- Clock period definitions
        constant clk_period : time := 10 ns;
       
      BEGIN
       
      	-- Instantiate the Unit Under Test (UUT)
        uut: limit_s PORT MAP (
           in1 => in1,
           out1 => out1,
           clk => clk
          );
      
        -- 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		
          in1 <= '0';
      		 wait for 0.6 ms;
      		 in1 <= '1';
      		 wait for 0.6 ms;
        end process;
      
      END;
      مهم نيست که کجايي هستي، چه رنگي هستي، به چه زبوني حرف مي زني. مهم اينه که انسان باشي.
      http://baranelec.mihanblog.com/
      آینده ای خواهم ساخت که گذشته ام در برابرش زانو بزند...

      دیدگاه


        #4
        پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

        پروژه در ISE14.4
        cld.persiangig.com/download/Lzwl3L/dl
        تصویر شبیه سازی
        http://cld.persiangig.com/download/W8xnLD/dl
        مهم نيست که کجايي هستي، چه رنگي هستي، به چه زبوني حرف مي زني. مهم اينه که انسان باشي.
        http://baranelec.mihanblog.com/
        آینده ای خواهم ساخت که گذشته ام در برابرش زانو بزند...

        دیدگاه


          #5
          پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

          نوشته اصلی توسط rima3250
          پروژه در ISE14.4
          cld.persiangig.com/download/Lzwl3L/dl
          تصویر شبیه سازی
          http://cld.persiangig.com/download/W8xnLD/dl
          بله بعدا فهمیدم که inout برای این که ورودی بشه باید Z بشه چون من 1 ش میکردم X می شد و این که این جا اصلا نیازی به inout نبود :biggrin:!!!!! (بعد از این که برنامه رو تغییر دادم اینو یادم رفته بود دوباره in کنم!!! )
          ولی حالا مشکل اصلیش نمایان شد!!!
          وقتی تو testbench دوره تناوب بیشتر از 1ms میدم flag یک میشه و همونو به خروجی میده ولی وقتی دوره تناوب کمتر از 1ms می دم flag صفر نمیشه و در نتیجه دوباره ورودی رو به خروجی می ده oo: :redface: چه کار می شود کرد ؟؟؟

          دیدگاه


            #6
            پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

            نوشته اصلی توسط rima3250
            خوب برنامه ننوشتی. مثلا
            in1 : inout STD_LOGIC:='0';
            یعنی چی؟ چرا in1 رو این جوری تعریف کردی؟ در صورتی که ورودیه؟
            :='0' یعنی چی؟ اصلا معنی نداره.
            بله اون نباید inout میشد ! دیگه کجاش ایراد داره؟ چون بازم درست نیست

            دیدگاه


              #7
              پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

              متوجه نشدم برنامه شما چطوری کار می کنه ولی من برنامه رو این جوری می نویسم:
              [code=vhdl]library IEEE;
              use IEEE.STD_LOGIC_1164.ALL;
              use IEEE.STD_LOGIC_UNSIGNED.ALL;

              entity Top is
              Port (
              Clk25M : in STD_LOGIC;
              iIn1 : in STD_LOGIC;
              oOut1 : out STD_LOGIC
              );
              end Top;

              architecture Behavioral of Top is
              signal piIn1 : std_logic := '0';
              signal cnt1ms: integer range 0 to 25000 := 0;
              signal s1ms : std_logic := '0';
              begin
              process(Clk25M)

              begin
              if rising_edge(Clk25M) then
              piIn1 <= iIn1;
              if (piIn1 = '0' AND iIn1 = '1&#039 then
              cnt1ms <= 1;
              end if;
              if (cnt1ms > 0) then
              if (cnt1ms = 25000) then
              cnt1ms <= 0;
              else
              cnt1ms <= cnt1ms + 1;
              end if;
              end if;
              end if;
              end process;

              s1ms <= '1' when (cnt1ms > 0) else '0';

              oOut1 <= iIn1 OR s1ms;

              end Behavioral;[/code]

              یک نکته: مقدار اولیه در قسمت تعریف پورت ها فقط در شبیه سازی تأثیر داره و در عمل موقع سنتز نادیده گرفته میشه.
              لطفاً برای انجام پروژه های دانشجویی پیام خصوصی نفرستید.
              لطفاً سؤالاتی که در انجمن قابل طرح شدن هستند پیام خصوصی نکنید.
              با تمام وجود گناه کرديم اما نه نعمتش را از ما گرفت نه گناهان ما را فاش کرد اطاعتش کنيم چه مي کند؟"دکتر شريعتي"
              اگر جايي که ايستاده ايد را نمي پسنديد، عوضش کنيد شما درخت نيستيد!! "پاسكال"
              يا به اندازه ي آرزوهايت تلاش کن يا به اندازه تلاشت آرزو کن. "شکسپير"

              دیدگاه


                #8
                پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

                سلام کسی برنامه تمام جمع کننده 1بیتی در ISE وتستش رو داره؟

                دیدگاه


                  #9
                  پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

                  نوشته اصلی توسط لیلا.م نمایش پست ها
                  سلام کسی برنامه تمام جمع کننده 1بیتی در ISE وتستش رو داره؟
                  سلام
                  تو لینک زیر چندین روش پیاده سازی full adder به همراه test bench وجود داره.
                  [آموزشی] کنترل رله با پیامک توسط sim800l
                  [آموزشی] راه اندازی سنسورهای DHT11 و DHT22 با کدویژن
                  [آموزشی] مدار عملی اتصال میکروفن خازنی به میکروکنترلر
                  [آموزشی] آموزش نحوه راه اندازی میکروهای fmd
                  صفحه اینستاگرام : ecdco_ir

                  دیدگاه


                    #10
                    پاسخ : ایراد شبیه سازی(تست بنچ در ISE)!!

                    سلام
                    من این برنامه رو نوشتم واسه مدار
                    `timescale 1ns / 1ps

                    module fulladder(
                    input A,
                    input B,
                    input cin,
                    output sum,
                    output cout
                    );
                    assign sum = A^B^cin;
                    assign cout= (A&B)/(A&cin)/(B&cin);
                    endmodule
                    input (S0,S,cin,Sn);
                    output (cout);
                    wire w1, w2;
                    and( w1, S0, S );
                    and( w2, Sn, cin );
                    or( cout, w1, w2 );
                    not (Sn,S);
                    // sum
                    xor( w3, a, b);
                    xor (sum,cin,S);

                    endmodule
                    این Error رو داد
                    ERROR:HDLCompiler:806 - "D:/Xilinx/aaaaaa/fulladder.v" Line 13: Syntax error near "inpu
                    [IMG]f:/IMG-20171020-172244.jpg[/IMG]

                    دیدگاه

                    لطفا صبر کنید...
                    X