Closed jedrzejboczar closed 2 years ago
Thanks @jedrzejboczar, this looks very good. I'm not able to a close review now but will do when I'm back.
I fixed a typo that I noticed with https://github.com/enjoy-digital/litedram/pull/268/commits/86cde919874f55141864b96cc2ad131355ddfd2b. I tested locally that this shouldn't cause any issues when merging the following PRs (https://github.com/enjoy-digital/litedram/pull/269, https://github.com/enjoy-digital/litedram/pull/270) - git should automatically resolve any conflicts by the 'recursive' strategy.
This change set includes changes from lpddr4-update so please use the following diff to view only the additional changes: https://github.com/antmicro/litedram/compare/jboc/lpddr4-update...jboc/init-refactor
This is an update to the way init.py generates C initialization code. The following changes were made:
Generate SDRAM_PHY_DFI_DATABITS (https://github.com/enjoy-digital/litedram/commit/993ba3169785e11eeaf2e6416eb42fa123f3c113, https://github.com/enjoy-digital/litedram/commit/2200bd43a557aef22f53b0daf2b1f82d26e86d97) As described at the end of https://github.com/enjoy-digital/litedram/pull/258#issuecomment-882435501. This change is required for https://github.com/enjoy-digital/litex/pull/986.
Add C code generator class (https://github.com/enjoy-digital/litedram/commit/377746bfd833b51f7d1a0fb3ae81ced5758c63a5, https://github.com/enjoy-digital/litedram/commit/43036c9576b7ceb6f655502f959315caefdda371) This is a simple helper to simplify code generation instead of manually adding strings. While the
.define()
/.include()
methods don't really make a big difference, the.block()
context manager simplifies management of indentation and closing brackets, hopefully making the code easier to read.Move more PHY-related options to PhySettings (https://github.com/enjoy-digital/litedram/commit/46ea84470288db32bc21ef7452c15a3f54052329) Things like delay/bitslip counts and support of different leveling types have been moved from the common code in init.py to PhySettings. I think this can make it simpler to maintain PHYs as these settings are directly related to the CSRs/HW blocks used in a given PHY.
There is also a minor change in https://github.com/enjoy-digital/litedram/commit/91cae335e593ee8d828b08b5447d9a7817e37da8 to make the macro more bullet-proof.