D
dauzat.lilian
Hello,
I want to describe in VHDL a 8 bits shift register with synchronous
load but I want it to shift every two rising edge of the master clock
'clk' so I defined the signal clk05 which is supposed to be clk divided
by 2.
Here is my vhdl :
entity man_encoder is
port(
din : in std_logic_vector(7 downto 0); -- parallel 8 bits input
clk, wr, rst : in std_logic; -- wr:load din in input buffer,
rst:asynchronous reset
mdo, ready : out std_logic -- mdo:encoder output
);
end man_encoder;
architecture Behavioral of man_encoder is
signal clk05 : std_logic;
signal wr1 : std_logic;
signal dserial : std_logic;
signal din_sig : std_logic_vector(7 downto 0);
signal buff : std_logic_vector(7 downto 0);
begin
din_sig <= din;
mdo <= buff(7);
-- wr positive edge detector
process(clk, rst, wr)
begin
if (rst='1') then
wr1 <= '1';
elsif (clk'event and clk='1') then
wr1 <= wr;
end if;
end process;
-- clock divider (/2)
process(clk, rst)
begin
if (rst='1') then
clk05 <= '0';
elsif (clk'event and clk='1') then
clk05 <= not(clk05);
end if;
end process;
-- shift register
process(din_sig, wr, wr1, clk)
begin
if (rst='1') then
buff <= (others=>'0');
elsif (clk'event and clk='1') then
if (clk05='1') then
if (wr='1' and wr1='0') then
buff <= din_sig;
else
buff <= buff(6 downto 0) & '0';
end if;
end if;
end if;
end process;
dserial <= buff(7);
end Behavioral;
My problem is the following : the register "buff" is shift on falling
edge of clk05 and I want it on the rising edge of clk05.
Could anyone help me ?
Thanks a lot
Lilian
I want to describe in VHDL a 8 bits shift register with synchronous
load but I want it to shift every two rising edge of the master clock
'clk' so I defined the signal clk05 which is supposed to be clk divided
by 2.
Here is my vhdl :
entity man_encoder is
port(
din : in std_logic_vector(7 downto 0); -- parallel 8 bits input
clk, wr, rst : in std_logic; -- wr:load din in input buffer,
rst:asynchronous reset
mdo, ready : out std_logic -- mdo:encoder output
);
end man_encoder;
architecture Behavioral of man_encoder is
signal clk05 : std_logic;
signal wr1 : std_logic;
signal dserial : std_logic;
signal din_sig : std_logic_vector(7 downto 0);
signal buff : std_logic_vector(7 downto 0);
begin
din_sig <= din;
mdo <= buff(7);
-- wr positive edge detector
process(clk, rst, wr)
begin
if (rst='1') then
wr1 <= '1';
elsif (clk'event and clk='1') then
wr1 <= wr;
end if;
end process;
-- clock divider (/2)
process(clk, rst)
begin
if (rst='1') then
clk05 <= '0';
elsif (clk'event and clk='1') then
clk05 <= not(clk05);
end if;
end process;
-- shift register
process(din_sig, wr, wr1, clk)
begin
if (rst='1') then
buff <= (others=>'0');
elsif (clk'event and clk='1') then
if (clk05='1') then
if (wr='1' and wr1='0') then
buff <= din_sig;
else
buff <= buff(6 downto 0) & '0';
end if;
end if;
end if;
end process;
dserial <= buff(7);
end Behavioral;
My problem is the following : the register "buff" is shift on falling
edge of clk05 and I want it on the rising edge of clk05.
Could anyone help me ?
Thanks a lot
Lilian