Advertisement
Guest User

Untitled

a guest
May 15th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.95 KB | None | 0 0
  1. diff --git a/examples/litedram_gen.py b/examples/litedram_gen.py
  2. index bb68fb2..ab8e6a2 100755
  3. --- a/examples/litedram_gen.py
  4. +++ b/examples/litedram_gen.py
  5. @@ -71,6 +71,16 @@ def get_dram_ios(core_config):
  6.          ),
  7.      ]
  8.  
  9. +def get_csr_ios(aw, dw):
  10. +    return [
  11. +        ("csr_port", 0,
  12. +            Subsignal("adr", Pins(aw)),
  13. +            Subsignal("we", Pins(1)),
  14. +            Subsignal("dat_w", Pins(dw)),
  15. +            Subsignal("dat_r", Pins(dw))
  16. +        ),
  17. +    ]
  18. +
  19.  def get_native_user_port_ios(_id, aw, dw):
  20.      return [
  21.          ("user_port", _id,
  22. @@ -197,6 +207,7 @@ class LiteDRAMCore(SoCSDRAM):
  23.          SoCSDRAM.__init__(self, platform, sys_clk_freq,
  24.              cpu_type=core_config["cpu"],
  25.              l2_size=16*core_config["sdram_module_nb"],
  26. +            csr_expose=(core_config["expose_csr_port"] == "yes"),
  27.              **kwargs)
  28.  
  29.          # crg
  30. @@ -234,6 +245,19 @@ class LiteDRAMCore(SoCSDRAM):
  31.              platform.request("init_error").eq(self.ddrctrl.init_error.storage)
  32.          ]
  33.  
  34. +        # CSR port
  35. +        if core_config["expose_csr_port"] == "yes":
  36. +            csr_port = self.csr # FIXME: this is probably incorrect -- GLS
  37. +            platform.add_extension(get_csr_ios(self.csr_address_width,
  38. +                                               self.csr_data_width))
  39. +            _csr_port_io = platform.request("csr_port", 0)
  40. +            self.comb += [
  41. +                csr_port.adr.eq(_csr_port_io.adr),
  42. +                csr_port.we.eq(_csr_port_io.we),
  43. +                csr_port.dat_w.eq(_csr_port_io.dat_w),
  44. +                _csr_port_io.dat_r.eq(csr_port.dat_w),
  45. +            ]
  46. +
  47.          # user port
  48.          self.comb += [
  49.              platform.request("user_clk").eq(ClockSignal()),
  50. diff --git a/examples/nexys4ddr_config.py b/examples/nexys4ddr_config.py
  51. index efa597e..9c34002 100644
  52. --- a/examples/nexys4ddr_config.py
  53. +++ b/examples/nexys4ddr_config.py
  54. @@ -3,7 +3,7 @@ from litedram.phy import A7DDRPHY
  55.  
  56.  core_config = {
  57.      # General ------------------------------------------------------------------
  58. -    "cpu":        "vexriscv",  # Type of CPU used for init/calib (vexriscv, lm32)
  59. +    "cpu":        "None",  # Type of CPU used for init/calib (vexriscv, lm32)
  60.      "speedgrade": -1,          # FPGA speedgrade
  61.      "memtype":    "DDR2",      # DRAM type
  62.  
  63. @@ -24,7 +24,10 @@ core_config = {
  64.      "cmd_buffer_depth": 16,    # Depth of the command buffer
  65.  
  66.      # User Ports ---------------------------------------------------------------
  67. -    "user_ports_nb":       2,     # Number of user ports
  68. +    "user_ports_nb":       1,     # Number of user ports
  69.      "user_ports_type":     "axi", # Type of ports (axi, native)
  70. -    "user_ports_id_width": 32,    # AXI identifier width
  71. +    "user_ports_id_width": 4,    # AXI identifier width
  72. +
  73. +    # CSR Port -----------------------------------------------------------------
  74. +    "expose_csr_port": "yes", # expose access to CSR (I/O) ports
  75.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement