Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4564802
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:33:11+00:00 2026-05-21T18:33:11+00:00

how can i convert entity of bloch which takes 4 inputs to 2 inputs?

  • 0

how can i convert entity of bloch which takes 4 inputs to 2 inputs?
http://dl.dropbox.com/u/2879760/sample.PNG
A you see here i use three the same mux 🙁 how to take in etykieta2 only two inputs?
code:

library ieee;
  use ieee.std_logic_1164.all;
  library work; --domyslnie zawieta moj pakiet

  use work.mux_package.all;

  entity glowny is

            generic(
                n : integer := 4;
                k : integer := 2
            );
            port(
                a, b, c, d,e,f,g,h : in std_logic_vector(n-1 downto 0);
                s : in std_logic_vector(1 downto 0);
                t : in std_logic_vector (1 downto 0);
                y, x, z : out std_logic_vector(n-1 downto 0)
            );
        end glowny;

architecture multiplekser of glowny is

signal xx,yy,zz : std_logic_vector(n-1 downto 0); 

    for etykieta: mux use entity work.mux(arch_mux5);
    for etykieta1: mux use entity work.mux(arch_mux6);
    for etykieta2: mux use entity work.mux(arch_mux3);

    begin

    etykieta:
    mux generic map (n=>n) port map (a=> a, b=>b, c=>c, d=>d,s=>s, y=>xx);

    etykieta1:
    mux generic map (n=>n) port map (a=> e, b=>f, c=>g, d=>h,s=>s,y=>yy);

    etykieta2:
    mux generic map (n=>n) port map (a=> yy , b=>yy, c=> xx, d=>xx, s=>t ,y=>zz);



end multiplekser;

packages

    library ieee;
      use ieee.std_logic_1164.all;
        entity mux is

            generic(
                n : integer := 4
            );
            port(
                a, b, c, d : in std_logic_vector(n-1 downto 0);
                s : in std_logic_vector(1 downto 0);
                y : out std_logic_vector(n-1 downto 0)
            );
        end mux;



      -- przypisanie podstawowe - concurrent signal assigment

      architecture arch_mux1 of mux is

        begin

            y(0) <= (a(0) and not(s(1)) and not(s(0)))
                or (b(0) and not(s(1)) and s(0))
                or (c(0) and s(1) and not(s(0)))
                or (d(0) and s(1) and s(0));

            y(1) <= (a(1) and not(s(1)) and not(s(0)))
                or (b(1) and not(s(1)) and s(0))
                or (c(1) and s(1) and not(s(0)))
                or (d(1) and s(1) and s(0));

            y(2) <= (a(2) and not(s(1)) and not(s(0)))
                or (b(2) and not(s(1)) and s(0))
                or (c(2) and s(1) and not(s(0)))
                or (d(2) and s(1) and s(0));

            y(3) <= (a(3) and not(s(1)) and not(s(0)))
                or (b(3) and not(s(1)) and s(0))
                or (c(3) and s(1) and not(s(0)))
                or (d(3) and s(1) and s(0));

        end arch_mux1;



      -- przypisanie warunkowe - conditional signal assigment
      architecture arch_mux2 of mux is
        begin
            with s select
                y <= a when "00",
                b when "01",
                c when "10",
                d when others;
      end arch_mux2;

      -- przypisanie selektywne - selected signal assigment

      architecture arch_mux3 of mux is
        begin
            y <= a when (s = "00") else
            b when (s = "01") else
            c when (s = "10") else
            d;
      end arch_mux3;

      architecture arch_mux4 of mux is
        begin
            pr_if: process(a,b,c,d,s) --lista czulosci
            begin

                case s is
                    when "00" => y <= a; -- czytamy y :=
                    when "01" => y <= b;
                    when "10" => y <= c;
                    --when "11" => y <= d;
                        y <= (others => '0');
                    when others => y <= d;
                end case;

            end process;

        end arch_mux4;

        architecture arch_mux5 of mux is
        begin
            pr_if: process(a,b,c,d,s) --lista czulosci
            begin

                if s ="00" then
                    y <= a;
                elsif s="01" then
                    y <=b;
                elsif s="10" then
                    y <=c;
                else
                    y <=d;
                end if;
            end process;

        end arch_mux5;

        architecture arch_mux6 of mux is
        begin
            pr_if: process(a,b,c,d,s) --lista czulosci
            begin

                y<=(others=>'0');

                if s ="00" then
                    y <= a;
                end if;

                if s ="01" then
                    y <= b;
                end if;

                if s ="10" then
                    y <= c;
                end if;

--              if s ="11" then
--                  y <= d;
--              end if;

            end process;

        end arch_mux6;

        architecture arch_mux7 of mux is
        begin
            pr_if: process(a,b,c,d,s) --lista czulosci
            begin

                   --w procesie jak najbardziej jest to prawidlowe, tylko warningi sa (LACHE - pamieci)
            if s = "00" then
                y <= a;
            else
                y <=(others => '0');  
            end if;

            if s = "01" then
                y <= b;
            else
                y <=(others => '0');  
            end if;

            if s = "10" then
                y <= c;
            else
                y <=(others => '0');  
            end if;

            if s = "11" then -- zadziala tylko ten if bo jest sekwencyjnie ywkonywane i albo da 'd' albo 0000
                y <= d;
            else
                y <=(others => '0');  
            end if;


            end process;

        end arch_mux7;



     -- configuration conf_mux of mux is
        --for arch_mux6
        --end for;
      --end conf_mux;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:33:12+00:00Added an answer on May 21, 2026 at 6:33 pm

    how can i convert entity of bloch
    which takes 4 inputs to 2 inputs?

    Do you mean make your input a to h and output x,y,z 2 bits wide rather than 4?

    Just change the relevant generic, surely!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a tool out there which can convert SQL syntax to LINQ syntax?
is there anyway that I can convert a png to a bmp in C#?
Guid mainfolderid = (main.GetValue()); where main is a dynamic entity. How can I convert
How can I convert this query to linq to entities with entity framework: SELECT
I have this, one datatable and one entity class that I can convert to
You can convert a negative number to positive like this: int myInt = System.Math.Abs(-5);
we can convert character to an integer equivalent to the ASCII value of the
How i can convert to c# code files to html files?Is there any generation
How i can convert number 20020415 to date 15.04.2002. I am working in Microsoft
Seeing as you can convert any document to a byte array and save it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.