Scusate la domanda banale, ma come si fa a scrivere 1 di dimensione size????
Ad esempio vorrei che venisse trattatto come 00000001 perchè size=8.
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.numeric_std.all;
--use ieee.std_logic_arith.all;
entity moltiplicatore is
generic (size : integer :=12);
port(
m1 : in signed(size-1 downto 0);
m2 : in signed(size-1 downto 0);
out_parity :out signed(size-1 downto 0)
);
end moltiplicatore;
architecture moltiplicatore of moltiplicatore is
component mymux
port(
a : in signed (size-1 downto 0);
b : in signed (size-1 downto 0);
s : in std_logic;
out_mux : out signed (size-1 downto 0)
);
end component;
component select_mux
port(
msb_in: in signed (size-1 downto 0);
msb_out : out std_logic
);
end component;
signal m_full,m_round,one : signed (2*size-1 downto 0);
signal aux1 : std_logic;
signal msb,lsb : signed (size-1 downto 0);
begin
m_full<=m1*m2;
m_round<=m_full + "000000000000100000000000";
msb<= m_round(2*size-1 downto size);
lsb<= m_round(size-1 downto 0);
blocco1 : mymux
port map(msb,lsb,aux1,out_parity);
blocco2:select_mux
port map(msb,aux1);
end moltiplicatore;
Users browsing this forum: No registered users and 21 guests