HDLRuby 2.4.14 → 2.4.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1704,6 +1704,127 @@ HDLRuby::High::Std.channel(:mem_bank) do |typ,nbanks,size,clk,rst,br_rsts = {}|
1704
1704
 
1705
1705
  end
1706
1706
 
1707
+
1708
+ # Queue memory of +size+ elements of +typ+ typ, syncrhonized on +clk+
1709
+ # (positive and negative edges) and reset on +rst+.
1710
+ # At each rising edge of +clk+ a read and a write is guaranteed to be
1711
+ # completed provided they are triggered.
1712
+ #
1713
+ # NOTE: this channel does not have any branch.
1714
+ HDLRuby::High::Std.channel(:mem_queue) do |typ,size,clk,rst|
1715
+ # The inner buffer of the queue.
1716
+ typ[-size].inner :buffer
1717
+ # The read and write pointers.
1718
+ [size.width].inner :rptr, :wptr
1719
+ # The read and write command signals.
1720
+ inner :rreq, :wreq
1721
+ # The read and write ack signals.
1722
+ inner :rack, :wack
1723
+ # The read/write data registers.
1724
+ typ.inner :rdata, :wdata
1725
+
1726
+ # The flags telling of the channel is synchronized
1727
+ inner :rsync, :wsync
1728
+
1729
+ # The process handling the decoupled access to the buffer.
1730
+ par(clk.posedge) do
1731
+ hif(rst) { rptr <= 0; wptr <= 0 }
1732
+ helse do
1733
+ hif(~rsync) do
1734
+ hif (~rreq) { rack <= 0 }
1735
+ hif(rreq & (~rack) & (rptr != wptr)) do
1736
+ rdata <= buffer[rptr]
1737
+ rptr <= (rptr + 1) % depth
1738
+ rack <= 1
1739
+ end
1740
+ end
1741
+
1742
+ hif(~wsync) do
1743
+ hif (~wreq) { wack <= 0 }
1744
+ hif(wreq & (~wack) & (((wptr+1) % size) != rptr)) do
1745
+ buffer[wptr] <= wdata
1746
+ wptr <= (wptr + 1) % size
1747
+ wack <= 1
1748
+ end
1749
+ end
1750
+ end
1751
+ end
1752
+
1753
+ reader_output :rreq, :rptr, :rsync
1754
+ reader_input :rdata, :rack, :wptr, :buffer
1755
+
1756
+ # The read primitive.
1757
+ reader do |blk,target|
1758
+ if (cur_behavior.on_event?(clk.posedge,clk.negedge)) then
1759
+ # Same clk event, synchrone case: perform a direct access.
1760
+ # Now perform the access.
1761
+ top_block.unshift do
1762
+ rsync <= 1
1763
+ rreq <= 0
1764
+ end
1765
+ seq do
1766
+ hif(rptr != wptr) do
1767
+ # target <= rdata
1768
+ target <= buffer[rptr]
1769
+ rptr <= (rptr + 1) % size
1770
+ blk.call if blk
1771
+ end
1772
+ end
1773
+ else
1774
+ # Different clk event, perform a decoupled access.
1775
+ top_block.unshift do
1776
+ rsync <= 0
1777
+ rreq <= 0
1778
+ end
1779
+ par do
1780
+ hif (~rack) { rreq <= 1 }
1781
+ helsif(rreq) do
1782
+ rreq <= 0
1783
+ target <= rdata
1784
+ blk.call if blk
1785
+ end
1786
+ end
1787
+ end
1788
+ end
1789
+
1790
+ writer_output :wreq, :wdata, :wptr, :wsync, :buffer
1791
+ writer_input :wack, :rptr
1792
+
1793
+ # The write primitive.
1794
+ writer do |blk,target|
1795
+ if (cur_behavior.on_event?(clk.negedge,clk.posedge)) then
1796
+ # Same clk event, synchrone case: perform a direct access.
1797
+ top_block.unshift do
1798
+ wsync <= 1
1799
+ wreq <= 0
1800
+ end
1801
+ hif(((wptr+1) % size) != rptr) do
1802
+ buffer[wptr] <= target
1803
+ wptr <= (wptr + 1) % size
1804
+ blk.call if blk
1805
+ end
1806
+ else
1807
+ # Different clk event, asynchrone case: perform a decoupled access.
1808
+ top_block.unshift do
1809
+ wsync <= 0
1810
+ wreq <= 0
1811
+ end
1812
+ seq do
1813
+ hif (~wack) do
1814
+ wreq <= 1
1815
+ wdata <= target
1816
+ end
1817
+ helsif(wreq) do
1818
+ wreq <= 0
1819
+ blk.call if blk
1820
+ end
1821
+ end
1822
+ end
1823
+ end
1824
+ end
1825
+
1826
+
1827
+
1707
1828
  # HDLRuby::High::Std.channel(:mem_bank) do |typ,nbanks,size,clk,rst,br_rsts = {}|
1708
1829
  # # Ensure typ is a type.
1709
1830
  # typ = typ.to_type
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.4.14"
2
+ VERSION = "2.4.20"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.14
4
+ version: 2.4.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-16 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,10 @@ files:
66
66
  - lib/HDLRuby/alcc.rb
67
67
  - lib/HDLRuby/backend/hruby_allocator.rb
68
68
  - lib/HDLRuby/backend/hruby_c_allocator.rb
69
+ - lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_hs_32.v
70
+ - lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_qu_213.v
71
+ - lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_qu_222.v
72
+ - lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_rg_23.v
69
73
  - lib/HDLRuby/hdr_samples/adder.rb
70
74
  - lib/HDLRuby/hdr_samples/adder_assign_error.rb
71
75
  - lib/HDLRuby/hdr_samples/adder_bench.rb
@@ -84,6 +88,7 @@ files:
84
88
  - lib/HDLRuby/hdr_samples/include.rb
85
89
  - lib/HDLRuby/hdr_samples/instance_open.rb
86
90
  - lib/HDLRuby/hdr_samples/linear_test.rb
91
+ - lib/HDLRuby/hdr_samples/make_multi_channels_v.rb
87
92
  - lib/HDLRuby/hdr_samples/make_multi_channels_vcd.rb
88
93
  - lib/HDLRuby/hdr_samples/mei8.rb
89
94
  - lib/HDLRuby/hdr_samples/mei8_bench.rb
@@ -121,6 +126,7 @@ files:
121
126
  - lib/HDLRuby/hdr_samples/with_channel.rb
122
127
  - lib/HDLRuby/hdr_samples/with_class.rb
123
128
  - lib/HDLRuby/hdr_samples/with_connector.rb
129
+ - lib/HDLRuby/hdr_samples/with_connector_memory.rb
124
130
  - lib/HDLRuby/hdr_samples/with_decoder.rb
125
131
  - lib/HDLRuby/hdr_samples/with_fixpoint.rb
126
132
  - lib/HDLRuby/hdr_samples/with_fsm.rb