Library of reusable VHDL components
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.6 KiB

10 years ago
  1. # libvhdl
  2. A LGPLv3 licensed library of reusable components for VHDL designs and testbenches
  3. ##sim
  4. (Non) synthesible components for testbenches
  5. ##### AssertP
  6. Package with various assertion procedures.
  7. * `assert_true(x[, str, level])` checks if boolean x = false
  8. * `assert_false(x[, str, level])` checks if boolean x = false
  9. * `assert_equal(x, y[, str, level])` checks if x = y
  10. * `assert_unequal(x, y[, str, level])` checks if x /= y
  11. All of the assert_* procedures have following optional parameters:
  12. * `str` print string str to console instead implemented one
  13. * `level` severity level (note, warning, error, failure)
  14. ##### SimP
  15. Package with various components general useful for simulation
  16. * `wait_cycles(x, n)` waits for n rising edges on std_logic signal x
  17. * `spi_master()` configurable master for SPI protocol, supports all cpol/cpha modes
  18. * `spi_slave()` configurable slave for SPI protocol, supports all cpol/cpha modes
  19. ##### QueueP
  20. Package with various implementations of queue types:
  21. * `t_simple_queue` simple array based FIFO queue
  22. * `t_list_queue` linked list FIFO queue using access types
  23. ## syn
  24. Synthesizable components for implementing in FPGA
  25. ##### SpiMasterE
  26. Configurable SPI master with support modes 0-3 and simple VAI local backend.
  27. ##### SpiSlaveE
  28. Configurable SPI slave with support modes 0-3 and simple VAI local backend.
  29. ##test
  30. Unit tests for each component
  31. ##### QueueT
  32. Unit tests for components of QueueP package
  33. ##### SimT
  34. Unit tests for components of SimP package
  35. ##### SpiT
  36. Unit tests for SpiSlave component
  37. ## Dependencies
  38. To run the tests, you have to install GHDL. You can get it from
  39. [http://sourceforge.net/projects/ghdl-updates/](http://sourceforge.net/projects/ghdl-updates/).
  40. Furthermore, you need the VHDL 2008 proposed packages because I'm using various VHDL 2008 features.
  41. You can get the packages from [http://www.eda.org/fphdl/](http://www.eda.org/fphdl/).
  42. Save the following files into the test folder:
  43. * standard_additions_c.vhd
  44. * standard_textio_additions_c.vhd
  45. * std_logic_1164_additions.vhd
  46. * numeric_std_additions.vhd
  47. * numeric_std_unsigned_c.vhd
  48. * env_c.vhd
  49. Another useful tool is GTKWave, install it if you want to use the waveform files generated by some of the tests.
  50. ## Building
  51. Type `make` to do all tests. You should see the successfully running tests like this:
  52. ```
  53. $ make
  54. ghdl -a --std=02 ../sim/QueueP.vhd QueueT.vhd
  55. ghdl -e --std=02 QueueT
  56. ghdl -r --std=02 QueueT
  57. QueueT.vhd:52:5:@0ms:(report note): INFO: t_simple_queue test finished successfully
  58. QueueT.vhd:87:5:@0ms:(report note): INFO: t_list_queue test finished successfully
  59. ```