OpenCores
URL https://opencores.org/ocsvn/t80/t80/trunk

Subversion Repositories t80

[/] [t80/] [trunk/] [sw/] [xrom.cpp] - Diff between revs 4 and 5

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 4 Rev 5
Line 1... Line 1...
//
//
// Xilinx VHDL ROM generator
// Xilinx VHDL ROM generator
//
//
// Version : 0220
// Version : 0221
//
//
// Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
// Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org)
//
//
// All rights reserved
// All rights reserved
//
//
Line 46... Line 46...
//
//
// File history :
// File history :
//
//
// 0220 : Initial release
// 0220 : Initial release
//
//
 
// 0221 : Fixed block ROMs with partial bytes
 
 
#include <stdio.h>
#include <stdio.h>
#include <string>
#include <string>
#include <vector>
#include <vector>
#include <iostream>
#include <iostream>
Line 61... Line 62...
        #define max __max
        #define max __max
#endif
#endif
 
 
int main (int argc, char *argv[])
int main (int argc, char *argv[])
{
{
        cerr << "Xilinx VHDL ROM generator by Daniel Wallner. Version 0220\n";
        cerr << "Xilinx VHDL ROM generator by Daniel Wallner. Version 0221\n";
 
 
        try
        try
        {
        {
                unsigned long aWidth;
                unsigned long aWidth;
                unsigned long dWidth;
                unsigned long dWidth;
Line 178... Line 179...
                }
                }
                if (selectIter && blockIter)
                if (selectIter && blockIter)
                {
                {
                        printf("\n\tsignal sD : std_logic_vector(D'range);");
                        printf("\n\tsignal sD : std_logic_vector(D'range);");
                }
                }
 
                if (blockIter == 1)
 
                {
 
                        printf("\n\tsignal bRAMOut : std_logic_vector(%d downto 0);", bytes * 8 - 1);
 
                }
                if (blockIter > 1)
                if (blockIter > 1)
                {
                {
                        printf("\n\ttype bRAMOut_a is array(%d to %d) of std_logic_vector(D'range);", blockTotal - blockIter, blockTotal - 1);
                        printf("\n\ttype bRAMOut_a is array(%d to %d) of std_logic_vector(%d downto 0);", blockTotal - blockIter, blockTotal - 1, bytes * 8 - 1);
                        printf("\n\tsignal bRAMOut : bRAMOut_a;");
                        printf("\n\tsignal bRAMOut : bRAMOut_a;");
                        printf("\n\tsignal biA_r : integer;");
                        printf("\n\tsignal biA_r : integer;");
                        if (!selectIter)
                        if (!selectIter)
                        {
                        {
                                printf("\n\tsignal A_r : unsigned(A'left downto 9);");
                                printf("\n\tsignal A_r : unsigned(A'left downto 9);");
Line 262... Line 267...
                }
                }
 
 
                if (blockIter == 1)
                if (blockIter == 1)
                {
                {
                        printf("\n\n\tbG1: for J in 0 to %d generate", bytes - 1);
                        printf("\n\n\tbG1: for J in 0 to %d generate", bytes - 1);
                        printf("\n\t\tB%s : RAMB4_S8\n\t\t\tport map (\"00000000\", '1', '0', '0', Clk, A(8 downto 0), ", argv[1]);
                        printf("\n\t\tB%s : RAMB4_S8", argv[1]);
 
                        printf("\n\t\t\tport map (\"00000000\", '1', '0', '0', Clk, A(8 downto 0), bRAMOut(7 + 8 * J downto 8 * J));", argv[1]);
 
                        printf("\n\tend generate;");
 
                        printf("\n\n\t");
                        if (selectIter)
                        if (selectIter)
                        {
                        {
                                printf("b");
                                printf("b");
                        }
                        }
                        printf("D(7 + 8 * J downto 8 * J));");
                        printf("D <= bRAMOut(D'range);");
                        printf("\n\tend generate;");
 
                }
                }
                if (blockIter > 1)
                if (blockIter > 1)
                {
                {
                        printf("\n\n\tbiA_r <= to_integer(A_r(A'left downto 9));");
                        printf("\n\n\tbiA_r <= to_integer(A_r(A'left downto 9));");
                        printf("\n\n\tbG1: for I in %d to %d generate", blockTotal - blockIter, blockTotal - 1);
                        printf("\n\n\tbG1: for I in %d to %d generate", blockTotal - blockIter, blockTotal - 1);
Line 294... Line 301...
                                printf("\n\n\tprocess (biA_r, bRAMOut)\n\tbegin\n\t\t");
                                printf("\n\n\tprocess (biA_r, bRAMOut)\n\tbegin\n\t\t");
                                if (selectIter)
                                if (selectIter)
                                {
                                {
                                        printf("b");
                                        printf("b");
                                }
                                }
                                printf("D <= bRAMOut(%d)(%d downto 0);", blockTotal - blockIter, dWidth - 1);
                                printf("D <= bRAMOut(%d)(D'range);", blockTotal - blockIter);
                                printf("\n\t\tfor I in %d to %d loop", blockTotal - blockIter + 1, blockTotal - 1);
                                printf("\n\t\tfor I in %d to %d loop", blockTotal - blockIter + 1, blockTotal - 1);
                                printf("\n\t\t\tif biA_r = I then\n\t\t\t\t");
                                printf("\n\t\t\tif biA_r = I then\n\t\t\t\t");
                                if (selectIter)
                                if (selectIter)
                                {
                                {
                                        printf("b");
                                        printf("b");
                                }
                                }
                                printf("D <= bRAMOut(I);\n\t\t\tend if;");
                                printf("D <= bRAMOut(I)(D'range);\n\t\t\tend if;");
                                printf("\n\t\tend loop;\n\tend process;");
                                printf("\n\t\tend loop;\n\tend process;");
                        }
                        }
                }
                }
 
 
                if (selectIter && blockIter)
                if (selectIter && blockIter)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.