vhdl_help 0.4.1 → 0.4.2
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.
- checksums.yaml +4 -4
 - data/lib/templates/file_read.vhd +36 -0
 - data/lib/templates/file_write.vhd +28 -0
 - data/lib/templates/sw_emulation.vhd +63 -0
 - data/lib/vhdl_helper.rb +2 -1
 - metadata +4 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 857ffe4c3fd8be5eed3fe3319514e61e8d933466
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 7a344f4ed091dcfd84cf872c1af1685019e9d75f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b2ce45e4c740368df4df2ae852bdf20d2f1111fab7bcc0dc38942dd8e775fbea616172a5c598061be86d608870f0fd3f8dc5cea4c4b7ebc91f0a72989fb64d99
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e0db31838aff28f73d364f356a3e73489ee73a157d1fe7a4f17dd3efcfe2b42e3229c0218e967f93ba11b6a35be14ece46e1e601fe5fa87764df50edc95b19c9
         
     | 
| 
         @@ -0,0 +1,36 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            stimuli_proc : process
         
     | 
| 
      
 2 
     | 
    
         
            +
               file F : text;
         
     | 
| 
      
 3 
     | 
    
         
            +
               variable L: line;
         
     | 
| 
      
 4 
     | 
    
         
            +
               variable status : file_open_status;
         
     | 
| 
      
 5 
     | 
    
         
            +
               variable data : integer;
         
     | 
| 
      
 6 
     | 
    
         
            +
               variable nb_samples : natural := 0;
         
     | 
| 
      
 7 
     | 
    
         
            +
              begin
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                report "n (window size) = " & integer'image(n);
         
     | 
| 
      
 10 
     | 
    
         
            +
                report "sample_width    = " & integer'image(sample_width);
         
     | 
| 
      
 11 
     | 
    
         
            +
                report "output_width    = " & integer'image(output_width);
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                FILE_OPEN(status,F,"samples.txt",read_mode);
         
     | 
| 
      
 14 
     | 
    
         
            +
                if status/=open_ok then
         
     | 
| 
      
 15 
     | 
    
         
            +
                  report "problem to open stimulus file samples.text" severity error;
         
     | 
| 
      
 16 
     | 
    
         
            +
                else
         
     | 
| 
      
 17 
     | 
    
         
            +
                  sample <= to_signed(0,sample_width);
         
     | 
| 
      
 18 
     | 
    
         
            +
                  sample_valid <= '0';
         
     | 
| 
      
 19 
     | 
    
         
            +
                  wait until reset_n='1';
         
     | 
| 
      
 20 
     | 
    
         
            +
                  report "size of moving average : " & integer'image(n);
         
     | 
| 
      
 21 
     | 
    
         
            +
                  report "starting samples...";
         
     | 
| 
      
 22 
     | 
    
         
            +
                  while not(ENDFILE(f)) loop
         
     | 
| 
      
 23 
     | 
    
         
            +
                    nb_samples:=nb_samples+1;
         
     | 
| 
      
 24 
     | 
    
         
            +
                    wait until rising_edge(clk);
         
     | 
| 
      
 25 
     | 
    
         
            +
                    readline(F,l);
         
     | 
| 
      
 26 
     | 
    
         
            +
                    read(l,data);
         
     | 
| 
      
 27 
     | 
    
         
            +
                    sample <= to_signed(data,sample_width);
         
     | 
| 
      
 28 
     | 
    
         
            +
                    sample_valid <= '1';
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end loop;
         
     | 
| 
      
 30 
     | 
    
         
            +
                  sample_valid <= '0';
         
     | 
| 
      
 31 
     | 
    
         
            +
                  report "end of simulation";
         
     | 
| 
      
 32 
     | 
    
         
            +
                  report integer'image(nb_samples) & " samples processed.";
         
     | 
| 
      
 33 
     | 
    
         
            +
                end if;
         
     | 
| 
      
 34 
     | 
    
         
            +
                running <= false;
         
     | 
| 
      
 35 
     | 
    
         
            +
                wait;
         
     | 
| 
      
 36 
     | 
    
         
            +
              end process;
         
     | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            -- procedure WRITE(L : inout LINE; VALUE : in integer; JUSTIFIED: in SIDE := right; FIELD: in WIDTH := 0);
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            signal o_valid        : std_logic;
         
     | 
| 
      
 5 
     | 
    
         
            +
            signal o_add          : std_logic_vector(7 downto 0);
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            --SKIPPED
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            p_dump  : process(i_rstb,i_clk)
         
     | 
| 
      
 10 
     | 
    
         
            +
              file test_vector      : text open write_mode is "output_file.txt";
         
     | 
| 
      
 11 
     | 
    
         
            +
              variable row          : line;
         
     | 
| 
      
 12 
     | 
    
         
            +
            begin
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              if (i_rstb='0') then
         
     | 
| 
      
 15 
     | 
    
         
            +
              -- SKIPPED
         
     | 
| 
      
 16 
     | 
    
         
            +
              elsif(rising_edge(i_clk)) then
         
     | 
| 
      
 17 
     | 
    
         
            +
                if(o_valid = '1') then
         
     | 
| 
      
 18 
     | 
    
         
            +
                  write(row,o_add, right, 15);
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  write(row,conv_integer(o_add), right, 15);
         
     | 
| 
      
 21 
     | 
    
         
            +
                  hwrite(row,o_add, right, 15);
         
     | 
| 
      
 22 
     | 
    
         
            +
                  hwrite(row,"00000000"&o_add, right, 15);
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  writeline(test_vector,row);
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                end if;
         
     | 
| 
      
 27 
     | 
    
         
            +
              end if;
         
     | 
| 
      
 28 
     | 
    
         
            +
            end process p_dump;
         
     | 
| 
         @@ -0,0 +1,63 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            embedded_software_emulation : process
         
     | 
| 
      
 2 
     | 
    
         
            +
                procedure clean  is
         
     | 
| 
      
 3 
     | 
    
         
            +
                begin
         
     | 
| 
      
 4 
     | 
    
         
            +
                  ce <= '0';
         
     | 
| 
      
 5 
     | 
    
         
            +
                  we <= '0';
         
     | 
| 
      
 6 
     | 
    
         
            +
                  address <= (others=>'0');
         
     | 
| 
      
 7 
     | 
    
         
            +
                  datain  <= (others=>'0');
         
     | 
| 
      
 8 
     | 
    
         
            +
                  wait_cycles(1);
         
     | 
| 
      
 9 
     | 
    
         
            +
                end procedure;
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                procedure write_bus(addr : unsigned; data : std_logic_vector) is
         
     | 
| 
      
 12 
     | 
    
         
            +
                begin
         
     | 
| 
      
 13 
     | 
    
         
            +
                  wait_cycles(1);
         
     | 
| 
      
 14 
     | 
    
         
            +
                  ce <= '1';
         
     | 
| 
      
 15 
     | 
    
         
            +
                  we <= '1';
         
     | 
| 
      
 16 
     | 
    
         
            +
                  address <= addr;
         
     | 
| 
      
 17 
     | 
    
         
            +
                  datain  <= data;
         
     | 
| 
      
 18 
     | 
    
         
            +
                  wait_cycles(1);
         
     | 
| 
      
 19 
     | 
    
         
            +
                  ce <= '0';
         
     | 
| 
      
 20 
     | 
    
         
            +
                  we <= '0';
         
     | 
| 
      
 21 
     | 
    
         
            +
                  address <= (others=>'0');
         
     | 
| 
      
 22 
     | 
    
         
            +
                  datain  <= (others=>'0');
         
     | 
| 
      
 23 
     | 
    
         
            +
                end procedure;
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                procedure read_bus(addr:unsigned) is
         
     | 
| 
      
 26 
     | 
    
         
            +
                begin
         
     | 
| 
      
 27 
     | 
    
         
            +
                  wait_cycles(1);
         
     | 
| 
      
 28 
     | 
    
         
            +
                  ce <= '1';
         
     | 
| 
      
 29 
     | 
    
         
            +
                  we <= '0';
         
     | 
| 
      
 30 
     | 
    
         
            +
                  address <= addr;
         
     | 
| 
      
 31 
     | 
    
         
            +
                  wait_cycles(1);
         
     | 
| 
      
 32 
     | 
    
         
            +
                  ce <= '0';
         
     | 
| 
      
 33 
     | 
    
         
            +
                  address <= (others=>'0');
         
     | 
| 
      
 34 
     | 
    
         
            +
                  datain  <= (others=>'0');
         
     | 
| 
      
 35 
     | 
    
         
            +
                end procedure;
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                variable reg_val : unsigned(63 downto 0);
         
     | 
| 
      
 38 
     | 
    
         
            +
               begin
         
     | 
| 
      
 39 
     | 
    
         
            +
                 clean;
         
     | 
| 
      
 40 
     | 
    
         
            +
                 report "running testbench for ip_ms_mergesort";
         
     | 
| 
      
 41 
     | 
    
         
            +
                 report "waiting for asynchronous reset";
         
     | 
| 
      
 42 
     | 
    
         
            +
                 wait until reset_n='1';
         
     | 
| 
      
 43 
     | 
    
         
            +
                 wait_cycles(10);
         
     | 
| 
      
 44 
     | 
    
         
            +
                 report "applying stimuli...";
         
     | 
| 
      
 45 
     | 
    
         
            +
                 write_bus(ADDR_REG_AP_START,x"0000000000000001");
         
     | 
| 
      
 46 
     | 
    
         
            +
                 write_bus(ADDR_REG_AP_START,x"0000000000000000");
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                 polling: while true loop
         
     | 
| 
      
 49 
     | 
    
         
            +
                   read_bus(ADDR_REG_AP_DONE);
         
     | 
| 
      
 50 
     | 
    
         
            +
                   reg_val := unsigned(dataout);
         
     | 
| 
      
 51 
     | 
    
         
            +
                   report "dataout = " & integer'image(to_integer(reg_val(31 downto 0)));
         
     | 
| 
      
 52 
     | 
    
         
            +
                   if reg_val=x"0000000000000001" then
         
     | 
| 
      
 53 
     | 
    
         
            +
                     exit polling;
         
     | 
| 
      
 54 
     | 
    
         
            +
                   end if;
         
     | 
| 
      
 55 
     | 
    
         
            +
                 end loop;
         
     | 
| 
      
 56 
     | 
    
         
            +
                 work.tunnels.dump_memory <= true;
         
     | 
| 
      
 57 
     | 
    
         
            +
                 report "";
         
     | 
| 
      
 58 
     | 
    
         
            +
                 wait_cycles(30);
         
     | 
| 
      
 59 
     | 
    
         
            +
                 report "end of simulation";
         
     | 
| 
      
 60 
     | 
    
         
            +
                 running <=false;
         
     | 
| 
      
 61 
     | 
    
         
            +
                 wait;
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
               end process;
         
     | 
    
        data/lib/vhdl_helper.rb
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ require 'optparse' 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            class VhdlHelper
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              VERSION = "0.4. 
     | 
| 
      
 8 
     | 
    
         
            +
              VERSION = "0.4.2"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              def initialize
         
     | 
| 
       11 
11 
     | 
    
         
             
                puts "-- "+"="*60
         
     | 
| 
         @@ -62,6 +62,7 @@ class VhdlHelper 
     | 
|
| 
       62 
62 
     | 
    
         
             
                path=__dir__+"/templates/*.vhd"
         
     | 
| 
       63 
63 
     | 
    
         
             
                files=Dir[path]
         
     | 
| 
       64 
64 
     | 
    
         
             
                concepts=files.collect{|filename| filename.split("/").last.match(/(.*).vhd/)[1]}
         
     | 
| 
      
 65 
     | 
    
         
            +
                concepts.sort!
         
     | 
| 
       65 
66 
     | 
    
         
             
                concepts.each do |concept|
         
     | 
| 
       66 
67 
     | 
    
         
             
                  puts "- #{concept}"
         
     | 
| 
       67 
68 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: vhdl_help
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jean-Christophe Le Lann
         
     | 
| 
         @@ -22,11 +22,14 @@ files: 
     | 
|
| 
       22 
22 
     | 
    
         
             
            - lib/templates/conversions.vhd
         
     | 
| 
       23 
23 
     | 
    
         
             
            - lib/templates/counter.vhd
         
     | 
| 
       24 
24 
     | 
    
         
             
            - lib/templates/entity.vhd
         
     | 
| 
      
 25 
     | 
    
         
            +
            - lib/templates/file_read.vhd
         
     | 
| 
      
 26 
     | 
    
         
            +
            - lib/templates/file_write.vhd
         
     | 
| 
       25 
27 
     | 
    
         
             
            - lib/templates/fsm.vhd
         
     | 
| 
       26 
28 
     | 
    
         
             
            - lib/templates/header.vhd
         
     | 
| 
       27 
29 
     | 
    
         
             
            - lib/templates/memory.vhd
         
     | 
| 
       28 
30 
     | 
    
         
             
            - lib/templates/procedure.vhd
         
     | 
| 
       29 
31 
     | 
    
         
             
            - lib/templates/skeleton.vhd
         
     | 
| 
      
 32 
     | 
    
         
            +
            - lib/templates/sw_emulation.vhd
         
     | 
| 
       30 
33 
     | 
    
         
             
            - lib/templates/testbench.vhd
         
     | 
| 
       31 
34 
     | 
    
         
             
            - lib/vhdl_helper.rb
         
     | 
| 
       32 
35 
     | 
    
         
             
            homepage: http://rubygems.org/gems/vhdl_help
         
     |