Skip to content

Instantly share code, notes, and snippets.

@pcornier
Last active July 13, 2022 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcornier/2da9976a9d5603f717e384a88ff30fd5 to your computer and use it in GitHub Desktop.
Save pcornier/2da9976a9d5603f717e384a88ff30fd5 to your computer and use it in GitHub Desktop.
yosys/ghdl -> verilog (VHDL to Verilog with Yosys & GHDL)
# make sure it's python 2.7
sudo update-alternatives --config python
# build ghdl
sudo apt install -y git make gnat zlib1g-dev
git clone https://github.com/ghdl/ghdl
cd ghdl
./configure --prefix=/usr/local
make
sudo make install
# build ghdl-yosys-plugin
git clone https://github.com/ghdl/ghdl-yosys-plugin
cd ghdl-yosys-plugin
make
sudo mkdir /usr/local/share/yosys/plugins
sudo cp ghdl.so /usr/local/share/yosys/plugins
# convert vhdl files
ls test
- ctc.vhdl
- ctc_channel.vhdl
# create .cf file
cd test
ghdl -a *.vhd
# load and compile
yosys -m ghdl
yosys> ghdl ctc
yosys> proc; opt; fsm; opt; memory; opt;
# write verilog
yosys> write_verilog ctc
@pcornier
Copy link
Author

pcornier commented Jan 21, 2022

ghdl synth --out=verilog
for example: ghdl synth --ieee=synopsys -fexplicit --out=verilog vdp > vdp.v
or:
ghdl -a --std=08 P65816_pkg.vhd BCDAdder.vhd AddSubBCD.vhd AddrGen.vhd MCode.vhd P65C816.vhd ALU.vhd
ghdl synth --std=08 --out=verilog P65C816 > P65C816.v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment