SOMANDAL88
Newbie level 2
I am trying to build a SPI interface using VHDL. The testbench is ok. But it is not synthesizable on Spartan 6. Could anyone please figure out the problem.
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 LIBRARY IEEE; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity L6470_SPI_MASTER is port(clk: in std_logic; sdo_master: out std_logic; ck_master: out std_logic; cs_bar: out std_logic); end L6470_SPI_MASTER; architecture arch of L6470_SPI_MASTER is signal temp: integer range 0 to 9; signal reg_array: std_logic_vector(7 downto 0); begin process (clk) variable count: integer range 0 to 10:=0; begin if (rising_edge(clk)) then count :=count+1; end if; if (count=10) then count:=0; end if; temp<=count; end process; process(temp) begin case temp is when 0 => cs_bar <= '1'; when 1 => cs_bar <= '0'; when 2 => cs_bar <= '0'; when 3 => cs_bar <= '0'; when 4 => cs_bar <= '0'; when 5 => cs_bar <= '0'; when 6 => cs_bar <= '0'; when 7 => cs_bar <= '0'; when 8 => cs_bar <= '0'; when 9 => cs_bar <= '0'; end case; end process; process (clk) variable piso_reg: std_logic_vector (7 downto 0):= "11001010"; begin if (rising_edge(clk) and temp=0) then reg_array(7 downto 0)<=piso_reg(7 downto 0); elsif (rising_edge(clk)) then sdo_master<=reg_array(7); reg_array(7 downto 1)<= reg_array(6 downto 0); reg_array(0)<='0'; end if; end process; ck_master <= not(clk); end arch;
Last edited by a moderator: