#
wsl --install
#
sudo apt update
sudo apt install -y wget zlib1g-dev gnat-10 unzip openjdk-19-jdk gtkwave
#
mkdir ghdl
wget https://github.com/ghdl/ghdl/releases/download/v4.1.0/ghdl-gha-ubuntu-22.04-gcc.tgz -P ghdl/
cd ghdl
tar -xzvf ghdl*.tgz
rm g*tgz
cd
echo 'export PATH="$HOME/ghdl/bin:$PATH"' >> $HOME/.bashrc
source .bashrc
#
cd
wget -c https://github.com/hneemann/Digital/releases/latest/download/Digital.zip
unzip Di*zip
rm Di*zip
digital
:cd
echo 'export PATH="$HOME/Digital:$PATH"' >> $HOME/.bashrc
echo 'alias digital=Digital.sh' >> $HOME/.bashrc
source .bashrc
#
sudo apt update && sudo apt install -y curl
curl -sSL https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/ubuntu.sh | bash
source .bashrc
curl -sSL https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/ubuntu_24_04.sh | bash
source .bashrc
#
wsl --unregister Ubuntu
#
#
GHDL Requiere GLIBC 2.34 y Debian Bullseye tiene 2.31 , si instalamos desde Microsoft Store obtendremos Debian Bookworm que viene con GLIBC 2.36.
#
wsl --install Debian
#### Bullseye:
sudo apt update
sudo apt install -y wget zlib1g-dev gnat-10 unzip openjdk-17-jdk gtkwave
#
Usando Winget evitamos usar la interfaz grafica:
winget install Debian -s msstore
O directamente desde el repo de winget:
winget install Debian.Debian
Lo lanzamos con:
debian
Creamos usuario y contraseña.
gnat-10
:echo 'deb http://deb.debian.org/debian bullseye main' | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install -y gnat-10
sudo apt install -y wget zlib1g-dev unzip openjdk-17-jdk gtkwave
sudo sed -i '$ d' /etc/apt/sources.list
sudo apt update
#
mkdir ghdl
wget https://github.com/ghdl/ghdl/releases/download/v4.1.0/ghdl-gha-ubuntu-22.04-gcc.tgz -P ghdl/
cd ghdl
tar -xzvf ghdl*.tgz
rm g*tgz
cd
echo 'export PATH="$HOME/ghdl/bin:$PATH"' >> $HOME/.bashrc
source .bashrc
#
cd
wget -c https://github.com/hneemann/Digital/releases/latest/download/Digital.zip
unzip Di*zip
rm Di*zip
digital
:cd
echo 'export PATH="$HOME/Digital:$PATH"' >> $HOME/.bashrc
echo 'alias digital=Digital.sh' >> $HOME/.bashrc
source .bashrc
#
sudo apt update && sudo apt install -y curl
curl -sSL https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/debian_bullseye.sh | bash
source .bashrc
curl -sSL https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/debian_bullseye.sh | bash
source .bashrc
#
sudo apt update && sudo apt install -y curl
curl -sSL https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/debian_bookworm.sh | bash
source .bashrc
curl -sSL https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/debian_bookworm.sh | bash
source .bashrc
wsl --unregister Debian
#
#
cd $HOME\Downloads\
wget https://github.com/ghdl/ghdl/releases/download/v4.1.0/ghdl-MINGW32.zip -OutFile ghdl-MINGW32.zip
Expand-Archive ghdl*.zip -DestinationPath C:\
rm ghdl-MINGW32.zip
cd ..
cd $HOME\Downloads\
wget https://github.com/ghdl/ghdl/releases/download/v4.1.0/ghdl-UCRT64.zip -OutFile ghdl-UCRT64.zip
Expand-Archive ghdl*.zip -DestinationPath C:\
rm ghdl-UCRT64.zip
cd ..
Al ver cd ..
presionamos Enter.
cd $HOME\Downloads\
Move-Item -Path ghdl-MINGW32/GHDL -Destination C:\
cd ..
cd $HOME\Downloads\
Move-Item -Path ghdl-UCRT64/GHDL -Destination C:\
cd ..
C:\GHDL\bin\
Usaremos esto después.
#
winget install "Java 8"
cd $HOME\Downloads\
wget https://github.com/hneemann/Digital/releases/latest/download/Digital.zip -OutFile Digital.zip
Expand-Archive Di*.zip -DestinationPath C:\
rm Di*zip
cd ..
Al ver cd ..
presionamos Enter.
cd $HOME\Downloads\
Move-Item -Path Digital -Destination C:\
cd ..
C:\Digital\
Usaremos esto después.
#
.vhdl
al igual que el bloc de notas, pero detecta la sintaxis:Con Winget:
winget install "notepad++"
#
Visor de diagrama temporal archivo .vcd
generado con GHDL.
cd $HOME\Downloads\
Start-BitsTransfer -Source https://sourceforge.net/projects/gtkwave/files/gtkwave-3.3.100-bin-win32/gtkwave-3.3.100-bin-win32.zip/download -Destination gtkwave.zip
Expand-Archive gtk*.zip -DestinationPath C:\
rm gtk*.zip
cd ..
cd $HOME\Downloads\
Start-BitsTransfer -Source https://sourceforge.net/projects/gtkwave/files/gtkwave-3.3.100-bin-win64/gtkwave-3.3.100-bin-win64.zip/download -Destination gtkwave.zip
Expand-Archive gtk*.zip -DestinationPath C:\
rm gtk*.zip
Rename-Item -Path "C:\gtkwave64" -NewName "gtkwave"
cd ..
Al ver cd ..
presionamos Enter.
cd $HOME\Downloads\
Move-Item -Path gtkwave -Destination C:\
cd ..
cd $HOME\Downloads\
Rename-Item -Path "C:\gtkwave64" -NewName "gtkwave"
Move-Item -Path gtkwave -Destination C:\
cd ..
Al ver cd ..
presionamos Enter.
C:\gtkwave\bin\
Usaremos esto después. #
ghdl
, Digital
, gtkwave
.#
Buscamos Variables y nos saldrá el acceso a Editar las variables de entorno del sistema
Pulsamos el botón Variables de entorno...
Se abre una nueva ventana, seleccionamos Path
y pulsamos Editar...
del recuadro superior.
Se abre otra ventana, seleccionamos Nuevo
Ingresamos las 3 rutas de los ejecutables:
C:\GHDL\bin\
C:\Digital\
C:\gtkwave\bin\
Pulsamos Aceptar
en cada ventana para cerrarlas.
Abrimos una Terminal y comprobamos(no es necesario) que obtenemos respuesta al preguntar por las versiones de los ejecutables, excepto en Digital que solo se ejecutará.
#
Aun deberemos agregar las variables de entorno, pero el resto se hará solo.
Enter
. Agregar las variables de entorno y listo.Invoke-WebRequest -Uri "https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/VHDL_win_32bit.ps1" -OutFile "$env:TEMP\VHDL_win_32bit.ps1"
powershell -ExecutionPolicy Bypass -File "$env:TEMP\VHDL_win_32bit.ps1"
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/VHDL_win_64bit.ps1" -OutFile "$env:TEMP\VHDL_win_64bit.ps1"
powershell -ExecutionPolicy Bypass -File "$env:TEMP\VHDL_win_64bit.ps1"
#
Click en imagen para abrir video en Youtube
#
cd $HOME\Downloads\
.\setup-x86_64.exe -q -P gcc-g++,gperf,libbz2-devel,liblzma-devel,zlib-devel,libgtk3-devel,make,git,xinit,tcl-tk-devel,autotools-dev,automake,libJudy-devel
git clone https://github.com/gtkwave/gtkwave/ -b lts gtkwave
cd gtkwave/gtkwave3-gtk3 && ./autogen.sh
./configure --enable-gtk3 --enable-judy
make -j
make install
startxwin
Aparecerán 2 iconos de sistemas.
gtkwave
O desde el icono del Sistema opción Accesorios -> GTKWave
#
.vcd
para GTKWave:.vhdl
con Notepad++ o cualquier editor de texto.Abrimos una terminal donde se encuentre dicho archivo y realizamos los siguientes pasos: Detalle de la Sintaxis utilizada
ghdl -s archivo.vhdl
ghdl -s archivo_tb.vhdl
ghdl -a archivo.vhdl
ghdl -a archivo_tb.vhdl
ghdl -e archivo_tb
ghdl -r archivo_tb
ghdl -r archivo_tb --vcd=archivo.vcd
.vcd
creado con GTKWave:
gtkwave archivo.vcd
Existe una sintaxis/convención respecto al nombre del archivo, que debe ser el nombre de la entidad de nuestra descripción para que no nos dé error.
-s
chequea error de sintaxis.
-a
analiza la descripción.
-e
elabora la unidad.
-r
corre/simula el diseño.
TEMPLATE.vhd
y TEMPLATE_TB.vhd
usaban STD_LOGIC_ARITH
y STD_LOGIC_UNSIGNED
, se las actualizo al Standard IEEE, ambas bibliotecas son propietarias de Xilinx, el Standard las reemplazó con numeric_std.all
.ghdl -s --std=08 --ieee=synopsys TEMPLATE.vhd
En sus diversas variantes.
archivo_tb
no se necesita y tiene herramientas para ver en tiempo real(no muy preciso) el diagrama temporal.Si el Sistema esta en Español abre CMD:
takeown /f C:\cygwin64 /r /d s
icacls C:\cygwin64 /t /grant todos:f
del /s /q C:\cygwin64
rmdir /s /q C:\cygwin64
Si el Sistema esta en Inglés abre CMD:
takeown /f C:\cygwin64 /r /d y
icacls C:\cygwin64 /t /grant everyone:f
del /s /q C:\cygwin64
rmdir /s /q C:\cygwin64
Eliminar el Acceso directo del escritorio manualmente, al no existir Cygwin tampoco existirá GTKWave(el compilado).
#
Análisis -> Archivo -> Exportar el caso de prueba
, copiamos su contenido, vamos al árbol de componentes, elegimos en Varios -> Caso de Prueba
lo editamos por separado, pegamos la TV generada y le damos al boton OK
, vamos a Archivo -> Exportar -> Exportar VHDL
Guardamos con algún nombre, se guardan 2 archivos:archivo.vhdl
archivo_Y_tb.vhdl
ghdl archivo_Y_tb.vhdl
PS C:\Users\black\Documents> ghdl -s .\c4_ej7.vhdl
PS C:\Users\black\Documents> ghdl -s .\c4_ej7_Y_tb.vhdl
.\c4_ej7_Y_tb.vhdl:22:24:warning: declaration of "a" hides signal "A" [-Whide]
function to_string ( a: std_logic_vector) return string is
.\c4_ej7_Y_tb.vhdl:23:16:warning: declaration of "b" hides signal "B" [-Whide]
variable b : string (1 to a'length) := (others => NUL);
ghdl -s -Wno-hide .\c4_ej7_Y_tb.vhdl
Este warning no sucede si a las entradas no las nombramos D,C,B,A en otro ejemplo se usa B3,B2,B1,B0 y no hubo ningún warning.
c4_ej7.vhdl
generada del circuito de la expresión Z=!( (B+C). !( (A.B)+C ) )
:-- generated by Digital. Don't modify this file!
-- Any changes will be lost if this file is regenerated.
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity main is
port (
A: in std_logic;
B: in std_logic;
C: in std_logic;
Y: out std_logic);
end main;
architecture Behavioral of main is
begin
Y <= NOT (NOT ((A AND B) OR C) AND (B OR C));
end Behavioral;
c4_ej7_Y.vhdl
:-- A testbench for c4_ej7_Y_tb
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity c4_ej7_Y_tb is
end c4_ej7_Y_tb;
architecture behav of c4_ej7_Y_tb is
component main
port (
A: in std_logic;
B: in std_logic;
C: in std_logic;
Y: out std_logic);
end component;
signal A : std_logic;
signal B : std_logic;
signal C : std_logic;
signal Y : std_logic;
function to_string ( a: std_logic_vector) return string is
variable b : string (1 to a'length) := (others => NUL);
variable stri : integer := 1;
begin
for i in a'range loop
b(stri) := std_logic'image(a((i)))(2);
stri := stri+1;
end loop;
return b;
end function;
begin
main_0 : main port map (
A => A,
B => B,
C => C,
Y => Y );
process
type pattern_type is record
C : std_logic;
B : std_logic;
A : std_logic;
Y : std_logic;
end record;
type pattern_array is array (natural range <>) of pattern_type;
constant patterns : pattern_array := (
('0', '0', '0', '1'), -- i=0
('0', '0', '1', '1'), -- i=1
('0', '1', '0', '0'), -- i=2
('0', '1', '1', '1'), -- i=3
('1', '0', '0', '1'), -- i=4
('1', '0', '1', '1'), -- i=5
('1', '1', '0', '1'), -- i=6
('1', '1', '1', '1'));
begin
for i in patterns'range loop
A <= patterns(i).A;
B <= patterns(i).B;
C <= patterns(i).C;
wait for 10 ns;
assert std_match(Y, patterns(i).Y) OR (Y = 'Z' AND patterns(i).Y = 'Z')
report "wrong value for Y, i=" & integer'image(i)
& ", expected " & std_logic'image(patterns(i).Y) & ", found " & std_logic'image(Y) severity error;end loop;
wait;
end process;
end behav;
Z = 0
:
Click en imagen para abrir video en Youtube
curl -sSL https://raw.githubusercontent.com/PIBSAS/Install_GHDL_WSL/main/raspberry.sh | bash
#