Skip to content

Commit 57aa852

Browse files
Devel/v3 refactoring (#50)
* added refactoring scripts * codebase refactor for version 3 * REFACTORING: remove tab and trailing white space * REFACTORING: HDL done and documentation started * DOC: refactoring md files architecture step 1 * REFACTORING: HDL done todo documentation * FEATURE: added parse_library script for refactoring * FEATURE: added blacklist option to parse_library.py * toto * REFACTOR: snake_case refacroring entire library * CLEANUP: code cleaning * CLEANUP * DOC: missing link doc * FEATURE: Add PWM block * RELEASE: Add changelog and REAMDME * DOC: errate correction on link --------- Co-authored-by: Radoslaw Rybaniec <radoslaw.rybaniec@psi.ch>
1 parent c084715 commit 57aa852

File tree

361 files changed

+14520
-9193
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

361 files changed

+14520
-9193
lines changed

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 3.0.0
2+
* Cleaning
3+
* All codes have been unified for better readibility and all tabs have been removed
4+
* new script added to update your current project and replace instantiation with json database file
5+
* Added Features
6+
* Added *psi\_common\_pwm*
7+
18
## 2.17.1
29
* Bugfixes
310
* Merge: psi_common_tdm_par_fill merged to psi_common_tdm_par

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# General Information
22

3+
New release of library to enhance readibility and unifying code through all files, new documentation organization.
4+
This version is not backward compatible but a script is given to help user to adapt code to new release.
5+
36
## Maintainer
47
Benoît Stef [benoit.stef@psi.ch]
58

@@ -57,7 +60,7 @@ Alternatively the repository [psi\_fpga\_all](https://github.com/paulscherrerins
5760
* [PsiSim](https://github.com/paulscherrerinstitute/PsiSim) (2.1.0 or higher)
5861
* VHDL
5962
* [**psi\_common**](https://github.com/paulscherrerinstitute/psi_common)
60-
* [psi\_tb](https://github.com/paulscherrerinstitute/psi_tb) (2.6.0 or higher)
63+
* [psi\_tb](https://github.com/paulscherrerinstitute/psi_tb) (3.0.0 or higher)
6164

6265
<!-- END OF PARSED SECTION -->
6366

doc/README.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<img align="right" src="psi_logo.png">
2+
3+
***
4+
## Introduction
5+
6+
[read me first](old/ch1_introduction/ch1_introduction.md)
7+
8+
**Quick syntax rules to push into the library:**
9+
10+
- **snake_case**
11+
- remove **tab to white space**
12+
- use of suffix for entity's signal following simple rules: **_i, _o and _io** respectively for input, output and inout
13+
- entity, architecture, package, procedure, function, etc... ends as such: **end entity; end architecture,** etc...
14+
- use of prefix to gather signal corresponding to same interface like: **adc**_clk_i, **adc**_data_i, **adc**_vld_i...
15+
- name of architecture: **behav, struc, rtl**
16+
- when strcutural architecture would be nice to link components with signal's prefixe name such as: fifo2filter_* (e.g. component A to component B: compa2compb_)
17+
18+
## Packages
19+
20+
### psi_common_array_pkg
21+
22+
This package defines various array types that are not defined by VHDL natively. Some of these definitions are no more required in VHDL 2008 but since VHDL 2008 is not yet fully synthesizable, the package is kept.
23+
24+
### psi_common_logic_pkg
25+
26+
This package contains various logic functions (e.g. combinatorial conversions) that can be synthesized.
27+
28+
### psi_common_axi_pkg
29+
30+
This package contains record definitions to allow representing a complete AXI interface including all ports by only two records (one in each direction). This helps improving the readability of entities with AXI interfaces.
31+
32+
### psi_common_math_pkg
33+
34+
This package contains various mathematical functions (e.g. log2). The functions are meant for calculating compile-time constants (i.e. constants, port-widths, etc.). They can potentially be synthesized as combinatorial functions but this is neither guaranteed nor will it lead to optimal results.
35+
36+
## List of components available
37+
38+
39+
### Memory components
40+
41+
Component | Source | Description
42+
----------------------------------------|-------------------------------------------------------------|:-------------------------------------------:
43+
Simple dual port RAM | [psi_common_sdp_ram.vhd](../hdl/psi_common_sdp_ram.vhd) | [link](files/psi_common_sdp_ram.md)
44+
Simple dual port RAM with byte enable | [psi_common_sp_ram_be.vhd](../hdl/psi_common_sp_ram_be.vhd) | [link](files/psi_common_sp_ram_be.md)
45+
True Dual port RAM | [psi_common_tdp_ram.vhd](../hdl/psi_common_tdp_ram.vhd) | [link](files/psi_common_tdp_ram.md)
46+
True dual port RAM with byte enable | [psi_common_tdp_ram_be.vhd](../hdl/psi_common_tdp_ram_be.vhd) | [link](files/psi_common_tdp_ram.md)
47+
48+
***
49+
50+
### FIFO components
51+
Component | Source | Description
52+
------------------------|-------------------------------------------------------------|:-------------------------------------------:
53+
Asynchronous FIFO | [psi_common_async_fifo.vhd](../hdl/psi_common_async_fifo.vhd) | [link](files/psi_common_async_fifo.md)
54+
Synchronous FIFO | [psi_common_sync_fifo.vhd](../hdl/psi_common_sync_fifo.vhd) | [link](files/psi_common_sync_fifo.md)
55+
56+
***
57+
58+
### Clock domain crossing (CDC) components
59+
Component | Source | Description
60+
------------------------|-------------------------------------------------------------|:-------------------------------------------:
61+
Pulse clock crossing (asynchronous pulse/vld transfer) | [psi_common_pulse_cc.vhd](../hdl/psi_common_pulse_cc.vhd) | [link](files/psi_common_pulse_cc.md)
62+
Simple clock crossing (asynchronous data value transfer) | [psi_common_simple_cc.vhd](../hdl/psi_common_simple_cc.vhd) | [link](files/psi_common_simple_cc.md)
63+
Status clock crossing (asynchronous slow changing value transfer) | [psi_common_status_cc.vhd](../hdl/psi_common_status_cc.vhd) | [link](files/psi_common_status_cc.md)
64+
Synchronous CDC with AXI-S handshaking from **Lower** clock to **Higher** multiple integer clock frequency | [psi_common_sync_cc_n2xn.vhd](../hdl/psi_common_sync_cc_n2xn.vhd) | [link](files/psi_common_sync_cc_n2xn.md)
65+
Synchronous CDC with AXI-S handshaking from **Higher** clock to **lower** multiple integer clock frequency | [psi_common_sync_cc_xn2n.vhd](../hdl/psi_common_sync_cc_xn2n.vhd) | [link](files/psi_common_sync_cc_xn2n.md)
66+
Bit CDC | [psi_common_bit_cc.vhd](../../hdl/psi_common_bit_cc.vhd) | [link](files/psi_common_bit_cc.md)
67+
68+
##### Other components that can be used as cdc
69+
- [psi_common_tdp_ram](files/psi_common_tdp_ram.md)
70+
- [psi_common_async_fifo](files/psi_common_async_fifo.md)
71+
72+
***
73+
74+
### Conversions components
75+
Component | Source | Description
76+
------------------------|-------------------------------------------------------------|:-------------------------------------------:
77+
Data width conversion from a N-bits to a multiple N-bits | [psi_common_wconv_n2xn.vhd](../hdl/psi_common_wconv_n2xn.vhd) | [link](files/psi_common_wconv_n2xn.md)
78+
Data width conversion from a multiple N-bits to a N-bits | [psi_common_wconv_x2nn.vhd](../hdl/psi_common_wconv_xn2n.vhd) | [link](files/psi_common_wconv_xn2n.md)
79+
80+
***
81+
82+
### Time Division Multiplexing (TDM) data Handling components
83+
Component | Source | Description
84+
------------------------|-------------------------------------------------------------|:-------------------------------------------:
85+
TDM data to parallel | [psi_common_tdm_par.vhd](../hdl/psi_common_tdm_par.vhd) | [link](files/psi_common_tdm_par.md)
86+
Parallel to TDM data | [psi_common_par_tdm.vhd](../hdl/psi_common_par_tdm.vhd) | [link](files/psi_common_par_tdm.md)
87+
TDM data to Parallel with configurable valid output channel number | [psi_common_tdm_par_cfg.vhd](../hdl/psi_common_tdm_par_cfg.vhd) | [link](files/psi_common_tdm_par_cfg.md)
88+
TDM data multiplexer | [psi_common_tdm_mux.vhd](../hdl/psi_common_tdm_mux.vhd) | [link](files/psi_common_tdm_mux.md)
89+
Parallel to TDM with configurable valid output output channel | [psi_common_par_tdm_cfg.vhd](../hdl/psi_common_par_tdm_cfg.vhd) | [link](files/ch8_5_par_tdpsi_common_par_tdm_cfgm_cfg.md)
90+
TDM data to parallel with last support and completion | [psi_common_tdm_par_fill.vhd](../hdl/psi_common_tdm_par_fill.vhd) | [link](files/psi_common_tdm_par_fill.md)
91+
***
92+
93+
### Arbiters components
94+
Component | Source | Description
95+
--------------------|-------------------------------------------------------------|:----------------------------------------:
96+
Priority | [psi_common_arb_priority.vhd](../hdl/psi_common_arb_priority.vhd) | [link](files/psi_common_arb_priority.md)
97+
Round robin | [psi_common_arb_round_robin.vhd](../hdl/psi_common_arb_round_robin.vhd) | [link](files/psi_common_arb_round_robin.md)
98+
99+
***
100+
101+
### Interfaces components
102+
Package | Source | Description
103+
--------------------------|-----------------------------------------------------------------------------|:----------------------------------------:
104+
SPI master | [psi_common_spi_master.vhd](../hdl/psi_common_spi_master.vhd) | [link](files/psi_common_spi_master.md)
105+
SPI master configurable width | [psi_common_spi_master_cfg.vhd](../hdl/psi_common_spi_master_cfg.vhd) | [link](files/psi_common_spi_master_cfg.md)
106+
I2C master | [psi_common_i2c_master.vhd](../hdl/psi_common_i2c_master.vhd) | [link](files/psi_common_i2c_master.md)
107+
AXI master Simple | [psi_common_axi_master_simple.vhd](../hdl/psi_common_axi_master_simple.vhd) | [link](files/psi_common_axi_master_simple.md)
108+
AXI master Full | [psi_common_axi_master_full.vhd](../hdl/psi_common_axi_master_full.vhd) | [link](files/psi_common_axi_master_full.md)
109+
AXI slave IP (32 bits) | [psi_common_axi_slave_ipif.vhd](../hdl/psi_common_axi_slave_ipif.vhd) | [link](files/psi_common_axi_slave_ipif.md)
110+
AXI slave IP (64 bits) | [psi_common_axi_slave_ipif64.vhd](../hdl/psi_common_axi_slave_ipif64.vhd) | N.A
111+
AXI multi pipeline stage | [psi_common_axi_multi_pl_stage.vhd](../hdl/psi_common_axi_multi_pl_stage.vhd) | N.A
112+
AXI slave Lite IP | [psi_common_axilite_slave_ipif.vhd](../hdl/psi_common_axilite_slave_ipif.vhd)|[link](files/psi_common_axilite_slave_ipif.md)
113+
***
114+
115+
### miscellaneous components
116+
Component | Source | Description
117+
----------------------------|-------------------------------------------------------------|:-------------------------------------------:
118+
Delay settable via generics | [psi_common_delay.vhd](../hdl/psi_common_delay.vhd) | [link](files/psi_common_delay.md)
119+
Pipeline stage | [psi_common_pl_stage.vhd](../hdl/psi_common_pl_stage.vhd) | [link](files/psi_common_pl_stage.md)
120+
Multi pipeline stage | [psi_common_multi_pl_stage.vhd](../hdl/psi_common_multi_pl_stage.vhd) | [link](files/psi_common_multi_pl_stage.md)
121+
Sizable Ping pong buffer // & tdm (interface to stream continuously data into DPRAM) | [psi_common_ping_pong.vhd](../hdl/psi_common_ping_pong.vhd) | [link](files/psi_common_ping_pong.md)
122+
Delay settable via register | [psi_common_delay_cfg.vhd](../hdl/psi_common_delay_cfg.vhd) | [link](files/psi_common_delay_cfg.md)
123+
Generic Watchdog | [psi_common_watchdog.vhd](../hdl/psi_common_watchdog.vhd) | [link](files/psi_common_watchdog.md)
124+
Don't optimize (Xilinx) allows evaluating synthesis | [psi_common_dont_opt.vhd](../hdl/psi_common_dont_opt.vhd) | [link](files/psi_common_dont_opt.md)
125+
Generic Debouncer | [psi_common_debouncer.vhd](../hdl/psi_common_debouncer.vhd) | [link](files/psi_common_debouncer.md)
126+
Analog Trigger Generator | [psi_common_trigger_analog.vhd](../hdl/psi_trigger_analog.vhd) | [link](files/psi_trigger_analog.md)
127+
Digital Trigger Generator | [psi_common_trigger_digital.vhd](../hdl/psi_trigger_digital.vhd) | [link](files/psi_trigger_digital.md)
128+
Dynamic Shifter | [psi_common_dyn_sft.vhd](../hdl/psi_common_dyn_sft.vhd) | [link](files/psi_common_dyn_sft.md)
129+
Pulse/Ramp generator | [psi_common_ramp_gene.vhd](../hdl/psi_common_ramp_gene.vhd) | [link](files/psi_common_ramp_gene.md)
130+
Pulse generator ctrl static | [psi_common_pulse_generator_ctrl_static.vhd](../hdl/psi_common_pulse_generator_ctrl_static.vhd) | [link](files/psi_common_pulse_generator_ctrl_static.md)
131+
Parallel to serial | [psi_common_par_ser.vhd](../hdl/psi_common_par_ser.vhd) | [link](files/psi_common_par_ser.md)
132+
Serial to parallel | [psi_common_ser_par.vhd](../hdl/psi_common_ser_par.vhd) | [link](files/psi_common_ser_par.md)
133+
Find Min Max | [psi_common_find_min_max.vhd](../hdl/psi_common_find_min_max.vhd) | [link](files/psi_common_find_min_max.md)
134+
Min Max Sum | [psi_common_find_min_max.vhd](../hdl/psi_common_min_max_sum.vhd) | [link](files/psi_common_min_max_sum.md)
135+
PRBS | [psi_common_prbs.vhd](../hdl/psi_common_prbs.vhd) | [link](files/psi_common_prbs.md)
136+
PWM | [psi_common_pwm.vhd](../hdl/psi_common_pwm.vhd) | [link](files/psi_common_pwm.md) |
137+
***
138+
139+
### Packages
140+
141+
Package | Source |
142+
--------------------|-------------------------------------------------------------|
143+
Math | [psi_common_math_pkg.vhd](../hdl/psi_common_math_pkg.vhd) |
144+
array | [psi_common_array_pkg.vhd](../hdl/psi_common_array_pkg.vhd) |
145+
logic | [psi_common_logic_pkg.vhd](../hdl/psi_common_logic_pkg.vhd) |
146+
AXI | [psi_common_axi_pkg.vhd](../hdl/psi_common_axi_pkg.vhd) |
File renamed without changes.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<img align="right" src="../psi_logo.png">
2+
3+
***
4+
5+
[**component list**](../README.md)
6+
7+
# psi_common_arb_priority
8+
- VHDL source: [psi_common_arb_priority](../../hdl/psi_common_arb_priority.vhd)
9+
- Testbench source: [psi_common_arb_priority_tb.vhd](../../testbench/psi_common_arb_priority_tb/psi_common_arb_priority_tb.vhd)
10+
11+
### Description
12+
13+
This entity implements a priority arbiter. The left-most bit (highest bit) of the request vector that was asserted is granted (i.e. asserted in the grant vector). The arbiter is implemented using the very logic-
14+
and timing-efficient parallel prefix computation approach.
15+
16+
The arbiter can be implemented with or without an output register. The waveform below shows its implementation without output register (*OutputRegister\_g = false*), since the delay would make the waveform less easy to read.
17+
18+
<p align="center"><img src="psi_common_arb_priority_fig0.png"></p>
19+
20+
### Generics
21+
| Name | type | Description |
22+
|:----------|:----------|:--------------------|
23+
| size_g | natural | Size of the arbiter (number of input/output bits)
24+
| out_reg_g | boolean | True = Registered output False = Combinatorial output
25+
| rst_pol_g | std_logic | reset polarity
26+
27+
### Interfaces
28+
| Name | In/Out | Length | Description |
29+
|:--------|:---------|:---------|:---------------------------|
30+
| clk_i | i | 1 | Clock
31+
| rst_i | i | 1 | Reset (high active)
32+
| req_i | i | size_g | Request input signals, The highest (left-most) bit has highest priority
33+
| grant_o | o | size_g | Grant output signal
34+
35+
36+
Parallel prefix computation is used to calculate a vector that contains a '1' on the highest-priority bit that was asserted and on all bits with lower priority. The vector then looks for example like this "0001111". The bit to assert in the *Grant* output can then be determined by finding the 0-1 edge inside that vector.
37+
38+
The figure below shows the parallel prefix computation graphically.
39+
40+
<p align="center"><img src="psi_common_arb_priority_fig1.png"></p>
41+
42+
[**component list**](../README.md)
File renamed without changes.
File renamed without changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<img align="right" src="../psi_logo.png">
2+
3+
***
4+
5+
[**component list**](../README.md)
6+
7+
# psi_common_arb_round_robin
8+
- VHDL source: [psi_common_arb_round_robin](../../hdl/psi_common_arb_round_robin.vhd)
9+
- Testbench source: [psi_common_arb_round_robin_tb.vhd](../../testbench/psi_common_arb_round_robin_tb/psi_common_arb_round_robin_tb.vhd)
10+
11+
### Description
12+
13+
This entity implements a round-robin arbiter. If multiple bits are asserted in the request vector, the left-most bit is forwarded to the grant vector first. Next, the second left-most bit that is set is forwarded etc. Whenever at least one bit in the *Grant* vector is asserted, the *Grant\_Vld* handshaking signal is asserted to signal that a request was granted. The consumer of the *Grant* vector signalizes that the granted access was executed by pulling *Grant\_Rdy* high.
14+
15+
Note that the round-robin arbiter is implemented without an output register. Therefore combinatorial paths between input and output exist and it is recommended to add a register-stage to the output as early as possible.
16+
17+
<p align="center"><img src="psi_common_arb_round_robin_fig0.png"></p>
18+
19+
Especially interesting is the part in orange. At this point the arbiter does not grant access to bit 3 because it already granted this request in the clock cycle before. However, it continues to grant access to the highest-priority (i.e. left-most) bit of the request vector that is still left of the bit set in the last *Grant* output. If the request vector asserts a higher priority this change is directly forwarded to the output. This is shown
20+
in the orange section of the waveform.
21+
22+
### Generics
23+
| Name | type | Description |
24+
|:----------|:----------|:--------------------------------------------------|
25+
| size_g | natural | Size of the arbiter (number of input/output bits) |
26+
| rst_pol_g | std_logic | reset polarity |
27+
28+
### Interfaces
29+
| Name | In/Out | Length | Description |
30+
|:------------|:---------|:---------|:---------------------------|
31+
| clk_i | i | 1 | Clock
32+
| rst_i | i | 1 | reset
33+
| request_i | i | size_g | Request input signals, The highest(left-most) bit has highest priority
34+
| grant_o | o | size_g | Grant output signal
35+
| grant_rdy_o | i | 1 | AXI-S handshaking signal, Asserted whenever Grant != 0
36+
| grant_vld_o | o | 1 | AXI-S handshaking signal The state of the arbiter is updated upon *Grant\_Rdy = '1'*
37+
38+
39+
[**component list**](../README.md)
File renamed without changes.

0 commit comments

Comments
 (0)