<commit_before>import os
import subprocess
import time
import collections
import json
import re
import shutil
import sys
import glob
import datetime
import asciitable
import edalize

from toolchain import Toolchain
from utils import Timed


class Vivado(Toolchain):
    '''Vivado toolchain (synth and PnR)'''
    carries = (False, False)

    def __init__(self, rootdir):
        Toolchain.__init__(self, rootdir)
        self.toolchain = 'vivado'
        self.synthtool = 'vivado'
        self.files = []
        self.edam = None
        self.backend = None

    def run(self):
        with Timed(self, 'bitstream'):
            os.makedirs(self.out_dir, exist_ok=True)
            for f in self.srcs:
                self.files.append(
                    {
                        'name': os.path.realpath(f),
                        'file_type': 'verilogSource'
                    }
                )

            self.files.append(
                {
                    'name': os.path.realpath(self.pcf),
                    'file_type': 'xdc'
                }
            )

            chip = self.family + self.device + self.package

            self.edam = {
                'files': self.files,
                'name': self.project_name,
                'toplevel': self.top,
                'parameters' : {
                    'VIVADO' : {
                        'paramtype' : 'vlogdefine',
                        'datatype' : 'int',
                        'default' : 1,
                    },
                },
                'tool_options':
                    {
                        'vivado': {
                            'part': chip,
                            'synth': self.synthtool,
                        }
                    }
            }

            self.backend = edalize.get_edatool('vivado')(
                edam=self.edam, work_root=self.out_dir
            )
            self.backend.configure("")
            self.backend.build()

    @staticmethod
    def seedable():
        return False

    @staticmethod
    def check_env():
        return {
            'vivado': have_exec('vivado'),
        }

    def max_freq(self):
        processing = False
<commit_msg>vivado: Pass VIVADO define to designs<commit_after>import os
import subprocess
import time
import collections
import json
import re
import shutil
import sys
import glob
import datetime
import asciitable
import edalize

from toolchain import Toolchain
from utils import Timed


class Vivado(Toolchain):
    '''Vivado toolchain (synth and PnR)'''
    carries = (False, False)

    def __init__(self, rootdir):
        Toolchain.__init__(self, rootdir)
        self.toolchain = 'vivado'
        self.synthtool = 'vivado'
        self.files = []
        self.edam = None
        self.backend = None

    def run(self):
        with Timed(self, 'bitstream'):
            os.makedirs(self.out_dir, exist_ok=True)
            for f in self.srcs:
                self.files.append(
                    {
                        'name': os.path.realpath(f),
                        'file_type': 'verilogSource'
                    }
                )

            self.files.append(
                {
                    'name': os.path.realpath(self.pcf),
                    'file_type': 'xdc'
                }
            )

            chip = self.family + self.device + self.package

            self.edam = {
                'files': self.files,
                'name': self.project_name,
                'toplevel': self.top,
                'parameters':
                    {
                        'VIVADO':
                            {
                                'paramtype': 'vlogdefine',
                                'datatype': 'int',
                                'default': 1,
                            },
                    },
                'tool_options':
                    {
                        'vivado': {
                            'part': chip,
                            'synth': self.synthtool,
                        }
                    }
            }

            self.backend = edalize.get_edatool('vivado')(
                edam=self.edam, work_root=self.out_dir
            )
            self.backend.configure("")
            self.backend.build()

    @staticmethod
    def seedable():
        return False

    @staticmethod
    def check_env():
        return {
            'vivado': have_exec('vivado'),
        }

    def max_freq(self):
        processing = False

{'fraction_non_alphanumeric': 0.09552172953893669, 'fraction_numerical': 0.00044120891242003087, 'mean_word_length': 1.1019935095039406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1810140', 'n_tokens_mistral': 1247, 'n_tokens_neox': 1180, 'n_words': 251}