اطلاعیه

Collapse
No announcement yet.

طراحی مدار

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

    طراحی مدار

    سلام
    ممنون میشم کمکم کنید
    1- با استفاده از مقایسه کننده تک بیتی مقایسه کننده 2 بیتی طراحی کنید؟
    و سو ال دوم طراحی مقایسه کننده 7 بیتی
    با تشکر

    #2
    پاسخ : طراحی مدار

    نوشته اصلی توسط ashkanzx1
    سلام
    ممنون میشم کمکم کنید
    1- با استفاده از مقایسه کننده تک بیتی مقایسه کننده 2 بیتی طراحی کنید؟
    و سو ال دوم طراحی مقایسه کننده 7 بیتی
    با تشکر
    این کد VHDL برای مقایسه کننده های ۲، ۴، ۸، ۱۶ و ۳۲ بیتیه
    توی نرم افزار بزنی مدارش رو هم نشونت میده اگر هم VHDL بلد باشی که میفهمی چطور کار میکنه
    کد:
    library ieee;
    use ieee.std_logic_1164.all;
    entity comparator2 is
    	generic(n:natural:=2);
    	port(
    			x, y : in std_logic_vector(n - 1 downto 0);
    --			X is bigger, Equal, X is less respectively
    			xb, e, xl : out std_logic
    		);
    end comparator2;
    
    library ieee;
    use ieee.std_logic_1164.all;
    entity comparator4 is
    	generic(n:natural:=4);
    	port(
    			x, y : in std_logic_vector(n - 1 downto 0);
    			xb, e, xl : out std_logic
    		);
    end comparator4;
    
    library ieee;
    use ieee.std_logic_1164.all;
    entity comparator8 is
    	generic(n:natural:=8);
    	port(
    			x, y : in std_logic_vector(n - 1 downto 0);
    			xb, e, xl : out std_logic
    		);
    end comparator8;
    
    library ieee;
    use ieee.std_logic_1164.all;
    entity comparator16 is
    	generic(n:natural:=16);
    	port(
    			x, y : in std_logic_vector(n - 1 downto 0);
    			xb, e, xl : out std_logic
    		);
    end comparator16;
    
    library ieee;
    use ieee.std_logic_1164.all;
    entity comparator32 is
    	generic(n:natural:=32);
    	port(
    			x, y : in std_logic_vector(n - 1 downto 0);
    			xb, e, xl : out std_logic
    		);
    end comparator32;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    architecture simple of comparator2 is
    
    	signal xn, yn : std_logic_vector(n - 1 downto 0);
    	signal xbs, es : std_logic;
    
    begin
    	xn(1) <= not x(1);
    	xn(0) <= not x(0);
    	yn(1) <= not y(1);
    	yn(0) <= not y(0);
    
    	xbs <= (x(1) and yn(1)) or (x(0) and yn(1) and yn(0)) or (x(1) and x(0) and yn(0));
    	es <= (x(1) xnor y(1)) and (x(0) xnor y(0));
    	xl <= (not xbs) and (not es);
    
    	xb <= xbs;
    	e <= es;
    
    end simple;
    
    
    architecture simple of comparator4 is
    	component comparator2 is
    		generic(n:natural:=2);
    		port(
    				x, y : in std_logic_vector(n - 1 downto 0);
    				xb, e, xl : out std_logic
    			);
    	end component;
    	for all : comparator2 use entity work.comparator2(simple);
    
    	signal xb1, xb0, e1, e0 : std_logic;
    	signal xbs, es : std_logic;
    begin
    
    	comp00 : comparator2 port map(x(n / 2 - 1 downto 0), y(n / 2 - 1 downto 0), xb0, e0, open);
    	comp01 : comparator2 port map(x(n - 1 downto n / 2), y(n - 1 downto n / 2), xb1, e1, open);
    
    	xbs <= xb1 or (e1 and xb0);
    	es <= e1 and e0;
    	xl <= (not xbs) and (not es);
    
    	xb <= xbs;
    	e <= es;
    
    end simple;
    
    architecture simple of comparator8 is
    	component comparator4 is
    		generic(n:natural:=4);
    		port(
    				x, y : in std_logic_vector(n - 1 downto 0);
    				xb, e, xl : out std_logic
    			);
    	end component;
    	for all : comparator4 use entity work.comparator4(simple);
    
    	signal xb1, xb0, e1, e0 : std_logic;
    	signal xbs, es : std_logic;
    begin
    
    	comp00 : comparator4 port map(x(n / 2 - 1 downto 0), y(n / 2 - 1 downto 0), xb0, e0, open);
    	comp01 : comparator4 port map(x(n - 1 downto n / 2), y(n - 1 downto n / 2), xb1, e1, open);
    
    	xbs <= xb1 or (e1 and xb0);
    	es <= e1 and e0;
    	xl <= (not xbs) and (not es);
    
    	xb <= xbs;
    	e <= es;
    
    end simple;
    
    architecture simple of comparator16 is
    	component comparator8 is
    		generic(n:natural:=8);
    		port(
    				x, y : in std_logic_vector(n - 1 downto 0);
    				xb, e, xl : out std_logic
    			);
    	end component;
    	for all : comparator8 use entity work.comparator8(simple);
    
    	signal xb1, xb0, e1, e0 : std_logic;
    	signal xbs, es : std_logic;
    begin
    
    	comp00 : comparator8 port map(x(n / 2 - 1 downto 0), y(n / 2 - 1 downto 0), xb0, e0, open);
    	comp01 : comparator8 port map(x(n - 1 downto n / 2), y(n - 1 downto n / 2), xb1, e1, open);
    
    	xbs <= xb1 or (e1 and xb0);
    	es <= e1 and e0;
    	xl <= (not xbs) and (not es);
    
    	xb <= xbs;
    	e <= es;
    
    end simple;
    
    architecture simple of comparator32 is
    	component comparator16 is
    		generic(n:natural:=16);
    		port(
    				x, y : in std_logic_vector(n - 1 downto 0);
    				xb, e, xl : out std_logic
    			);
    	end component;
    	for all : comparator16 use entity work.comparator16(simple);
    
    	signal xb1, xb0, e1, e0 : std_logic;
    	signal xbs, es : std_logic;
    begin
    
    	comp00 : comparator16 port map(x(n / 2 - 1 downto 0), y(n / 2 - 1 downto 0), xb0, e0, open);
    	comp01 : comparator16 port map(x(n - 1 downto n / 2), y(n - 1 downto n / 2), xb1, e1, open);
    
    	xbs <= xb1 or (e1 and xb0);
    	es <= e1 and e0;
    	xl <= (not xbs) and (not es);
    
    	xb <= xbs;
    	e <= es;
    
    end simple;

    دیدگاه


      #3
      پاسخ : طراحی مدار

      دوستان سلام
      واسه ساختن cpu 16 بیتی در نرم افزار ماکس پلاس چطوری باید ثبات 16 بیتی رو آورد؟ ممنون

      دیدگاه

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