bciaren
Newbie level 4
- Joined
- Mar 14, 2013
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,336
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity SFD is
port(clk :in std_ulogic;
resetb :in std_ulogic;
decode_SFD_out :out std_ulogic);
end SFD;
architecture preamble of SFD is
signal shiftreg_8 :std_ulogic_vector(7 downto 0);
signal F :std_ulogic;
signal A :std_ulogic;
signal B :std_ulogic;
begin
process(shiftreg_8, resetb) is
begin
if (resetb = '1') then
shiftreg_8 <=(others => '0');
elsif rising_edge(clk) then
shiftreg_8(0) <= F;
shiftreg_8(1) <= shiftreg_8(0) then A <= shiftreg_8(1);
shiftreg_8(2) <= shiftreg_8(1);
shiftreg_8(3) <= shiftreg_8(2);
shiftreg_8(4) <= shiftreg_8(3);
shiftreg_8(5) <= shiftreg_8(4);
shiftreg_8(6) <= shiftreg_8(5);
shiftreg_8(7) <= shiftreg_8(6) then B <= shiftreg)8(7);
end if;
end process;
Process(shiftreg_8)
begin
if(shiftreg_8 ="10101011") then
decode_SFD_out <='1'
else
decode_SFD_out <= '0';
end if;
end process;
F := A XOR B;
end preamble;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity shiftreg is
Port ( LEDs : out STD_LOGIC_VECTOR(7 downto 0);
clk : in STD_LOGIC;
switch : in STD_LOGIC
);
end shiftreg;
architecture Behavioral of shiftreg is
signal shiftreg : STD_LOGIC_VECTOR(7 downto 0) := "01010101";
begin
process(switch)
begin
if rising_edge(switch) then
shiftreg <= "0"&shiftreg(7 downto 1);
end if;
end process;
LEDs <= shiftreg;
end Behavioral;
where is "then" being used not in an if?
like I said I am no expert, but the code does work as intended.
There are least 5 syntax errors that won't be accepted by any VHDL compiler or simulator I know.the code does work as intended.
Did you see the "then" syntax in any VHDL text book, tutorial or example code?where is "then" being used not in an if?
In the origional code:
shiftreg_8(1) <= shiftreg_8(0) then A <= shiftreg_8(1);
for example
Did I say this? I was just asking where you got the syntax from.I just hate it when experienced people tell inexperienced people to go read a book.
Did I say this? I was just asking where you got the syntax from.
plenty of syntax errors -I suggest reading a VHDL tutorial.
Posting code that you never compiled and claim it does work means somehow fooling other forum members, isn't it?
I have two explanations:My code does compile and runs just fine.
you did not actually compile the code posted in post #1 but something similar
Posting code that you never compiled and claim it does work means somehow fooling other forum members, isn't it?
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity SFD is
port(clk :out std_ulogic;
resetb :out std_ulogic;
data_in :out std_ulogic;
decode_SFD_out :out std_ulogic);
end SFD;
architecture preamble of SFD is
signal clock : std_ulogic:='0';
signal shiftreg_8 : std_ulogic_vector(7 downto 0);
signal decode_SFD : std_ulogic;
signal reset_f : std_ulogic :='0';
signal F : std_ulogic;
signal A : std_ulogic;
signal B : std_ulogic;
signal counter_A : std_ulogic;
signal counter_B : std_ulogic;
begin
process(reset_f, counter_A, clock) is
begin
if (reset_f = '1') then
counter_A <= '0';
elsif (clock'event and clock = '1') then
counter_A <= '1';
else
counter_A <= '0';
end if;
A <= counter_A;
end process;
process(reset_f, counter_B, clock) is
begin
if (reset_f = '1') then
counter_B <= '0';
elsif (clock'event and clock = '1') then
counter_B <= '0';
else
counter_B <= '1';
end if;
B <= counter_B;
end process;
process(shiftreg_8, reset_f) is
begin
if (reset_f = '1') then
shiftreg_8 <=(others => '0');
elsif rising_edge(clock) then
shiftreg_8(0) <= F;
shiftreg_8(1) <= shiftreg_8(0);
shiftreg_8(2) <= shiftreg_8(1);
shiftreg_8(3) <= shiftreg_8(2);
shiftreg_8(4) <= shiftreg_8(3);
shiftreg_8(5) <= shiftreg_8(4);
shiftreg_8(6) <= shiftreg_8(5);
shiftreg_8(7) <= shiftreg_8(6);
end if;
end process;
Process(shiftreg_8)
begin
if(shiftreg_8(7 downto 0) ="10101011") then
decode_SFD <= '1';
else
decode_SFD <= '0';
end if;
end process;
F <= A XOR B;
decode_SFD_out <= decode_SFD;
end preamble;
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?