VHDL: Address Decoder

Attached is my first cut at an address decoder. While it works I am not sure it's the best method. Also I am not sure why there are four 4:1 muxes in the design.

Any help or ideas?

Thanks, JTW

entity Decoder is

Generic ( ASIZE : integer := 32; BSIZE : integer := 12);

Port ( clk : in std_logic; rst : in std_logic; address : in std_logic_vector(ASIZE-1 downto 0); reset_stb : out std_logic; reg1_stb : out std_logic; reg2_stb : out std_logic; reg3_stb : out std_logic; valid : out std_logic); end Decoder;

architecture Behavioral of Decoder is

constant PMC_ADDR : std_logic_vector := X"00008"; constant RESET_ADDR : std_logic_vector := X"000"; constant REG1_ADDR : std_logic_vector := X"004"; constant REG2_ADDR : std_logic_vector := X"008"; constant REG3_ADDR : std_logic_vector := X"00C";

begin

process (clk, rst) begin if rst = '1' then

valid

Reply to
JTW
Loading thread data ...

it's the best method. Also I am not sure why there are four 4:1 muxes in the design.

Yes. Get a better text editor. Need to eliminate the tabs and add a few line feeds.

-- Mike Treseler

Reply to
Mike Treseler

sure it's the best method. Also I am not sure why there are four 4:1 muxes in the design.

I agree. If you're gonna code like that, you might as well use Verilog. Cheers, Syms.

Reply to
Symon

Sorry about the format. I cut and paste from ISE into Xilinx's forum web site. Looks like it butchered the code.

JTW

Reply to
Weddick

New Listing---

entity Decoder is

Generic ( ASIZE : integer := 32; BSIZE : integer := 12);

Port ( clk : in std_logic; rst : in std_logic; address : in std_logic_vector(ASIZE-1 downto 0); reset_stb : out std_logic; reg1_stb : out std_logic; reg2_stb : out std_logic; reg3_stb : out std_logic; valid : out std_logic); end Decoder;

architecture Behavioral of Decoder is

constant PMC_ADDR : std_logic_vector := X"00008"; constant RESET_ADDR : std_logic_vector := X"000"; constant REG1_ADDR : std_logic_vector := X"004"; constant REG2_ADDR : std_logic_vector := X"008"; constant REG3_ADDR : std_logic_vector := X"00C";

begin

process (clk, rst) begin if rst = '1' then valid

Reply to
Weddick

Yo there,

Me think if you close the if statement, you should be able to remove the 4 to 1 Mux...

if (address(ASIZE-1 downto BSIZE) = PMC_ADDR) then valid

Reply to
TTigger

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.