basic simulations of digital electronics using vhdl
counters- ring_counter.vhdl - a simple ring counter -- a counter that shifts a single bit through a series of flip-flops
- counter.vhdl - a simple counter
encodersgrey.vhdl- a simple grey encoderone_hot.vhdl- a simple one hot encoder
machinescompar_fsm.vhdl- a simple finite state machine that compares two numbersseq_det.vhdl- a simple sequence detectorcode_det.vhdl- a simple code detector
memorydram.vhdlhist.vhdllifovhdl
multiplexers_registersbarrel.vhdl- a simple barrel shifterpiso.vhdl- a parallel-in serial-out shift registersipo.vhdl- a serial-in parallel-out shift registerreg_adder.vhdl- a simple register adder
Install ghdl - open source vhdl simulation tool (works both on Linux and Windows) using link below or try fetching it via your system installer: http://ghdl.free.fr/
and gtkwave to view simulation runs: http://gtkwave.sourceforge.net/
Alternatively, you can use any other waveform viewer, for instance: http://raczben.pythonanywhere.com/#
- Your main design declaration
- Your testbench for design (i.e. the testing setup, allows to view how signals are processed by main design)
component.vhdl - main design
component_tb.vhdl - testbench -
Write your design e.g. in
component.vhdl -
Let ghdl check for syntax:
use :(~) ghdl -a component.vhdl
-
Build .o by typing
(~) ghdl -e component
-
Write your testbench
e.g.component_tb.vhdl -
Check testbench for syntax
(~) ghdl -a component_tb.vhdl
-
Create .o file
(~) ghdl -e component_tb
-
Run your testbench for a limited time!, and save simulation output (wavefile .vcd)
e.g. ~ghdl -r component_tb --stop-time=120ns --vcd=component.vcd -
View the results
(~) gtkwave component.vcd
or upload to online viewer:
http://raczben.pythonanywhere.com/#.
Remeber to drag signals into viewing pane and adjust the time scale
Just add the new .vhdl files and objects to corresponding fields using "" and run analysis with:
(~) make anal name=component_nameto clean the .o, .cf, work and other redundant files (except testbench and design file) run:
(~) make clean