Synthese Logique

Synthese Logique

Carte Icebreaker avec FPGA LATTICE ICE40UP5k

fpga_1.svg

DOCUMENTATION

https://github.com/icebreaker-fpga


Installations ( sur vos PCs persos )

Les outils logiciels utilisés sont open source.
L’open source dans la synthèse logique est récente, le site de Fabien Marteau propose un tour d’horizon complet des possibilités logicielles et matérielles.

Installation de GHDL

Pour Linux :

  • extraire l’archive et mettre à jour la variable d’environnement $PATH ( ligne à ajouter dans le fichier ~/.bashrc ) :
export PATH=""<extracted_location>/ghdl-gha-ubuntu-22.04-llvm/bin/:$PATH"

Installation de Yosys + ..

Plusieurs autres logiciels doivent être installés ( yosys, nextpnr, iceprog ), cela peut se faire individuellement, mais il est plus pratique d’installer l’ensemble de ces outils avec oss-cad-suite :

Pour Linux :

  • extraire l’archive et mettre à jour la variable d’environnement $PATH ( ligne à ajouter dans le fichier ~/.bashrc ) :
export PATH="<extracted_location>/oss-cad-suite/bin:$PATH"

Chaîne de développement

testbench.svg

Avec le logiciel de simulation ghdl, le forçage des signaux d’entrée d’un composant à tester nécessite l’utilisation d’un composant testbench, à savoir un composant incluant le composant à tester

Dans notre exemple, le composant à tester est le composant icebreaker, décrit dans le fichier vhdl icebreaker.vhd.
Le test nécessite un composant icebreaker_tb, décrit dans le fichier vhdl cicebreaker_tb.vhd, dans lequel on instancie icebreaker.

Composants Testbench
library IEEE;
use IEEE.std_logic_1164.all;

entity icebreaker is
port(  BTN1, BTN2, BTN_N, CLK : in std_logic;
		LED1, LED2, LED3 : out std_logic);
end entity icebreaker;

architecture arch_icebreaker of icebreaker is
signal reset : std_logic;
begin

reset <= not(BTN_N);

process(CLK)
begin
	if reset = '1' then LED1 <= '0'; LED2 <= '0'; LED3 <= '0';
	elsif rising_edge(CLK) then
		if 	  (( BTN1='1' ) and ( BTN2='0' )) then LED1 <= '1'; LED2 <= '0'; LED3 <= '0';
		elsif (( BTN1='1' ) and ( BTN2='1' )) then LED1 <= '0'; LED2 <= '1'; LED3 <= '0';
		elsif (( BTN1='0' ) and ( BTN2='1' )) then LED1 <= '0'; LED2 <= '0'; LED3 <= '1';
		else LED1 <= '0'; LED2 <= '0'; LED3 <= '0';
		end if;
	end if;	
end process;

end arch_icebreaker;
library IEEE;
use IEEE.std_logic_1164.all;
use work.all;



entity icebreaker_tb is
end icebreaker_tb;


architecture arch_icebreaker_tb of icebreaker_tb is

signal BTN1, BTN2, BTN_N, LED1, LED2, LED3, CLK : std_logic;
constant CLK_period : time := 83333 ps; --12MHz

begin

icebreaker_0 : entity icebreaker port map (
BTN1 => BTN1,
BTN2 => BTN2,
BTN_N => BTN_N,
CLK => CLK,
LED1 => LED1,
LED2 => LED2,
LED3 => LED3
);

-- Clock definition.
CLK_process :process
      begin
        CLK <= '0';
        wait for CLK_period / 2;
        CLK <= '1';
        wait for CLK_period / 2;
      end process;

stimuli: process
      begin
      	BTN_N  <= '0'; 
        wait for 1 ms;
		BTN_N  <= '1'; 
        wait for 1 ms;
        BTN1 <= '0'; BTN2 <= '0'; -- Initial conditions.
        wait for 1 ms;
		BTN1 <= '0'; BTN2 <= '1';
        wait for 1 ms;
		BTN1 <= '1'; BTN2 <= '0';
        wait for 1 ms;
        BTN1 <= '1'; BTN2 <= '1';
        wait;
end process;


end arch_icebreaker_tb;

Chaîne de développement

chaine_developpement.svg

Sources

cmp_1bit.zip

unzip cmp_1bit.zip
cd cmp_1bit

COMPILATION

ghdl -a icebreaker.vhd
ghdl -a icebreaker_tb.vhd

SIMULATION

bash simu.sh -t icebreaker_tb.vhd -s 5ms  

Dans gtkwave, sélectionner l’entité de plus haut niveau ( icebreaker_tb ), et faire clic droit –> Recursive Import –> Insert

gtkwave.png

REMARQUE : dans gtkwave, pour sauvegarder la configuration , faire File –> write save file –> layout.gtkw

SYNTHESE LOGIQUE

bash build_fpga.sh -e icebreaker -p broches.pcf