title: Instantiating a LUT and Initialising with a .coe for ModelSim/QuestaSim
body: <h2>The Background</h2>
  
  <p>This LUT needs a width of 32 and a depth of 256.</p>
  
  <p>So I have a LUT which was created by an IP core. Now I want to instantiate it myself to get it working in the sim (this also helps me learn all of the parameters myself). I've done this many times for FIFOs but never created a LUT before so please check what I've done looks correct. I just want to create a LUT of values and to be able to read them back. I used a block of RAM for this.</p>
  
  <p>I've tried on two different computers with:</p>
  
  <pre><code>QuestaSim-64 10.2c_5
  ModelSim SE-64 10.1b
  </code></pre>
  
  <h2>The Problem</h2>
  
  <p>So I can compile the code. When I try to open it:</p>
  
  <pre><code>vsim work.top
  </code></pre>
  
  <p>It opens the IDE and freezes on:</p>
  
  <pre><code># Loading unisim.rb36_internal_vhdl(rb36_internal_vhdl_v)#1
  </code></pre>
  
  <p>If I remove:</p>
  
  <pre><code>INIT_FILE =&gt; "lut.coe",
  </code></pre>
  
  <p>Then it loads up fine. So I know that line crashes it.</p>
  
  <h2>The LUT:</h2>
  
  <p>So I have a LUT, does this look correct to you? Is there any other ways to instantiate a LUT with a .coe file?</p>
  
  <pre><code>lut : RAMB36E1 
  generic map(
      INIT_FILE =&gt; "lut.coe",
      READ_WIDTH_A =&gt; 36
      )
  port map
      (
      addrardaddr =&gt; addr_lut,
      addrbwraddr =&gt; X"0000",
      cascadeina =&gt; '0',
      cascadeinb =&gt; '0',
      clkardclk =&gt; clk_i,
      clkbwrclk =&gt; clk_i,
      diadi =&gt; X"00000000",
      dibdi =&gt; X"00000000",
      dipadip =&gt; X"0",
      dipbdip =&gt; X"0",
      doado =&gt; data_lut,
      enarden =&gt; '1',
      enbwren =&gt; '0',
      injectdbiterr =&gt; '0',
      injectsbiterr =&gt; '0' ,
      regceb =&gt; '0',
      regcearegce =&gt; '1',
      rstramarstram =&gt; rst_i,
      rstramb =&gt; rst_i,
      rstregarstreg =&gt; rst_i ,
      rstregb =&gt; rst_i,
      wea =&gt; X"0",
      webwe =&gt;  X"00"   
      );
  </code></pre>
  
  <p>Tried swapping the above out for 18kb RAM, same error:</p>
  
  <pre><code># Loading unisim.rb18_internal_vhdl(rb18_internal_vhdl_v)#2
  </code></pre>
  
  <p>LUT:</p>
  
  <pre><code>lut : RAMB18E1 -- Simple Duel Port mode, 512 deep
  generic map(
      INIT_FILE =&gt; "lut.coe",
      RAM_MODE =&gt; "SDP"
      )
  port map
      (
      addrardaddr =&gt; addr_lut,
      addrbwraddr =&gt; "00000000000000",
      clkardclk =&gt; clk_i,
      clkbwrclk =&gt; clk_i,
      diadi =&gt; X"0000",
      dibdi =&gt; X"0000",
      dipadip =&gt; "00",
      dipbdip =&gt; "00",
      doado =&gt; data_lut_b,
      dobdo =&gt; data_lut_a,
      enarden =&gt; '1',
      enbwren =&gt; '0',
      regceb =&gt; '0',
      regcearegce =&gt; '1',
      rstramarstram =&gt; rst_i,
      rstramb =&gt; rst_i,
      rstregarstreg =&gt; rst_i ,
      rstregb =&gt; rst_i,
      wea =&gt; "00",
      webwe =&gt;  X"0"   
      );
  </code></pre>