Sha256: 8e82ab1e2ec68e2f259151359bf78dd60dc9d705dd4f718feb616e6fa3a7f769

Contents?: true

Size: 1.27 KB

Versions: 100

Compression:

Stored size: 1.27 KB

Contents

require 'HDLRuby'

configure_high

# Describes an 8-bit data 16-bit address memory.
system :mem8_16 do
    input :clk, :rwb
    [15..0].input :addr
    [7..0].inout :data

    bit[7..0][2**16].inner :content
    
    par(clk.posedge) do
        hif(rwb) { data <= content[addr] }
        helse    { content[addr] <= data }
    end
end

# Instantiate it for checking.
mem8_16 :mem8_16I


# Describes a 16-bit memory made of 8-bit memories.
system :mem16_16 do
    input :clk, :rwb
    [15..0].input :addr
    [15..0].inout :data

    mem8_16(:memL).(clk: clk, rwb: rwb, addr: addr, data: data[7..0])
    mem8_16(:memH).(clk: clk, rwb: rwb, addr: addr, data: data[15..8])
end

# Instantiate it for checking.
mem16_16 :mem16_16I


# Describes a 16-bit memory made of 8-bit memories the long way.
system :mem16_16_long do
    input :clk, :rwb
    [15..0].input :addr
    [15..0].inout :data

    mem8_16 [:memL, :memH]

    memL.clk  <= clk
    memL.rwb  <= rwb
    memL.addr <= addr
    memL.data <= data[7..0]

    memH.clk  <= clk
    memH.rwb  <= rwb
    memH.addr <= addr
    memH.data <= data[15..8]
end

# Instantiate it for checking.
mem16_16_long :mem16_16_longI

# Generate the low level representation.
# low = mem16_16I.to_low
low = mem16_16_longI.systemT.to_low

# Displays it
puts low.to_yaml

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
HDLRuby-3.4.0 lib/HDLRuby/high_samples/memory.rb
HDLRuby-3.3.4 lib/HDLRuby/high_samples/memory.rb
HDLRuby-3.3.3 lib/HDLRuby/high_samples/memory.rb
HDLRuby-3.3.1 lib/HDLRuby/high_samples/memory.rb
HDLRuby-3.3.0 lib/HDLRuby/high_samples/memory.rb
HDLRuby-3.2.0 lib/HDLRuby/high_samples/memory.rb
HDLRuby-3.1.0 lib/HDLRuby/high_samples/memory.rb
HDLRuby-3.0.0 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.12 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.11 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.10 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.9 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.8 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.7 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.5 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.4 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.3 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.2 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.11.0 lib/HDLRuby/high_samples/memory.rb
HDLRuby-2.10.5 lib/HDLRuby/high_samples/memory.rb