diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..c779659 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,6 @@ +##################################################################### +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileType: OTHER +# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +##################################################################### +custom: ["https://www.paypal.com/donate/?hosted_button_id=N7HXKEL8VJ9CN"] diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml new file mode 100644 index 0000000..74cba47 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -0,0 +1,82 @@ +##################################################################### +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileType: OTHER +# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +##################################################################### +name: "Bug Report" +description: "Let us know about an unexpected error, a crash, or an incorrect behavior." +title: 'Title of your Bug Report' +labels: + - bug +assignees: + - boogermann +body: + - type: markdown + attributes: + value: | + Hi there, + + Thank you for opening an issue. Please note that we try to keep the issue tracker reserved for bug reports. + Make sure to [search for existing issues](https://github.com/opengateware/arcade-congo/issues?q=label%3Abug) before filing a new one! + + - type: input + id: version + attributes: + label: Version (or build number) + placeholder: "1.0.0" + description: | + You can find the version in the about dialog. + + If you are not running the latest version, please try upgrading because your issue may have already been fixed. + validations: + required: true + + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: | + Please list the full steps required to reproduce the issue + placeholder: | + - Be precise + - Include exact data used during testing for easy reference + - The steps have to be in the exact order + - Mention pre-requisites when applicable + validations: + required: false + + - type: textarea + id: expected_behavior + attributes: + label: Expected Behavior + description: If you want to include screenshots, paste them into the markdown editor below or follow up with a separate comment. + placeholder: What were you expecting? + validations: + required: false + + - type: textarea + id: actual_behavior + attributes: + label: Actual Behavior + placeholder: What happened instead? + validations: + required: true + + - type: textarea + id: bug_context + attributes: + label: Additional Context + description: | + Are there anything atypical about your situation that we should know? + validations: + required: false + + - type: input + id: bug_firmware + attributes: + label: Opened Issues and Pull Requests + placeholder: "#1234" + description: | + Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: #1234 + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/QUESTION.yml b/.github/ISSUE_TEMPLATE/QUESTION.yml new file mode 100644 index 0000000..bf4cd0f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/QUESTION.yml @@ -0,0 +1,29 @@ +##################################################################### +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileType: OTHER +# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +##################################################################### +name: "Question" +description: "Ask a question about the project." +title: 'Title of your Question' +labels: + - question +assignees: + - boogermann +body: + - type: markdown + attributes: + value: | + Hi there, + + Please note that we try to keep the issue tracker reserved for bug reports. + Make sure to [search for existing questions](https://github.com/opengateware/arcade-congo/issues?q=label%3Aquestion) before filing a new one! + + - type: textarea + id: question + attributes: + label: Ask a question about the IP Core + placeholder: | + Ask your question here! Please keep the questions related to the FPGA Core only. + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..3113e01 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,44 @@ + + + + + + +## What does this do / why do we need it? + + + +{Please write here} + +Fixes # (issue) + +## Type of change + + + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update +- [ ] Coding style (indentation, etc) +- [ ] {Please write custom change here} + +## What should a reviewer look out for in this PR? + + + +{Please write here} + +## Additional Comments (if any) + +{Please write here} diff --git a/.github/workflows/build-pocket.yml b/.github/workflows/build-pocket.yml new file mode 100644 index 0000000..b30241e --- /dev/null +++ b/.github/workflows/build-pocket.yml @@ -0,0 +1,137 @@ +################################################################################ +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileType: OTHER +# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +################################################################################ +name: Build/Release +################################################################################ +# How to create a tag to launch the workflow +# git tag -a "0.1.0" -m "Release v0.1.0" +# git push origin --tags +################################################################################ +on: + push: + paths-ignore: + - '**.md' + - '.github/FUNDING.yml' + - '.github/ISSUE_TEMPLATE/**' + tags: + - "[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + paths-ignore: + - '**.md' +################################################################################ +jobs: + synthesis: + runs-on: ubuntu-latest + env: + CORE: congo + DISPLAY_NAME: "Congo Bongo by Sega" + CATEGORY: arcade + AUTHOR: boogermann + TARGET: pocket + STAGE_FOLDER: staging + RELEASE_FOLDER: release + RECIPE_FOLDER: rom-recipes + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RAETRO_WEBHOOK: ${{ secrets.RAETRO_WEBHOOK }} + FPGAGAMING_WEBHOOK: ${{ secrets.FPGAGAMING_WEBHOOK }} + + steps: + - name: "🧰 Checkout Repository" + uses: actions/checkout@v3 + + - name: "🏗️ Compile Design" + run: | + docker run --rm -v ${{ github.workspace }}:/build raetro/quartus:pocket \ + quartus_sh --flow compile projects/${CORE}_${TARGET}.qpf + + - name: "🟦 Staging Files for Release" + if: startsWith(github.ref, 'refs/tags/') + id: stage + run: | + ############################################################ + # Create Tags + ############################################################ + VERSION=${GITHUB_REF#refs/*/} + DATE=$(date +'%Y-%m-%d') + CORE_FOLDER=${AUTHOR}.${CORE} + RBF_FILE=${CORE}_${TARGET}.rbf + + echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT + + echo ::set-output name=VERSION::${VERSION} + echo ::set-output name=REPO::${CATEGORY}-${CORE} + echo ::set-output name=TITLE::${DISPLAY_NAME} + echo ::set-output name=RELEASE_FOLDER::${RELEASE_FOLDER} + echo ::set-output name=RELEASE_FILE::${CORE_FOLDER}_${TARGET}-${VERSION}.zip + echo ::set-output name=RECIPE_FILE::${CORE_FOLDER}_rom-recipes-${VERSION}.zip + ############################################################ + # Clear/Create Folders + ############################################################ + rm -rf ${STAGE_FOLDER} ${RELEASE_FOLDER} + mkdir -p ${STAGE_FOLDER} ${RELEASE_FOLDER} + ############################################################ + # Copy Packaging Folder + ############################################################ + cp -R pkg/${TARGET}/* ${STAGE_FOLDER} + ############################################################ + # Clear git and png source files + ############################################################ + find ./${STAGE_FOLDER} -type f \( -name "*.png*" -o -name "*.gitkeep*" \) -delete; + ############################################################ + # Update core.json Version and Release Date + ############################################################ + sed -i -e "s/<%- VERSION %>/${VERSION}/g" -e "s/<%- RELEASE_DATE %>/${DATE}/g" ${STAGE_FOLDER}/Cores/${CORE_FOLDER}/core.json + ############################################################ + # Reverse Bitstream + ############################################################ + wget https://gist.githubusercontent.com/boogermann/fba1f59c87f9c8c9404cc68878b4eb1a/raw/7e93a3560902e0136dcb29fa6c41d06f06d78fb2/reverse_bits.c + g++ reverse_bits.c -o reverse_bits + ./reverse_bits projects/output_files/${RBF_FILE} ${STAGE_FOLDER}/Cores/${CORE_FOLDER}/bitstream.rbf_r + + - name: "📦 Create Distribution Files" + if: startsWith(github.ref, 'refs/tags/') + id: zip + run: | + pushd ./${STAGE_FOLDER} + zip -r ../${RELEASE_FOLDER}/${{ steps.stage.outputs.RELEASE_FILE }} . + popd + pushd ./pkg/${RECIPE_FOLDER} + zip -r ../../${RELEASE_FOLDER}/${{ steps.stage.outputs.RECIPE_FILE }} . + popd + + - name: "🚀 Create a new GitHub Release" + uses: softprops/action-gh-release@v0.1.14 + if: startsWith(github.ref, 'refs/tags/') + with: + name: Release v${{ steps.stage.outputs.VERSION }} + files: | + ${{ steps.stage.outputs.RELEASE_FOLDER }}/* + + - name: "📢 Send Discord Announcements" + if: startsWith(github.ref, 'refs/tags/') + run: | + declare -a StringArray=("${RAETRO_WEBHOOK}" "${FPGAGAMING_WEBHOOK}") + for webhook_url in ${StringArray[@]}; do + curl \ + -H "Content-Type: application/json" \ + -d '{ + "username": "OpenGateware", + "avatar_url": "https://avatars.githubusercontent.com/u/112050328", + "embeds": [{ + "color": 2021216, + "title": "A new core stable release is available for the Pocket", + "thumbnail": { "url": "https://github.com/opengateware/${{ steps.stage.outputs.REPO }}/raw/master/docs/git-social.jpg" }, + "fields": [ + { "name": "Title", "value": "[${{ steps.stage.outputs.TITLE }}](https://github.com/opengateware/${{ steps.stage.outputs.REPO }}/)", "inline": true }, + { "name": "Version", "value": "[${{ steps.stage.outputs.VERSION }}](https://github.com/opengateware/${{ steps.stage.outputs.REPO }}/releases/tag/${{ steps.stage.outputs.VERSION }})", "inline": true }, + { "name": "Category", "value": "Arcade" }, + { "name": "Developer", "value": "[Boogermann](https://github.com/boogermann)" }, + { "name": "Download Core", "value": "[${{ steps.stage.outputs.RELEASE_FILE }}](https://github.com/opengateware/${{ steps.stage.outputs.REPO }}/releases/download/${{ steps.stage.outputs.VERSION }}/${{ steps.stage.outputs.RELEASE_FILE }})" }, + { "name": "Previous Releases", "value": "[https://github.com/opengateware/${{ steps.stage.outputs.REPO }}/releases](https://github.com/opengateware/${{ steps.stage.outputs.REPO }}/releases)" } + ] + }] + }' \ + $webhook_url + done diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..840a0b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,66 @@ +# Quartus directories and files +db +greybox_tmp +hps_isw_handoff +incremental_db +output_files +PLLJ_PLLSPE_INFO.txt +simulation +vip +.qsys_edit +*_netlist +*_sim +*.bak +*.bsf +*.cdf +*.cmp +*.csv +*.done +*.f +*.pin +*.pof +*.ptf.* +*.qar +*.qarlog +*.qdf +*.qws +*.rbf +*.rbf_r +*.rpt +*.sip +*.sld +*.smsg +*.sof +*.sopc_builder +*.sopcinfo +*.spd +*.summary +*.txt +*.xml +*~ +**/.DS_Store +build_id.mif +build_id.v +c5_pin_model_dump.txt +cr_ie_info.json +# Gateman directories and files +!.gateman/* +!gateware.json +!/pkg/* +/pkg/**/*.rom +/pkg/**/*.zip +/staging/* +/release/* +# Editor directories and files +.vscode +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +# Pocket directories and files +!info.txt +# ROMS Checklist +!checklist.sha1 +!checklist.md5 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..745e604 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise init, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type 'show c' for details. + +The hypothetical commands 'show w' and 'show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..43aeed4 --- /dev/null +++ b/docs/CODE_OF_CONDUCT.md @@ -0,0 +1,64 @@ +# Code Of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and leaders pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level or type of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. +Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct. + +## Our Standards + +We are committed to providing a friendly, safe and welcoming environment for all. + +Examples of behavior that contributes to creating a positive environment include: + +- Be kind and courteous to others +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Collaborating with other community members +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and sexual attention or advances +- The use of inappropriate images, including in a community member's avatar +- The use of inappropriate language, including in a community member's nickname +- Any spamming, flaming, baiting or other attention-stealing behavior +- Excessive or unwelcome helping; answering outside the scope of the question asked +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate + +The goal of the standards and moderation guidelines outlined here is to build and maintain a respectful community. We ask that you don’t just aim to be "technically unimpeachable", but rather try to be your best self. + +We value many things beyond technical expertise, including collaboration and supporting others within our community. Providing a positive experience for other community members can have a much more significant impact than simply providing the correct answer. + +## Our Responsibilities + +Project leaders are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project leaders respect all people who contribute through reporting issues, posting feature requests, updating documentation, metadata, artwork, manuals, videos, submitting pull requests or patches, and other activities. But also have the right and responsibility to remove, edit, or reject messages, comments, commits, code, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any community member for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct and the enforcement policies listed above apply to all Rætro Community venues. This includes but is not limited to any community spaces (both public and private), the entire Rætro Discord server, and all Rætro associated GitHub repositories. Examples of Rætro Community spaces include but are not limited to meet-ups, audio chats on the Rætro Discord, or interaction at a conference. + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. As a community member, you are representing our community, and are expected to behave accordingly. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at or contact [community@raetro.org][conduct-email]. +All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. +The project team is obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html, and the Rust Code of Conduct, available at https://www.rust-lang.org/en-US/conduct.html and the Adafruit Community Code of Conduct, available at https://github.com/adafruit/Adafruit_Community_Code_of_Conduct. + +[homepage]: https://www.contributor-covenant.org +[conduct-email]: mailto:community@raetro.org diff --git a/docs/Manual and Schematics/Congo Bongo (Prelimanary Manual).pdf b/docs/Manual and Schematics/Congo Bongo (Prelimanary Manual).pdf new file mode 100644 index 0000000..640f39d Binary files /dev/null and b/docs/Manual and Schematics/Congo Bongo (Prelimanary Manual).pdf differ diff --git a/docs/Manual and Schematics/Congo Bongo Manual.pdf b/docs/Manual and Schematics/Congo Bongo Manual.pdf new file mode 100644 index 0000000..9aa0888 Binary files /dev/null and b/docs/Manual and Schematics/Congo Bongo Manual.pdf differ diff --git a/docs/Manual and Schematics/Congo Bongo Schematics.pdf b/docs/Manual and Schematics/Congo Bongo Schematics.pdf new file mode 100644 index 0000000..b8f9d7d Binary files /dev/null and b/docs/Manual and Schematics/Congo Bongo Schematics.pdf differ diff --git a/docs/Print/Congo Bongo Flyer-Back.jpg b/docs/Print/Congo Bongo Flyer-Back.jpg new file mode 100644 index 0000000..642e226 Binary files /dev/null and b/docs/Print/Congo Bongo Flyer-Back.jpg differ diff --git a/docs/Print/Congo Bongo Flyer.jpg b/docs/Print/Congo Bongo Flyer.jpg new file mode 100644 index 0000000..550fe19 Binary files /dev/null and b/docs/Print/Congo Bongo Flyer.jpg differ diff --git a/docs/Print/Congo Bongo Marquee.png b/docs/Print/Congo Bongo Marquee.png new file mode 100644 index 0000000..555e6b0 Binary files /dev/null and b/docs/Print/Congo Bongo Marquee.png differ diff --git a/docs/Print/Tip Top Flyer.png b/docs/Print/Tip Top Flyer.png new file mode 100644 index 0000000..5f97704 Binary files /dev/null and b/docs/Print/Tip Top Flyer.png differ diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..f65613a --- /dev/null +++ b/docs/README.md @@ -0,0 +1,94 @@ +[![Congo Bongo Logo](congo-logo.png)](#) + +--- + +[![Active Development](https://img.shields.io/badge/Maintenance%20Level-Actively%20Developed-brightgreen.svg)](#status-of-features) +[![Build](https://github.com/opengateware/arcade-congo/actions/workflows/build-pocket.yml/badge.svg)](https://github.com/opengateware/arcade-congo/actions/workflows/build-pocket.yml) +[![release](https://img.shields.io/github/release/opengateware/arcade-congo.svg)](https://github.com/opengateware/arcade-congo/releases) +[![license](https://img.shields.io/github/license/opengateware/arcade-congo.svg?label=License&color=yellow)](#legal-notices) +[![issues](https://img.shields.io/github/issues/opengateware/arcade-congo.svg?label=Issues&color=red)](https://github.com/opengateware/arcade-congo/issues) +[![stars](https://img.shields.io/github/stars/opengateware/arcade-congo.svg?label=Project%20Stars)](https://github.com/opengateware/arcade-congo/stargazers) +[![discord](https://img.shields.io/discord/676418475635507210.svg?logo=discord&logoColor=white&label=Discord&color=5865F2)](https://chat.raetro.org) +[![Twitter Follow](https://img.shields.io/twitter/follow/marcusjordan?style=social)](https://twitter.com/marcusjordan) + +## Sega [Congo Bongo] Compatible Gateware IP Core + +This Implementation of a compatible Congo Bongo/Tip Top arcade hardware in HDL is the work of [Dar](https://github.com/darfpga). + +## Overview + +Congo Bongo is an isometric platform game and is Sega's take on Nintendo's legendary "Donkey Kong". +The player takes on the role of a red-nosed safari explorer by the name of Safari Sam, who tries to catch a gorilla named Bongo. + +The game consists of four different scenes. Each is timed by a bonus counter in the upper left corner of the screen. +As time passes, the bonus decreases. If the bonus counter reaches zero, a player life is lost. + +## Technical specifications + +- **SEGA ID:** 834-5156 +- **Main CPU:** Zilog Z80 @ 3.04125 Mhz +- **Sound CPU:** Zilog Z80 @ 4 Mhz +- **Sound Chip:** Discrete circuitry, SN76496 @ 4 Mhz +- **Resolution:** 256×224, 256 colors +- **Aspect Ratio:** 8:7 +- **Orientation:** Vertical + +## Compatible Platforms + +- Analogue Pocket + +## Compatible Games + +> **ROMs NOT INCLUDED:** By using this gateware you agree to provide your own roms. + +| Officials | Status | +| :----------- | :----: | +| Congo Bongo | ✅ | +| Tip Top | ✅ | + +### ROM Instructions + +1. Download and Install [ORCA](https://github.com/opengateware/tools-orca/releases/latest) (Open ROM Conversion Assistant) +2. Download the [ROM Recipes](https://github.com/opengateware/arcade-congo/releases/latest) and extract to your computer. +3. Copy the required MAME `.zip` file(s) into the `roms` folder. +4. Inside the `tools` folder execute the script related to your system. + 1. **Windows:** right click `make_roms.ps1` and select `Run with Powershell`. + 2. **Linux and MacOS:** run script `make_roms.sh`. +5. After the conversion is completed, copy the `Assets` folder to the Root of your SD Card. +6. **Optional:** an `.md5` file is included to verify if the hash of the ROMs are valid. (eg: `md5sum -c checklist.md5`) + +> **Note:** Make sure your `.rom` files are in the `Assets/congo/common` directory. + +## Status of Features + +> **WARNING**: This repository is in active development. There are no guarantees about stability. Breaking changes might occur until a stable release is made and announced. + +- [ ] Hi-Score Save + +## Credits and acknowledgment + +- [Daniel Wallner](https://opencores.org/projects/t80) +- [Dar](https://github.com/darfpga) +- Arnim Laeuger + +## Powered by Open-Source Software + +This project borrowed and use code from several other projects. A great thanks to their efforts! + +| Modules | Copyright/Developer | +| :----------------------------- | :---------------------- | +| [Congo Bongo RTL] | 2022 (c) Dar | +| SN76489AN | 2005 (c) Arnim Laeuger | +| [T80] | 2001 (c) Daniel Wallner | + +## Legal Notices + +Congo Bongo © 1983 Sega. All rights reserved. +All other trademarks, logos, and copyrights are property of their respective owners. + +The authors and contributors or any of its maintainers are in no way associated with or endorsed by Sega. + +[T80]: https://opencores.org/projects/t80 +[Congo Bongo RTL]: https://github.com/darfpga/vhdl_congo_bongo + +[Congo Bongo]: https://en.wikipedia.org/wiki/Congo_Bongo diff --git a/docs/congo-logo.png b/docs/congo-logo.png new file mode 100644 index 0000000..26db012 Binary files /dev/null and b/docs/congo-logo.png differ diff --git a/docs/git-social.jpg b/docs/git-social.jpg new file mode 100644 index 0000000..556ecbe Binary files /dev/null and b/docs/git-social.jpg differ diff --git a/gateware.json b/gateware.json new file mode 100644 index 0000000..a8e4a18 --- /dev/null +++ b/gateware.json @@ -0,0 +1,36 @@ +{ + "name": "congo", + "displayName": "congo", + "description": "Congo Bongo Compatible Gateware IP Core for FPGA", + "author": "boogermann", + "version": "0.1.0", + "license": "GPL-3.0-or-later", + "repository": "https://github.com/opengateware/arcade-congo", + "keywords": [ + "ecosystem:gateman" + ], + "scripts": { + "verilator": "echo \"Error: no simulation specified\" && exit 1", + "build:pocket": "quartus_sh --flow compile projects/congo_pocket.qpf", + "program:pocket": "quartus_pgm -m jtag -c 1 -o \"p;projects/output_files/congo_pocket.sof@1\"" + }, + "hardware": { + "id": "congo-bongo", + "name": "Congo Bongo", + "year": 1983, + "manufacturer": "Sega" + }, + "platforms": { + "pocket": "1.2.0" + }, + "modules": { + "cpu-t80": "3.5.1", + "general-sync_fifo": "0.1.0", + "pocket-dataloader": "1.0.0", + "pocket-i2s": "1.0.0", + "pocket-joypad": "1.0.0", + "pocket-video": "1.0.0", + "video-scanlines": "0.2.0", + "sound-sn76489": "1.9.0" + } +} \ No newline at end of file diff --git a/modules/cpu-t80/GBse.vhd b/modules/cpu-t80/GBse.vhd new file mode 100644 index 0000000..102ccbf --- /dev/null +++ b/modules/cpu-t80/GBse.vhd @@ -0,0 +1,205 @@ +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- +-- Z80 compatible microprocessor core, synchronous top level with clock enable +-- Different timing than the original z80 +-- Inputs needs to be synchronous and outputs may glitch +-- +-- Version : 0240 +-- +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0235 : First release +-- +-- 0236 : Added T2Write generic +-- +-- 0237 : Fixed T2Write with wait state +-- +-- 0238 : Updated for T80 interface change +-- +-- 0240 : Updated for T80 interface change +-- +-- 0242 : Updated for T80 interface change +-- +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use work.T80_Pack.all; + +entity GBse is + generic( + T2Write : integer := 1; -- 0 => WR_n active in T3, /=0 => WR_n active in T2 + IOWait : integer := 1 -- 0 => Single cycle I/O, 1 => Std I/O cycle + ); + port( + RESET_n : in std_logic; + CLK_n : in std_logic; + CLKEN : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + STOP : out std_logic; + A : out std_logic_vector(15 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0) + ); +end GBse; + +architecture rtl of GBse is + + signal IntCycle_n : std_logic; + signal NoRead : std_logic; + signal Write : std_logic; + signal IORQ : std_logic; + signal DI_Reg : std_logic_vector(7 downto 0); + signal MCycle : std_logic_vector(2 downto 0); + signal TState : std_logic_vector(2 downto 0); + +begin + + u0 : T80 + generic map( + Mode => 3, + IOWait => IOWait, + Flag_S => 0, + Flag_P => 0, + Flag_X => 0, + Flag_Y => 0, + Flag_C => 4, + Flag_H => 5, + Flag_N => 6, + Flag_Z => 7 + ) + port map( + CEN => CLKEN, + M1_n => M1_n, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => RFSH_n, + HALT_n => HALT_n, + Stop => STOP, + WAIT_n => Wait_n, + INT_n => INT_n, + NMI_n => NMI_n, + RESET_n => RESET_n, + BUSRQ_n => BUSRQ_n, + BUSAK_n => BUSAK_n, + CLK_n => CLK_n, + A => A, + DInst => DI, + DI => DI_Reg, + DO => DO, + MC => MCycle, + TS => TState, + IntCycle_n => IntCycle_n); + + process (RESET_n, CLK_n) + begin + if RESET_n = '0' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + DI_Reg <= "00000000"; + elsif CLK_n'event and CLK_n = '1' then + if CLKEN = '1' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + if MCycle = "001" then + if TState = "001" or (TState = "010" and Wait_n = '0') then + RD_n <= not IntCycle_n; + MREQ_n <= not IntCycle_n; + end if; + if TState = "011" then + MREQ_n <= '0'; + end if; + elsif MCycle = "011" and IntCycle_n = '0' then + if TState = "001" then + IORQ_n <= '0'; -- Acknowledge IRQ + end if; + else + if (TState = "001" or (TState = "010" and Wait_n = '0')) and NoRead = '0' and Write = '0' then + RD_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + if T2Write = 0 then + if TState = "010" and Write = '1' then + WR_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + else + if (TState = "001" or (TState = "010" and Wait_n = '0')) and Write = '1' then + WR_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + end if; + end if; + if TState = "010" and Wait_n = '1' then + DI_Reg <= DI; + end if; + end if; + end if; + end process; + +end; diff --git a/modules/cpu-t80/README.md b/modules/cpu-t80/README.md new file mode 100644 index 0000000..9bb959c --- /dev/null +++ b/modules/cpu-t80/README.md @@ -0,0 +1,55 @@ +# T80 a Z80 Compatible Microprocessor Gateware IP Core + +Attempt to finish all undocumented features and provide accurate timings. + +## Changelog + +- 3.5.1 + - Merged Gameboy fixes from Bruno Duarte Gouveia (brNX) + - Passes Blargg's test ROMs +- 3.5.0 + - Test passed: ZEXDOC, ZEXALL, Z80Full(*), Z80memptr + - (*) Currently only SCF and CCF instructions aren't passed X/Y flags check as correct implementation is still unclear. +- 3.0.3 + - Add undocumented DDCB and FDCB opcodes by TobiFlex 20.04.2010 +- 3.0.1 + - Parity flag is just parity for 8080, also overflow for Z80, by Sean Riddle +- 3.0.0 + - Started tidyup +- 2.5.0 + - Unknown History before this point + +Contributors: + +```txt +Copyright (c) 2021 Bruno Duarte Gouveia +Copyright (c) 2018 Sorgelig +Copyright (c) 2010 TobiFlex +Copyright (c) 20xx Sean Riddle +Copyright (c) 2005 MikeJ +``` + +```txt +Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +All rights reserved. + +Redistributions in synthesized form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +Neither the name of the author nor the names of other contributors may +be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +``` diff --git a/modules/cpu-t80/T16450.vhd b/modules/cpu-t80/T16450.vhd new file mode 100644 index 0000000..ad266c2 --- /dev/null +++ b/modules/cpu-t80/T16450.vhd @@ -0,0 +1,459 @@ +-- +-- 16450 compatible UART with synchronous bus interface +-- RClk/BaudOut is XIn enable instead of actual clock +-- +-- Version : 0249b +-- +-- Copyright (c) 2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0208 : First release +-- +-- 0249 : Fixed interrupt and baud rate bugs found by Andy Dyer +-- Added modem status and break detection +-- Added support for 1.5 and 2 stop bits +-- +-- 0249b : Fixed loopback break generation bugs found by Andy Dyer +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; + +entity T16450 is + port( + MR_n : in std_logic; + XIn : in std_logic; + RClk : in std_logic; + CS_n : in std_logic; + Rd_n : in std_logic; + Wr_n : in std_logic; + A : in std_logic_vector(2 downto 0); + D_In : in std_logic_vector(7 downto 0); + D_Out : out std_logic_vector(7 downto 0); + SIn : in std_logic; + CTS_n : in std_logic; + DSR_n : in std_logic; + RI_n : in std_logic; + DCD_n : in std_logic; + SOut : out std_logic; + RTS_n : out std_logic; + DTR_n : out std_logic; + OUT1_n : out std_logic; + OUT2_n : out std_logic; + BaudOut : out std_logic; + Intr : out std_logic + ); +end T16450; + +architecture rtl of T16450 is + + signal RBR : std_logic_vector(7 downto 0); -- Reciever Buffer Register + signal THR : std_logic_vector(7 downto 0); -- Transmitter Holding Register + signal IER : std_logic_vector(7 downto 0); -- Interrupt Enable Register + signal IIR : std_logic_vector(7 downto 0); -- Interrupt Ident. Register + signal LCR : std_logic_vector(7 downto 0); -- Line Control Register + signal MCR : std_logic_vector(7 downto 0); -- MODEM Control Register + signal LSR : std_logic_vector(7 downto 0); -- Line Status Register + signal MSR : std_logic_vector(7 downto 0); -- MODEM Status Register + signal SCR : std_logic_vector(7 downto 0); -- Scratch Register + signal DLL : std_logic_vector(7 downto 0); -- Divisor Latch (LS) + signal DLM : std_logic_vector(7 downto 0); -- Divisor Latch (MS) + + signal DM0 : std_logic_vector(7 downto 0); + signal DM1 : std_logic_vector(7 downto 0); + + signal MSR_In : std_logic_vector(3 downto 0); + + signal Bit_Phase : unsigned(3 downto 0); + signal Brk_Cnt : unsigned(3 downto 0); + signal RX_Filtered : std_logic; + signal RX_ShiftReg : std_logic_vector(7 downto 0); + signal RX_Bit_Cnt : integer range 0 to 11; + signal RX_Parity : std_logic; + signal RXD : std_logic; + + signal TX_Tick : std_logic; + signal TX_ShiftReg : std_logic_vector(7 downto 0); + signal TX_Bit_Cnt : integer range 0 to 11; + signal TX_Parity : std_logic; + signal TX_Next_Is_Stop : std_logic; + signal TX_Stop_Bit : std_logic; + signal TXD : std_logic; + +begin + + DTR_n <= MCR(4) or not MCR(0); + RTS_n <= MCR(4) or not MCR(1); + OUT1_n <= MCR(4) or not MCR(2); + OUT2_n <= MCR(4) or not MCR(3); + SOut <= MCR(4) or (TXD and not LCR(6)); + RXD <= SIn when MCR(4) = '0' else (TXD and not LCR(6)); + + Intr <= not IIR(0); + + -- Registers + DM0 <= DLL when LCR(7) = '1' else RBR; + DM1 <= DLM when LCR(7) = '1' else IER; + with A select + D_Out <= + DM0 when "000", + DM1 when "001", + IIR when "010", + LCR when "011", + MCR when "100", + LSR when "101", + MSR when "110", + SCR when others; + process (MR_n, XIn) + begin + if MR_n = '0' then + THR <= "00000000"; + IER <= "00000000"; + LCR <= "00000000"; + MCR <= "00000000"; + MSR(3 downto 0) <= "0000"; + SCR <= "00000000"; -- ?? + DLL <= "00000000"; -- ?? + DLM <= "00000000"; -- ?? + elsif XIn'event and XIn = '1' then + if Wr_n = '0' and CS_n = '0' then + case A is + when "000" => + if LCR(7) = '1' then + DLL <= D_In; + else + THR <= D_In; + end if; + when "001" => + if LCR(7) = '1' then + DLM <= D_In; + else + IER(3 downto 0) <= D_In(3 downto 0); + end if; + when "011" => + LCR <= D_In; + when "100" => + MCR <= D_In; + when "111" => + SCR <= D_In; + when others => + end case; + end if; + if Rd_n = '0' and CS_n = '0' and A = "110" then + MSR(3 downto 0) <= "0000"; + end if; + if MSR(4) /= MSR_In(0) then + MSR(0) <= '1'; + end if; + if MSR(5) /= MSR_In(1) then + MSR(1) <= '1'; + end if; + if MSR(6) = '0' and MSR_In(2) = '1' then + MSR(2) <= '1'; + end if; + if MSR(7) /= MSR_In(3) then + MSR(3) <= '1'; + end if; + end if; + end process; + process (XIn) + begin + if XIn'event and XIn = '1' then + if MCR(4) = '0' then + MSR(4) <= MSR_In(0); + MSR(5) <= MSR_In(1); + MSR(6) <= MSR_In(2); + MSR(7) <= MSR_In(3); + else + MSR(4) <= MCR(1); + MSR(5) <= MCR(0); + MSR(6) <= MCR(2); + MSR(7) <= MCR(3); + end if; + MSR_In(0) <= CTS_n; + MSR_In(1) <= DSR_n; + MSR_In(2) <= RI_n; + MSR_In(3) <= DCD_n; + end if; + end process; + + IIR(7 downto 3) <= "00000"; + IIR(2 downto 0) <= + "110" when IER(2) = '1' and LSR(4 downto 1) /= "0000" else + "100" when (IER(0) and LSR(0)) = '1' else + "010" when (IER(1) and LSR(5)) = '1' else + "000" when IER(3) = '1' and ((MCR(4) = '0' and MSR(3 downto 0) /= "0000") or + (MCR(4) = '1' and MCR(3 downto 0) /= "0000")) else + "001"; + + -- Baud x 16 clock generator + process (MR_n, XIn) + variable Baud_Cnt : unsigned(15 downto 0); + begin + if MR_n = '0' then + Baud_Cnt := "0000000000000000"; + BaudOut <= '0'; + elsif XIn'event and XIn = '1' then + if Baud_Cnt(15 downto 1) = "000000000000000" or (Wr_n = '0' and CS_n = '0' and A(2 downto 1) = "00" and LCR(7) = '1') then + Baud_Cnt(15 downto 8) := unsigned(DLM); + Baud_Cnt(7 downto 0) := unsigned(DLL); + BaudOut <= '1'; + else + Baud_Cnt := Baud_Cnt - 1; + BaudOut <= '0'; + end if; + end if; + end process; + + -- Input filter + process (MR_n, XIn) + variable Samples : std_logic_vector(1 downto 0); + begin + if MR_n = '0' then + Samples := "11"; + RX_Filtered <= '1'; + elsif XIn'event and XIn = '1' then + if RClk = '1' then + Samples(1) := Samples(0); + Samples(0) := RXD; + end if; + if Samples = "00" then + RX_Filtered <= '0'; + end if; + if Samples = "11" then + RX_Filtered <= '1'; + end if; + end if; + end process; + + -- Receive state machine + process (MR_n, XIn) + begin + if MR_n = '0' then + RBR <= "00000000"; + LSR(4 downto 0) <= "00000"; + Bit_Phase <= "0000"; + Brk_Cnt <= "0000"; + RX_ShiftReg(7 downto 0) <= "00000000"; + RX_Bit_Cnt <= 0; + RX_Parity <= '0'; + elsif XIn'event and XIn = '1' then + if A = "000" and LCR(7) = '0' and Rd_n = '0' and CS_n = '0' then + LSR(0) <= '0'; -- DR + end if; + if A = "101" and Rd_n = '0' and CS_n = '0' then + LSR(4) <= '0'; -- BI + LSR(3) <= '0'; -- FE + LSR(2) <= '0'; -- PE + LSR(1) <= '0'; -- OE + end if; + if RClk = '1' then + if RX_Bit_Cnt = 0 and (RX_Filtered = '1' or Bit_Phase = "0111") then + Bit_Phase <= "0000"; + else + Bit_Phase <= Bit_Phase + 1; + end if; + if Bit_Phase = "1111" then + if RX_Filtered = '1' then + Brk_Cnt <= "0000"; + else + Brk_Cnt <= Brk_Cnt + 1; + end if; + if Brk_Cnt = "1100" then + LSR(4) <= '1'; -- BI + end if; + end if; + if RX_Bit_Cnt = 0 then + if Bit_Phase = "0111" then + RX_Bit_Cnt <= RX_Bit_Cnt + 1; + RX_Parity <= not LCR(4); -- EPS + end if; + elsif Bit_Phase = "1111" then + RX_Bit_Cnt <= RX_Bit_Cnt + 1; + if RX_Bit_Cnt = 10 then -- Parity stop bit + RX_Bit_Cnt <= 0; + LSR(0) <= '1'; -- UART Receive complete + LSR(3) <= not RX_Filtered; -- Framing error + elsif (RX_Bit_Cnt = 9 and LCR(1 downto 0) = "11") or + (RX_Bit_Cnt = 8 and LCR(1 downto 0) = "10") or + (RX_Bit_Cnt = 7 and LCR(1 downto 0) = "01") or + (RX_Bit_Cnt = 6 and LCR(1 downto 0) = "00") then -- Stop bit/Parity + RX_Bit_Cnt <= 0; + if LCR(3) = '1' then -- PEN + RX_Bit_Cnt <= 10; + if LCR(5) = '1' then -- Stick parity + if RX_Filtered = LCR(4) then + LSR(2) <= '1'; + end if; + else + if RX_Filtered /= RX_Parity then + LSR(2) <= '1'; + end if; + end if; + else + LSR(0) <= '1'; -- UART Receive complete + LSR(3) <= not RX_Filtered; -- Framing error + end if; + RBR <= RX_ShiftReg(7 downto 0); + LSR(1) <= LSR(0); + if A = "101" and Rd_n = '0' and CS_n = '0' then + LSR(1) <= '0'; + end if; + else + RX_ShiftReg(6 downto 0) <= RX_ShiftReg(7 downto 1); + RX_ShiftReg(7) <= RX_Filtered; + if LCR(1 downto 0) = "10" then + RX_ShiftReg(7) <= '0'; + RX_ShiftReg(6) <= RX_Filtered; + end if; + if LCR(1 downto 0) = "01" then + RX_ShiftReg(7) <= '0'; + RX_ShiftReg(6) <= '0'; + RX_ShiftReg(5) <= RX_Filtered; + end if; + if LCR(1 downto 0) = "00" then + RX_ShiftReg(7) <= '0'; + RX_ShiftReg(6) <= '0'; + RX_ShiftReg(5) <= '0'; + RX_ShiftReg(4) <= RX_Filtered; + end if; + RX_Parity <= RX_Filtered xor RX_Parity; + end if; + end if; + end if; + end if; + end process; + + -- Transmit bit tick + process (MR_n, XIn) + variable TX_Cnt : unsigned(4 downto 0); + begin + if MR_n = '0' then + TX_Cnt := "00000"; + TX_Tick <= '0'; + elsif XIn'event and XIn = '1' then + TX_Tick <= '0'; + if RClk = '1' then + TX_Cnt := TX_Cnt + 1; + if LCR(2) = '1' and TX_Stop_Bit = '1' then + if LCR(1 downto 0) = "00" then + if TX_Cnt = "10111" then + TX_Tick <= '1'; + TX_Cnt(3 downto 0) := "0000"; + end if; + else + if TX_Cnt = "11111" then + TX_Tick <= '1'; + TX_Cnt(3 downto 0) := "0000"; + end if; + end if; + else + TX_Cnt(4) := '1'; + if TX_Cnt(3 downto 0) = "1111" then + TX_Tick <= '1'; + end if; + end if; + end if; + end if; + end process; + + -- Transmit state machine + process (MR_n, XIn) + begin + if MR_n = '0' then + LSR(7 downto 5) <= "011"; + TX_Bit_Cnt <= 0; + TX_ShiftReg <= (others => '0'); + TXD <= '1'; + TX_Parity <= '0'; + TX_Next_Is_Stop <= '0'; + TX_Stop_Bit <= '0'; + elsif XIn'event and XIn = '1' then + if TX_Tick = '1' then + TX_Next_Is_Stop <= '0'; + TX_Stop_Bit <= TX_Next_Is_Stop; + case TX_Bit_Cnt is + when 0 => + if LSR(5) <= '0' then -- THRE + TX_Bit_Cnt <= 1; + end if; + TXD <= '1'; + when 1 => -- Start bit + TX_ShiftReg(7 downto 0) <= THR; + LSR(5) <= '1'; -- THRE + TXD <= '0'; + TX_Parity <= not LCR(4); -- EPS + TX_Bit_Cnt <= TX_Bit_Cnt + 1; + when 10 => -- Parity bit + TXD <= TX_Parity; + if LCR(5) = '1' then -- Stick parity + TXD <= not LCR(4); + end if; + TX_Bit_Cnt <= 0; + TX_Next_Is_Stop <= '1'; + when others => + TX_Bit_Cnt <= TX_Bit_Cnt + 1; + if (TX_Bit_Cnt = 9 and LCR(1 downto 0) = "11") or + (TX_Bit_Cnt = 8 and LCR(1 downto 0) = "10") or + (TX_Bit_Cnt = 7 and LCR(1 downto 0) = "01") or + (TX_Bit_Cnt = 6 and LCR(1 downto 0) = "00") then + TX_Bit_Cnt <= 0; + if LCR(3) = '1' then -- PEN + TX_Bit_Cnt <= 10; + else + TX_Next_Is_Stop <= '1'; + end if; + LSR(6) <= '1'; -- TEMT + end if; + TXD <= TX_ShiftReg(0); + TX_ShiftReg(6 downto 0) <= TX_ShiftReg(7 downto 1); + TX_Parity <= TX_ShiftReg(0) xor TX_Parity; + end case; + end if; + if Wr_n = '0' and CS_n = '0' and A = "000" and LCR(7) = '0' then + LSR(5) <= '0'; -- THRE + LSR(6) <= '0'; -- TEMT + end if; + end if; + end process; + +end; diff --git a/modules/cpu-t80/T80.vhd b/modules/cpu-t80/T80.vhd new file mode 100644 index 0000000..641ed7a --- /dev/null +++ b/modules/cpu-t80/T80.vhd @@ -0,0 +1,1338 @@ +-------------------------------------------------------------------------------- +-- **** +-- T80(c) core. Attempt to finish all undocumented features and provide +-- accurate timings. +-- Version 350. +-- Copyright (c) 2018 Sorgelig +-- Test passed: ZEXDOC, ZEXALL, Z80Full(*), Z80memptr +-- (*) Currently only SCF and CCF instructions aren't passed X/Y flags check as +-- correct implementation is still unclear. +-- +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- Ver 303 add undocumented DDCB and FDCB opcodes by TobiFlex 20.04.2010 +-- Ver 301 parity flag is just parity for 8080, also overflow for Z80, by Sean Riddle +-- Ver 300 started tidyup. +-- +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- Z80 compatible microprocessor core +-- +-- Version : 0250 +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0208 : First complete release +-- 0210 : Fixed wait and halt +-- 0211 : Fixed Refresh addition and IM 1 +-- 0214 : Fixed mostly flags, only the block instructions now fail the zex regression test +-- 0232 : Removed refresh address output for Mode > 1 and added DJNZ M1_n fix by Mike Johnson +-- 0235 : Added clock enable and IM 2 fix by Mike Johnson +-- 0237 : Changed 8080 I/O address output, added IntE output +-- 0238 : Fixed (IX/IY+d) timing and 16 bit ADC and SBC zero flag +-- 0240 : Added interrupt ack fix by Mike Johnson, changed (IX/IY+d) timing and changed flags in GB mode +-- 0242 : Added I/O wait, fixed refresh address, moved some registers to RAM +-- 0247 : Fixed bus req/ack cycle +-- 0250 : Added R800 Multiplier by TobiFlex 2017.10.15 +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use IEEE.STD_LOGIC_UNSIGNED.all; +use work.T80_Pack.all; + +entity T80 is + generic( + Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + IOWait : integer := 0; -- 0 => Single cycle I/O, 1 => Std I/O cycle + Flag_C : integer := 0; + Flag_N : integer := 1; + Flag_P : integer := 2; + Flag_X : integer := 3; + Flag_H : integer := 4; + Flag_Y : integer := 5; + Flag_Z : integer := 6; + Flag_S : integer := 7 + ); + port( + RESET_n : in std_logic; + CLK_n : in std_logic; + CEN : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + IORQ : out std_logic; + NoRead : out std_logic; + Write : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + A : out std_logic_vector(15 downto 0); + DInst : in std_logic_vector(7 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0); + MC : out std_logic_vector(2 downto 0); + TS : out std_logic_vector(2 downto 0); + IntCycle_n : out std_logic; + IntE : out std_logic; + Stop : out std_logic; + R800_mode : in std_logic := '0'; + out0 : in std_logic := '0'; -- 0 => OUT(C),0, 1 => OUT(C),255 + REG : out std_logic_vector(211 downto 0); -- IFF2, IFF1, IM, IY, HL', DE', BC', IX, HL, DE, BC, PC, SP, R, I, F', A', F, A + + DIRSet : in std_logic := '0'; + DIR : in std_logic_vector(211 downto 0) := (others => '0') -- IFF2, IFF1, IM, IY, HL', DE', BC', IX, HL, DE, BC, PC, SP, R, I, F', A', F, A + ); +end T80; + +architecture rtl of T80 is + + -- Registers + signal ACC, F : std_logic_vector(7 downto 0); + signal Ap, Fp : std_logic_vector(7 downto 0); + signal I : std_logic_vector(7 downto 0); + signal R : unsigned(7 downto 0); + signal SP, PC : unsigned(15 downto 0); + + signal RegDIH : std_logic_vector(7 downto 0); + signal RegDIL : std_logic_vector(7 downto 0); + signal RegBusA : std_logic_vector(15 downto 0); + signal RegBusB : std_logic_vector(15 downto 0); + signal RegBusC : std_logic_vector(15 downto 0); + signal RegAddrA_r : std_logic_vector(2 downto 0); + signal RegAddrA : std_logic_vector(2 downto 0); + signal RegAddrB_r : std_logic_vector(2 downto 0); + signal RegAddrB : std_logic_vector(2 downto 0); + signal RegAddrC : std_logic_vector(2 downto 0); + signal RegWEH : std_logic; + signal RegWEL : std_logic; + signal Alternate : std_logic; + + -- Help Registers + signal WZ : std_logic_vector(15 downto 0); -- MEMPTR register + signal TmpAddr2 : std_logic_vector(15 downto 0); -- Temporary address register + signal IR : std_logic_vector(7 downto 0); -- Instruction register + signal ISet : std_logic_vector(1 downto 0); -- Instruction set selector + signal RegBusA_r : std_logic_vector(15 downto 0); + signal MULU_Prod32 : std_logic_vector(31 downto 0); + signal MULU_tmp : std_logic_vector(31 downto 0); + signal MULU_Fakt1 : std_logic_vector(15 downto 0); + + signal ID16 : signed(15 downto 0); + signal Save_Mux : std_logic_vector(7 downto 0); + + signal TState : unsigned(2 downto 0); + signal MCycle : std_logic_vector(2 downto 0); + signal IntE_FF1 : std_logic; + signal IntE_FF2 : std_logic; + signal Halt_FF : std_logic; + signal BusReq_s : std_logic := '0'; + signal BusAck : std_logic := '0'; + signal ClkEn : std_logic; + signal NMI_s : std_logic; + signal IStatus : std_logic_vector(1 downto 0); + + signal DI_Reg : std_logic_vector(7 downto 0); + signal T_Res : std_logic; + signal XY_State : std_logic_vector(1 downto 0); + signal Pre_XY_F_M : std_logic_vector(2 downto 0); + signal NextIs_XY_Fetch : std_logic; + signal XY_Ind : std_logic; + signal No_BTR : std_logic; + signal BTR_r : std_logic; + signal Auto_Wait : std_logic; + signal Auto_Wait_t1 : std_logic; + signal Auto_Wait_t2 : std_logic; + signal IncDecZ : std_logic; + + -- ALU signals + signal BusB : std_logic_vector(7 downto 0); + signal BusA : std_logic_vector(7 downto 0); + signal ALU_Q : std_logic_vector(7 downto 0); + signal F_Out : std_logic_vector(7 downto 0); + + -- Registered micro code outputs + signal Read_To_Reg_r : std_logic_vector(4 downto 0); + signal Arith16_r : std_logic; + signal Z16_r : std_logic; + signal ALU_Op_r : std_logic_vector(3 downto 0); + signal Save_ALU_r : std_logic; + signal PreserveC_r : std_logic; + signal MCycles : std_logic_vector(2 downto 0); + + -- Micro code outputs + signal MCycles_d : std_logic_vector(2 downto 0); + signal TStates : std_logic_vector(2 downto 0); + signal IntCycle : std_logic; + signal NMICycle : std_logic; + signal Inc_PC : std_logic; + signal Inc_WZ : std_logic; + signal IncDec_16 : std_logic_vector(3 downto 0); + signal Prefix : std_logic_vector(1 downto 0); + signal Read_To_Acc : std_logic; + signal Read_To_Reg : std_logic; + signal Set_BusB_To : std_logic_vector(3 downto 0); + signal Set_BusA_To : std_logic_vector(3 downto 0); + signal ALU_Op : std_logic_vector(3 downto 0); + signal Save_ALU : std_logic; + signal Rot_Akku : std_logic; + signal PreserveC : std_logic; + signal Arith16 : std_logic; + signal Set_Addr_To : std_logic_vector(2 downto 0); + signal Jump : std_logic; + signal JumpE : std_logic; + signal JumpXY : std_logic; + signal Call : std_logic; + signal RstP : std_logic; + signal LDZ : std_logic; + signal LDW : std_logic; + signal LDSPHL : std_logic; + signal LDHLSP : std_logic; + signal ADDSPdd : std_logic; + signal IORQ_i : std_logic; + signal Special_LD : std_logic_vector(2 downto 0); + signal ExchangeDH : std_logic; + signal ExchangeRp : std_logic; + signal ExchangeAF : std_logic; + signal ExchangeRS : std_logic; + signal ExchangeWH : std_logic; + signal I_DJNZ : std_logic; + signal I_CPL : std_logic; + signal I_CCF : std_logic; + signal I_SCF : std_logic; + signal I_RETN : std_logic; + signal I_BT : std_logic; + signal I_BC : std_logic; + signal I_BTR : std_logic; + signal I_RLD : std_logic; + signal I_RRD : std_logic; + signal I_RXDD : std_logic; + signal I_INRC : std_logic; + signal I_MULUB : std_logic; + signal I_MULU : std_logic; + signal SetWZ : std_logic_vector(1 downto 0); + signal SetDI : std_logic; + signal SetEI : std_logic; + signal IMode : std_logic_vector(1 downto 0); + signal Halt : std_logic; + signal XYbit_undoc : std_logic; + signal No_PC : std_logic; + signal DOR : std_logic_vector(127 downto 0); + +begin + + REG <= IntE_FF2 & IntE_FF1 & IStatus & DOR & std_logic_vector(PC) & std_logic_vector(SP) & std_logic_vector(R) & I & Fp & Ap & F & ACC when Alternate = '0' + else IntE_FF2 & IntE_FF1 & IStatus & DOR(127 downto 112) & DOR(47 downto 0) & DOR(63 downto 48) & DOR(111 downto 64) & + std_logic_vector(PC) & std_logic_vector(SP) & std_logic_vector(R) & I & Fp & Ap & F & ACC; + + mcode : T80_MCode + generic map( + Mode => Mode, + Flag_C => Flag_C, + Flag_N => Flag_N, + Flag_P => Flag_P, + Flag_X => Flag_X, + Flag_H => Flag_H, + Flag_Y => Flag_Y, + Flag_Z => Flag_Z, + Flag_S => Flag_S) + port map( + IR => IR, + ISet => ISet, + MCycle => MCycle, + F => F, + NMICycle => NMICycle, + IntCycle => IntCycle, + XY_State => XY_State, + MCycles => MCycles_d, + TStates => TStates, + Prefix => Prefix, + Inc_PC => Inc_PC, + Inc_WZ => Inc_WZ, + IncDec_16 => IncDec_16, + Read_To_Acc => Read_To_Acc, + Read_To_Reg => Read_To_Reg, + Set_BusB_To => Set_BusB_To, + Set_BusA_To => Set_BusA_To, + ALU_Op => ALU_Op, + Save_ALU => Save_ALU, + Rot_Akku => Rot_Akku, + PreserveC => PreserveC, + Arith16 => Arith16, + Set_Addr_To => Set_Addr_To, + IORQ => IORQ_i, + Jump => Jump, + JumpE => JumpE, + JumpXY => JumpXY, + Call => Call, + RstP => RstP, + LDZ => LDZ, + LDW => LDW, + LDSPHL => LDSPHL, + LDHLSP => LDHLSP, + ADDSPdd => ADDSPdd, + Special_LD => Special_LD, + ExchangeDH => ExchangeDH, + ExchangeRp => ExchangeRp, + ExchangeAF => ExchangeAF, + ExchangeRS => ExchangeRS, + ExchangeWH => ExchangeWH, + I_DJNZ => I_DJNZ, + I_CPL => I_CPL, + I_CCF => I_CCF, + I_SCF => I_SCF, + I_RETN => I_RETN, + I_BT => I_BT, + I_BC => I_BC, + I_BTR => I_BTR, + I_RLD => I_RLD, + I_RRD => I_RRD, + I_INRC => I_INRC, + I_MULUB => I_MULUB, + I_MULU => I_MULU, + SetWZ => SetWZ, + SetDI => SetDI, + SetEI => SetEI, + IMode => IMode, + Halt => Halt, + NoRead => NoRead, + Write => Write, + R800_mode => R800_mode, + No_PC => No_PC, + XYbit_undoc => XYbit_undoc); + + alu : T80_ALU + generic map( + Mode => Mode, + Flag_C => Flag_C, + Flag_N => Flag_N, + Flag_P => Flag_P, + Flag_X => Flag_X, + Flag_H => Flag_H, + Flag_Y => Flag_Y, + Flag_Z => Flag_Z, + Flag_S => Flag_S) + port map( + Arith16 => Arith16_r, + Z16 => Z16_r, + WZ => WZ, + XY_State=> XY_State, + ALU_Op => ALU_Op_r, + Rot_Akku => Rot_Akku, + IR => IR(5 downto 0), + ISet => ISet, + BusA => BusA, + BusB => BusB, + F_In => F, + Q => ALU_Q, + F_Out => F_Out); + + ClkEn <= CEN and not BusAck; + + T_Res <= '1' when TState = unsigned(TStates) else '0'; + + NextIs_XY_Fetch <= '1' when XY_State /= "00" and XY_Ind = '0' and + ((Set_Addr_To = aXY) or + (MCycle = "001" and IR = "11001011") or + (MCycle = "001" and IR = "00110110")) else '0'; + + Save_Mux <= BusB when ExchangeRp = '1' else + DI_Reg when Save_ALU_r = '0' else + ALU_Q; + + process (RESET_n, CLK_n) + variable n : std_logic_vector(7 downto 0); + variable ioq : std_logic_vector(8 downto 0); + variable temp_c : unsigned(8 downto 0); + variable temp_h : unsigned(4 downto 0); + begin + if RESET_n = '0' then + PC <= (others => '0'); -- Program Counter + A <= (others => '0'); + WZ <= (others => '0'); + IR <= "00000000"; + ISet <= "00"; + XY_State <= "00"; + IStatus <= "00"; + MCycles <= "000"; + DO <= "00000000"; + + ACC <= (others => '1'); + F <= (others => '1'); + if Mode = 3 then + ACC <= (others => '0'); + F <= "11110000"; + end if; + + Ap <= (others => '1'); + Fp <= (others => '1'); + I <= (others => '0'); + R <= (others => '0'); + SP <= (others => '1'); + Alternate <= '0'; + + Read_To_Reg_r <= "00000"; + Arith16_r <= '0'; + BTR_r <= '0'; + Z16_r <= '0'; + ALU_Op_r <= "0000"; + Save_ALU_r <= '0'; + PreserveC_r <= '0'; + XY_Ind <= '0'; + I_RXDD <= '0'; + + elsif rising_edge(CLK_n) then + + if DIRSet = '1' then + ACC <= DIR( 7 downto 0); + F <= DIR(15 downto 8); + Ap <= DIR(23 downto 16); + Fp <= DIR(31 downto 24); + I <= DIR(39 downto 32); + R <= unsigned(DIR(47 downto 40)); + SP <= unsigned(DIR(63 downto 48)); + PC <= unsigned(DIR(79 downto 64)); + A <= DIR(79 downto 64); + IStatus <= DIR(209 downto 208); + + elsif ClkEn = '1' then + ALU_Op_r <= "0000"; + Save_ALU_r <= '0'; + Read_To_Reg_r <= "00000"; + + MCycles <= MCycles_d; + + if LDHLSP = '1' and MCycle = "011" and TState = 1 then + temp_c := unsigned('0'&SP(7 downto 0))+unsigned('0'&Save_Mux); + temp_h := unsigned('0'&SP(3 downto 0))+unsigned('0'&Save_Mux(3 downto 0)); + F(Flag_Z) <= '0'; + F(Flag_N) <= '0'; + F(Flag_H) <= temp_h(4); + F(Flag_C) <= temp_c(8); + end if; + + if ADDSPdd = '1' and TState = 1 then + temp_c := unsigned('0'&SP(7 downto 0))+unsigned('0'&Save_Mux); + temp_h := unsigned('0'&SP(3 downto 0))+unsigned('0'&Save_Mux(3 downto 0)); + F(Flag_Z) <= '0'; + F(Flag_N) <= '0'; + F(Flag_H) <= temp_h(4); + F(Flag_C) <= temp_c(8); + end if; + + if Mode = 3 then + IStatus <= "10"; + elsif IMode /= "11" then + IStatus <= IMode; + end if; + + Arith16_r <= Arith16; + PreserveC_r <= PreserveC; + if ISet = "10" and ALU_OP(2) = '0' and ALU_OP(0) = '1' and MCycle = "011" then + Z16_r <= '1'; + else + Z16_r <= '0'; + end if; + + if MCycle = "001" and TState(2) = '0' then + -- MCycle = 1 and TState = 1, 2, or 3 + + if TState = 2 and Wait_n = '1' then + if Mode < 2 then + A(7 downto 0) <= std_logic_vector(R); + A(15 downto 8) <= I; + R(6 downto 0) <= R(6 downto 0) + 1; + end if; + + if Jump = '0' and Call = '0' and NMICycle = '0' and IntCycle = '0' and not (Halt_FF = '1' or Halt = '1') then + PC <= PC + 1; + end if; + + if IntCycle = '1' and IStatus = "01" then + IR <= "11111111"; + elsif Halt_FF = '1' or (IntCycle = '1' and IStatus = "10") or NMICycle = '1' then + IR <= "00000000"; + else + IR <= DInst; + end if; + + if Mode <= 1 and IntCycle = '1' and IStatus = "10" then + -- IM2 vector address low byte from bus + WZ(7 downto 0) <= DInst; + end if; + + ISet <= "00"; + if Prefix /= "00" then + if Prefix = "11" then + if IR(5) = '1' then + XY_State <= "10"; + else + XY_State <= "01"; + end if; + else + if Prefix = "10" then + XY_State <= "00"; + XY_Ind <= '0'; + end if; + ISet <= Prefix; + end if; + else + XY_State <= "00"; + XY_Ind <= '0'; + end if; + end if; + + else + -- either (MCycle > 1) OR (MCycle = 1 AND TState > 3) + + if MCycle = "110" then + XY_Ind <= '1'; + if Prefix = "01" then + ISet <= "01"; + end if; + end if; + + if T_Res = '1' then + BTR_r <= (I_BT or I_BC or I_BTR) and not No_BTR; + if Jump = '1' then + A(15 downto 8) <= DI_Reg; + A(7 downto 0) <= WZ(7 downto 0); + PC(15 downto 8) <= unsigned(DI_Reg); + PC(7 downto 0) <= unsigned(WZ(7 downto 0)); + elsif JumpXY = '1' then + A <= RegBusC; + PC <= unsigned(RegBusC); + elsif Call = '1' or RstP = '1' then + A <= WZ; + PC <= unsigned(WZ); + elsif MCycle = MCycles and NMICycle = '1' then + A <= "0000000001100110"; + PC <= "0000000001100110"; + elsif ((Mode /= 3 and MCycle = "011") or (Mode = 3 and MCycle = "100")) + and IntCycle = '1' and IStatus = "10" then + A(15 downto 8) <= I; + A(7 downto 0) <= WZ(7 downto 0); + PC(15 downto 8) <= unsigned(I); + PC(7 downto 0) <= unsigned(WZ(7 downto 0)); + else + case Set_Addr_To is + when aXY => + if XY_State = "00" then + A <= RegBusC; + else + if NextIs_XY_Fetch = '1' then + A <= std_logic_vector(PC); + else + A <= WZ; + end if; + end if; + when aIOA => + if Mode = 3 then + -- Memory map I/O on GBZ80 + A(15 downto 8) <= (others => '1'); + elsif Mode = 2 then + -- Duplicate I/O address on 8080 + A(15 downto 8) <= DI_Reg; + else + A(15 downto 8) <= ACC; + end if; + A(7 downto 0) <= DI_Reg; + WZ <= (ACC & DI_Reg) + "1"; + when aSP => + A <= std_logic_vector(SP); + when aBC => + if Mode = 3 and IORQ_i = '1' then + -- Memory map I/O on GBZ80 + A(15 downto 8) <= (others => '1'); + A(7 downto 0) <= RegBusC(7 downto 0); + else + A <= RegBusC; + if SetWZ = "01" then + WZ <= RegBusC + "1"; + end if; + if SetWZ = "10" then + WZ(7 downto 0) <= RegBusC(7 downto 0) + "1"; + WZ(15 downto 8) <= ACC; + end if; + end if; + when aDE => + A <= RegBusC; + if SetWZ = "10" then + WZ(7 downto 0) <= RegBusC(7 downto 0) + "1"; + WZ(15 downto 8) <= ACC; + end if; + when aZI => + if Inc_WZ = '1' then + A <= std_logic_vector(unsigned(WZ) + 1); + else + A(15 downto 8) <= DI_Reg; + A(7 downto 0) <= WZ(7 downto 0); + if SetWZ = "10" then + WZ(7 downto 0) <= WZ(7 downto 0) + "1"; + WZ(15 downto 8) <= ACC; + end if; + end if; + when others => + if ISet = "10" and IR(7 downto 4) = x"B" and IR(2 downto 1) = "01" and MCycle = 3 and No_BTR = '0' then + -- INIR, INDR, OTIR, OTDR + A <= RegBusA_r; + elsif No_PC = '0' or No_BTR = '1' or (I_DJNZ = '1' and IncDecZ = '1') or Mode > 1 then + A <= std_logic_vector(PC); + end if; + end case; + end if; + + if SetWZ = "11" then + WZ <= std_logic_vector(ID16); + end if; + + Save_ALU_r <= Save_ALU; + ALU_Op_r <= ALU_Op; + + if Mode = 3 then + if I_CPL = '1' then + -- CPL + ACC <= not ACC; + F(Flag_H) <= '1'; + F(Flag_N) <= '1'; + end if; + if I_CCF = '1' then + -- CCF + F(Flag_C) <= not F(Flag_C); + F(Flag_H) <= '0'; + F(Flag_N) <= '0'; + end if; + if I_SCF = '1' then + -- SCF + F(Flag_C) <= '1'; + F(Flag_H) <= '0'; + F(Flag_N) <= '0'; + end if; + else + if I_CPL = '1' then + -- CPL + ACC <= not ACC; + F(Flag_Y) <= not ACC(5); + F(Flag_H) <= '1'; + F(Flag_X) <= not ACC(3); + F(Flag_N) <= '1'; + end if; + if I_CCF = '1' then + -- CCF + F(Flag_C) <= not F(Flag_C); + F(Flag_Y) <= ACC(5); + F(Flag_H) <= F(Flag_C); + F(Flag_X) <= ACC(3); + F(Flag_N) <= '0'; + end if; + if I_SCF = '1' then + -- SCF + F(Flag_C) <= '1'; + F(Flag_Y) <= ACC(5); + F(Flag_H) <= '0'; + F(Flag_X) <= ACC(3); + F(Flag_N) <= '0'; + end if; + end if; + end if; + + if (TState = 2 and I_BTR = '1' and IR(0) = '1') or (TState = 1 and I_BTR = '1' and IR(0) = '0') then + ioq := ('0' & DI_Reg) + ('0' & std_logic_vector(ID16(7 downto 0))); + F(Flag_N) <= DI_Reg(7); + F(Flag_C) <= ioq(8); + F(Flag_H) <= ioq(8); + ioq := (ioq and "000000111") xor ('0'&BusA); + F(Flag_P) <= not (ioq(0) xor ioq(1) xor ioq(2) xor ioq(3) xor ioq(4) xor ioq(5) xor ioq(6) xor ioq(7)); + end if; + + if TState = 2 and Wait_n = '1' then + if ISet = "01" and MCycle = "111" then + IR <= DInst; + end if; + if JumpE = '1' then + PC <= unsigned(signed(PC) + signed(DI_Reg)); + WZ <= std_logic_vector(signed(PC) + signed(DI_Reg)); + elsif Inc_PC = '1' then + PC <= PC + 1; + end if; + if BTR_r = '1' then + PC <= PC - 2; + end if; + if RstP = '1' then + WZ <= (others =>'0'); + WZ(5 downto 3) <= IR(5 downto 3); + end if; + end if; + if TState = 3 and MCycle = "110" then + WZ <= std_logic_vector(signed(RegBusC) + signed(DI_Reg)); + end if; + + if MCycle = "011" and TState = 4 and No_BTR = '0' then + if I_BT = '1' or I_BC = '1' then + WZ <= std_logic_vector(PC)-"1"; + end if; + end if; + + if (TState = 2 and Wait_n = '1') or (TState = 4 and MCycle = "001") then + if IncDec_16(2 downto 0) = "111" then + if IncDec_16(3) = '1' then + SP <= SP - 1; + else + SP <= SP + 1; + end if; + end if; + end if; + + if ADDSPdd = '1' and TState = 2 then + WZ <= std_logic_vector(SP); + SP <= unsigned(signed(SP)+signed(Save_Mux)); + end if; + + if LDSPHL = '1' then + SP <= unsigned(RegBusC); + end if; + if ExchangeAF = '1' then + Ap <= ACC; + ACC <= Ap; + Fp <= F; + F <= Fp; + end if; + if ExchangeRS = '1' then + Alternate <= not Alternate; + end if; + end if; + + if TState = 3 then + if LDZ = '1' then + WZ(7 downto 0) <= DI_Reg; + end if; + if LDW = '1' then + WZ(15 downto 8) <= DI_Reg; + end if; + + if Special_LD(2) = '1' then + case Special_LD(1 downto 0) is + when "00" => + ACC <= I; + F(Flag_P) <= IntE_FF2; + F(Flag_S) <= I(7); + + if I = x"00" then + F(Flag_Z) <= '1'; + else + F(Flag_Z) <= '0'; + end if; + + F(Flag_Y) <= I(5); + F(Flag_H) <= '0'; + F(Flag_X) <= I(3); + F(Flag_N) <= '0'; + + + when "01" => + ACC <= std_logic_vector(R); + F(Flag_P) <= IntE_FF2; + F(Flag_S) <= R(7); + + if R = x"00" then + F(Flag_Z) <= '1'; + else + F(Flag_Z) <= '0'; + end if; + + F(Flag_Y) <= R(5); + F(Flag_H) <= '0'; + F(Flag_X) <= R(3); + F(Flag_N) <= '0'; + + when "10" => + I <= ACC; + when others => + R <= unsigned(ACC); + end case; + end if; + end if; + + if (I_DJNZ = '0' and Save_ALU_r = '1') or ALU_Op_r = "1001" then + if Mode = 3 then + F(6) <= F_Out(6); + F(5) <= F_Out(5); + F(7) <= F_Out(7); + if PreserveC_r = '0' then + F(4) <= F_Out(4); + end if; + else + F(7 downto 1) <= F_Out(7 downto 1); + if PreserveC_r = '0' then + F(Flag_C) <= F_Out(0); + end if; + end if; + end if; + if T_Res = '1' and I_INRC = '1' then + F(Flag_H) <= '0'; + F(Flag_N) <= '0'; + F(Flag_X) <= DI_Reg(3); + F(Flag_Y) <= DI_Reg(5); + if DI_Reg(7 downto 0) = "00000000" then + F(Flag_Z) <= '1'; + else + F(Flag_Z) <= '0'; + end if; + F(Flag_S) <= DI_Reg(7); + F(Flag_P) <= not (DI_Reg(0) xor DI_Reg(1) xor DI_Reg(2) xor DI_Reg(3) xor + DI_Reg(4) xor DI_Reg(5) xor DI_Reg(6) xor DI_Reg(7)); + end if; + + if TState = 1 and Auto_Wait_t1 = '0' then + -- Keep D0 from M3 for RLD/RRD (Sorgelig) + I_RXDD <= I_RLD or I_RRD; + if I_RXDD='0' then + DO <= BusB; + end if; + if I_RLD = '1' then + DO(3 downto 0) <= BusA(3 downto 0); + DO(7 downto 4) <= BusB(3 downto 0); + end if; + if I_RRD = '1' then + DO(3 downto 0) <= BusB(7 downto 4); + DO(7 downto 4) <= BusA(3 downto 0); + end if; + end if; + + if T_Res = '1' then + Read_To_Reg_r(3 downto 0) <= Set_BusA_To; + Read_To_Reg_r(4) <= Read_To_Reg; + if Read_To_Acc = '1' then + Read_To_Reg_r(3 downto 0) <= "0111"; + Read_To_Reg_r(4) <= '1'; + end if; + end if; + + if TState = 1 and I_BT = '1' then + F(Flag_X) <= ALU_Q(3); + F(Flag_Y) <= ALU_Q(1); + F(Flag_H) <= '0'; + F(Flag_N) <= '0'; + end if; + if TState = 1 and I_BC = '1' then + n := ALU_Q - ("0000000" & F_Out(Flag_H)); + F(Flag_X) <= n(3); + F(Flag_Y) <= n(1); + end if; + if I_BC = '1' or I_BT = '1' then + F(Flag_P) <= IncDecZ; + end if; + + if (TState = 1 and Save_ALU_r = '0' and Auto_Wait_t1 = '0') or + (Save_ALU_r = '1' and ALU_OP_r /= "0111") then + case Read_To_Reg_r is + when "10111" => + ACC <= Save_Mux; + when "10110" => + DO <= Save_Mux; + when "11000" => + SP(7 downto 0) <= unsigned(Save_Mux); + when "11001" => + SP(15 downto 8) <= unsigned(Save_Mux); + when "11011" => + if Mode = 3 then + F(7 downto 4) <= Save_Mux(7 downto 4); + F(3 downto 0) <= "0000"; -- bit 3 to 0 always return 0 + else + F <= Save_Mux; + end if; + when others => + end case; + if XYbit_undoc='1' then + DO <= ALU_Q; + end if; + end if; + end if; + end if; + end process; + +--------------------------------------------------------------------------- +-- +-- Multiply +-- +--------------------------------------------------------------------------- + process (CLK_n, ACC, RegBusB, MULU_tmp, MULU_Fakt1, MULU_Prod32) + begin + + MULU_tmp(31 downto 12) <= std_logic_vector((unsigned(MULU_Fakt1)*unsigned(MULU_Prod32(3 downto 0)))+unsigned("0000"&MULU_Prod32(31 downto 16))); + MULU_tmp(11 downto 0) <= MULU_Prod32(15 downto 4); + + if rising_edge(CLK_n) then + if ClkEn = '1' then + if T_Res='1' then + if I_MULUB='1' then + MULU_Prod32(7 downto 0) <= ACC; + MULU_Prod32(15 downto 8) <= "--------"; + MULU_Prod32(31 downto 16) <= X"0000"; + MULU_Fakt1(7 downto 0) <= "00000000"; + if Set_BusB_To(0) = '1' then + MULU_Fakt1(15 downto 8) <= RegBusB(7 downto 0); + else + MULU_Fakt1(15 downto 8) <= RegBusB(15 downto 8); + end if; + else + MULU_Prod32(15 downto 0) <= RegBusA; + MULU_Prod32(31 downto 16) <= X"0000"; + MULU_Fakt1 <= RegBusB; + end if; + else + MULU_Prod32 <= MULU_tmp; + end if; + end if; + end if; + end process; + +--------------------------------------------------------------------------- +-- +-- BC('), DE('), HL('), IX and IY +-- +--------------------------------------------------------------------------- + process (CLK_n) + begin + if rising_edge(CLK_n) then + if ClkEn = '1' then + -- Bus A / Write + RegAddrA_r <= Alternate & Set_BusA_To(2 downto 1); + if XY_Ind = '0' and XY_State /= "00" and Set_BusA_To(2 downto 1) = "10" then + RegAddrA_r <= XY_State(1) & "11"; + end if; + + -- Bus B + RegAddrB_r <= Alternate & Set_BusB_To(2 downto 1); + if XY_Ind = '0' and XY_State /= "00" and Set_BusB_To(2 downto 1) = "10" then + RegAddrB_r <= XY_State(1) & "11"; + end if; + + -- Address from register + RegAddrC <= Alternate & Set_Addr_To(1 downto 0); + -- Jump (HL), LD SP,HL + if (JumpXY = '1' or LDSPHL = '1') then + RegAddrC <= Alternate & "10"; + end if; + if ((JumpXY = '1' or LDSPHL = '1') and XY_State /= "00") or (MCycle = "110") then + RegAddrC <= XY_State(1) & "11"; + end if; + + if I_DJNZ = '1' and Save_ALU_r = '1' and Mode < 2 then + IncDecZ <= F_Out(Flag_Z); + end if; + if (TState = 2 or (TState = 3 and MCycle = "001")) and IncDec_16(2 downto 0) = "100" then + if ID16 = 0 then + IncDecZ <= '0'; + else + IncDecZ <= '1'; + end if; + end if; + + RegBusA_r <= RegBusA; + end if; + end if; + end process; + + RegAddrA <= + -- 16 bit increment/decrement + Alternate & IncDec_16(1 downto 0) when (TState = 2 or + (TState = 3 and MCycle = "001" and IncDec_16(2) = '1')) and XY_State = "00" else + XY_State(1) & "11" when (TState = 2 or + (TState = 3 and MCycle = "001" and IncDec_16(2) = '1')) and IncDec_16(1 downto 0) = "10" else + -- EX HL,DL + Alternate & "10" when ExchangeDH = '1' and TState = 3 else + Alternate & "01" when (ExchangeDH = '1' or I_MULU = '1') and TState = 4 else + -- EX (SP),HL (HL(IX,IY) <= WZ) + Alternate & "10" when ExchangeWH = '1' and XY_State = "00" and TState = 4 else + XY_State(1) & "11" when ExchangeWH = '1' and TState = 4 else + -- LDHLSP + "010" when LDHLSP = '1' and TState = 4 else + + -- Bus A / Write + RegAddrA_r; + + RegAddrB <= + -- EX HL,DL + Alternate & "01" when ExchangeDH = '1' and TState = 3 else + -- Bus B + RegAddrB_r; + + ID16 <= signed(RegBusA) - 1 when IncDec_16(3) = '1' else + signed(RegBusA) + 1; + + process (Save_ALU_r, Auto_Wait_t1, ALU_OP_r, Read_To_Reg_r, I_MULU, T_Res, + ExchangeDH, ExchangeWH, IncDec_16, MCycle, TState, Wait_n, LDHLSP) + begin + RegWEH <= '0'; + RegWEL <= '0'; + if (TState = 1 and Save_ALU_r = '0' and Auto_Wait_t1 = '0') or + (Save_ALU_r = '1' and ALU_OP_r /= "0111") then + case Read_To_Reg_r is + when "10000" | "10001" | "10010" | "10011" | "10100" | "10101" => + RegWEH <= not Read_To_Reg_r(0); + RegWEL <= Read_To_Reg_r(0); + when others => + end case; + end if; + + if I_MULU = '1' and (T_Res = '1' or TState = 4) then -- TState = 4 DE write + RegWEH <= '1'; + RegWEL <= '1'; + end if; + + if ExchangeDH = '1' and (TState = 3 or TState = 4) then + RegWEH <= '1'; + RegWEL <= '1'; + end if; + + if ((LDHLSP = '1' and MCycle = "010") or ExchangeWH = '1') and TState = 4 then + RegWEH <= '1'; + RegWEL <= '1'; + end if; + + if IncDec_16(2) = '1' and ((TState = 2 and Wait_n = '1' and MCycle /= "001") or (TState = 3 and MCycle = "001")) then + case IncDec_16(1 downto 0) is + when "00" | "01" | "10" => + RegWEH <= '1'; + RegWEL <= '1'; + when others => + end case; + end if; + end process; + + TmpAddr2 <= std_logic_vector(unsigned(signed(SP) + signed(Save_Mux))); + + process (Save_Mux, RegBusB, RegBusA_r, ID16, I_MULU, MULU_Prod32, MULU_tmp, T_Res, + ExchangeDH, ExchangeWH, IncDec_16, MCycle, TState, Wait_n, LDHLSP, TmpAddr2, WZ) + begin + RegDIH <= Save_Mux; + RegDIL <= Save_Mux; + + if I_MULU = '1' then + if T_Res = '1' then + RegDIH <= MULU_Prod32(31 downto 24); + RegDIL <= MULU_Prod32(23 downto 16); + else + RegDIH <= MULU_tmp(15 downto 8); -- TState = 4 DE write + RegDIL <= MULU_tmp(7 downto 0); + end if; + end if; + + if LDHLSP = '1' and MCycle = "010" and TState = 4 then + RegDIH <= TmpAddr2(15 downto 8); + RegDIL <= TmpAddr2(7 downto 0); + end if; + + if ExchangeDH = '1' and TState = 3 then + RegDIH <= RegBusB(15 downto 8); + RegDIL <= RegBusB(7 downto 0); + end if; + if ExchangeDH = '1' and TState = 4 then + RegDIH <= RegBusA_r(15 downto 8); + RegDIL <= RegBusA_r(7 downto 0); + end if; + if ExchangeWH = '1' and TState = 4 then + RegDIH <= WZ(15 downto 8); + RegDIL <= WZ(7 downto 0); + end if; + if IncDec_16(2) = '1' and ((TState = 2 and MCycle /= "001") or (TState = 3 and MCycle = "001")) then + RegDIH <= std_logic_vector(ID16(15 downto 8)); + RegDIL <= std_logic_vector(ID16(7 downto 0)); + end if; + end process; + + Regs : T80_Reg + port map( + Clk => CLK_n, + CEN => ClkEn, + WEH => RegWEH, + WEL => RegWEL, + AddrA => RegAddrA, + AddrB => RegAddrB, + AddrC => RegAddrC, + DIH => RegDIH, + DIL => RegDIL, + DOAH => RegBusA(15 downto 8), + DOAL => RegBusA(7 downto 0), + DOBH => RegBusB(15 downto 8), + DOBL => RegBusB(7 downto 0), + DOCH => RegBusC(15 downto 8), + DOCL => RegBusC(7 downto 0), + DOR => DOR, + DIRSet => DIRSet, + DIR => DIR(207 downto 80)); + +--------------------------------------------------------------------------- +-- +-- Buses +-- +--------------------------------------------------------------------------- + process (CLK_n) + begin + if rising_edge(CLK_n) then + if ClkEn = '1' then + case Set_BusB_To is + when "0111" => + BusB <= ACC; + when "0000" | "0001" | "0010" | "0011" | "0100" | "0101" => + if Set_BusB_To(0) = '1' then + BusB <= RegBusB(7 downto 0); + else + BusB <= RegBusB(15 downto 8); + end if; + when "0110" => + BusB <= DI_Reg; + when "1000" => + BusB <= std_logic_vector(SP(7 downto 0)); + when "1001" => + BusB <= std_logic_vector(SP(15 downto 8)); + when "1010" => + BusB <= "00000001"; + when "1011" => + BusB <= F; + when "1100" => + BusB <= std_logic_vector(PC(7 downto 0)); + when "1101" => + BusB <= std_logic_vector(PC(15 downto 8)); + when "1110" => + if IR = x"71" and out0 = '1' then + BusB <= "11111111"; + else + BusB <= "00000000"; + end if; + when others => + BusB <= "--------"; + end case; + + case Set_BusA_To is + when "0111" => + BusA <= ACC; + when "0000" | "0001" | "0010" | "0011" | "0100" | "0101" => + if Set_BusA_To(0) = '1' then + BusA <= RegBusA(7 downto 0); + else + BusA <= RegBusA(15 downto 8); + end if; + when "0110" => + BusA <= DI_Reg; + when "1000" => + BusA <= std_logic_vector(SP(7 downto 0)); + when "1001" => + BusA <= std_logic_vector(SP(15 downto 8)); + when "1010" => + BusA <= "00000000"; + when others => + BusA <= "--------"; + end case; + if XYbit_undoc='1' then + BusA <= DI_Reg; + BusB <= DI_Reg; + end if; + end if; + end if; + end process; + +--------------------------------------------------------------------------- +-- +-- Generate external control signals +-- +--------------------------------------------------------------------------- + process (RESET_n,CLK_n) + begin + if RESET_n = '0' then + RFSH_n <= '1'; + elsif rising_edge(CLK_n) then + if DIRSet = '0' and CEN = '1' then + if MCycle = "001" and ((TState = 2 and Wait_n = '1') or TState = 3) then + RFSH_n <= '0'; + else + RFSH_n <= '1'; + end if; + end if; + end if; + end process; + + MC <= std_logic_vector(MCycle); + TS <= std_logic_vector(TState); + DI_Reg <= DI; + HALT_n <= not Halt_FF; + BUSAK_n <= not (BusAck and RESET_n); + IntCycle_n <= not IntCycle; + IntE <= IntE_FF1; + IORQ <= IORQ_i; + Stop <= I_DJNZ; +------------------------------------------------------------------------- +-- +-- Main state machine +-- +------------------------------------------------------------------------- + process (RESET_n, CLK_n) + variable OldNMI_n : std_logic; + begin + if RESET_n = '0' then + MCycle <= "001"; + TState <= "000"; + Pre_XY_F_M <= "000"; + Halt_FF <= '0'; + --BusAck <= '0'; + NMICycle <= '0'; + IntCycle <= '0'; + IntE_FF1 <= '0'; + IntE_FF2 <= '0'; + No_BTR <= '0'; + Auto_Wait_t1 <= '0'; + Auto_Wait_t2 <= '0'; + M1_n <= '1'; + --BusReq_s <= '0'; + NMI_s <= '0'; + elsif rising_edge(CLK_n) then + if DIRSet = '1' then + IntE_FF2 <= DIR(211); + IntE_FF1 <= DIR(210); + else + if NMI_n = '0' and OldNMI_n = '1' then + NMI_s <= '1'; + end if; + OldNMI_n := NMI_n; + + if CEN = '1' then + BusReq_s <= not BUSRQ_n; + Auto_Wait_t2 <= Auto_Wait_t1; + if T_Res = '1' then + Auto_Wait_t1 <= '0'; + Auto_Wait_t2 <= '0'; + else + Auto_Wait_t1 <= Auto_Wait or IORQ_i; + end if; + No_BTR <= (I_BT and (not IR(4) or not F(Flag_P))) or + (I_BC and (not IR(4) or F(Flag_Z) or not F(Flag_P))) or + (I_BTR and (not IR(4) or F(Flag_Z))); + if TState = 2 then + if SetEI = '1' then + IntE_FF1 <= '1'; + IntE_FF2 <= '1'; + end if; + if I_RETN = '1' then + IntE_FF1 <= IntE_FF2; + end if; + end if; + if TState = 3 then + if SetDI = '1' then + IntE_FF1 <= '0'; + IntE_FF2 <= '0'; + end if; + end if; + if IntCycle = '1' or NMICycle = '1' then + Halt_FF <= '0'; + end if; + if MCycle = "001" and TState = 2 and Wait_n = '1' then + M1_n <= '1'; + end if; + if BusReq_s = '1' and BusAck = '1' then + else + BusAck <= '0'; + if TState = 2 and Wait_n = '0' then + elsif T_Res = '1' then + if Halt = '1' and ( not(Mode = 3 and INT_n = '0' and IntE_FF1 = '0')) then -- halt bug when Mode = 3 , INT_n = '0' and IME=0 + Halt_FF <= '1'; + end if; + if BusReq_s = '1' then + BusAck <= '1'; + else + TState <= "001"; + if (IntCycle = '1' and Mode = 3) then -- GB: read interrupt at MCycle 3 + if (MCycle = "010") then + M1_n <= '0'; + else + M1_n <= '1'; + end if; + end if; + if NextIs_XY_Fetch = '1' then + MCycle <= "110"; + Pre_XY_F_M <= MCycle; + if IR = "00110110" and Mode = 0 then + Pre_XY_F_M <= "010"; + end if; + elsif (MCycle = "111") or (MCycle = "110" and Mode = 1 and ISet /= "01") then + MCycle <= std_logic_vector(unsigned(Pre_XY_F_M) + 1); + elsif (MCycle = MCycles) or No_BTR = '1' or (MCycle = "010" and I_DJNZ = '1' and IncDecZ = '1') then + M1_n <= '0'; + MCycle <= "001"; + IntCycle <= '0'; + NMICycle <= '0'; + if NMI_s = '1' and Prefix = "00" then + NMI_s <= '0'; + NMICycle <= '1'; + IntE_FF1 <= '0'; + elsif IntE_FF1 = '1' and INT_n='0' and Prefix = "00" and SetEI = '0' then + IntCycle <= '1'; + IntE_FF1 <= '0'; + IntE_FF2 <= '0'; + elsif (Halt_FF = '1' and INT_n = '0' and Mode = 3) then + Halt_FF <= '0'; + end if; + else + MCycle <= std_logic_vector(unsigned(MCycle) + 1); + end if; + end if; + else + if (Auto_Wait = '1' and Auto_Wait_t2 = '0') nor + (IOWait = 1 and IORQ_i = '1' and Auto_Wait_t1 = '0') then + TState <= TState + 1; + end if; + end if; + end if; + if TState = 0 then + M1_n <= '0'; + end if; + end if; + end if; + end if; + end process; + + Auto_Wait <= '1' when IntCycle = '1' and MCycle = "001" else '0'; +end; diff --git a/modules/cpu-t80/T8080se.vhd b/modules/cpu-t80/T8080se.vhd new file mode 100644 index 0000000..b18b47a --- /dev/null +++ b/modules/cpu-t80/T8080se.vhd @@ -0,0 +1,194 @@ +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- +-- 8080 compatible microprocessor core, synchronous top level with clock enable +-- Different timing than the original 8080 +-- Inputs needs to be synchronous and outputs may glitch +-- +-- Version : 0242 +-- +-- Copyright (c) 2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- STACK status output not supported +-- +-- File history : +-- +-- 0237 : First version +-- +-- 0238 : Updated for T80 interface change +-- +-- 0240 : Updated for T80 interface change +-- +-- 0242 : Updated for T80 interface change +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use work.T80_Pack.all; + +entity T8080se is + generic( + Mode : integer := 2; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + T2Write : integer := 0 -- 0 => WR_n active in T3, /=0 => WR_n active in T2 + ); + port( + RESET_n : in std_logic; + CLK : in std_logic; + CLKEN : in std_logic; + READY : in std_logic; + HOLD : in std_logic; + INT : in std_logic; + INTE : out std_logic; + DBIN : out std_logic; + SYNC : out std_logic; + VAIT : out std_logic; + HLDA : out std_logic; + WR_n : out std_logic; + A : out std_logic_vector(15 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0) + ); +end T8080se; + +architecture rtl of T8080se is + + signal IntCycle_n : std_logic; + signal NoRead : std_logic; + signal Write : std_logic; + signal IORQ : std_logic; + signal INT_n : std_logic; + signal HALT_n : std_logic; + signal BUSRQ_n : std_logic; + signal BUSAK_n : std_logic; + signal DO_i : std_logic_vector(7 downto 0); + signal DI_Reg : std_logic_vector(7 downto 0); + signal MCycle : std_logic_vector(2 downto 0); + signal TState : std_logic_vector(2 downto 0); + signal One : std_logic; + +begin + + INT_n <= not INT; + BUSRQ_n <= HOLD; + HLDA <= not BUSAK_n; + SYNC <= '1' when TState = "001" else '0'; + VAIT <= '1' when TState = "010" else '0'; + One <= '1'; + + DO(0) <= not IntCycle_n when TState = "001" else DO_i(0); -- INTA + DO(1) <= Write when TState = "001" else DO_i(1); -- WO_n + DO(2) <= DO_i(2); -- STACK not supported !!!!!!!!!! + DO(3) <= not HALT_n when TState = "001" else DO_i(3); -- HLTA + DO(4) <= IORQ and Write when TState = "001" else DO_i(4); -- OUT + DO(5) <= DO_i(5) when TState /= "001" else '1' when MCycle = "001" else '0'; -- M1 + DO(6) <= IORQ and not Write when TState = "001" else DO_i(6); -- INP + DO(7) <= not IORQ and not Write and IntCycle_n when TState = "001" else DO_i(7); -- MEMR + + u0 : T80 + generic map( + Mode => Mode, + IOWait => 0) + port map( + CEN => CLKEN, + M1_n => open, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => open, + HALT_n => HALT_n, + WAIT_n => READY, + INT_n => INT_n, + NMI_n => One, + RESET_n => RESET_n, + BUSRQ_n => One, + BUSAK_n => BUSAK_n, + CLK_n => CLK, + A => A, + DInst => DI, + DI => DI_Reg, + DO => DO_i, + MC => MCycle, + TS => TState, + IntCycle_n => IntCycle_n, + IntE => INTE); + + process (RESET_n, CLK) + begin + if RESET_n = '0' then + DBIN <= '0'; + WR_n <= '1'; + DI_Reg <= "00000000"; + elsif CLK'event and CLK = '1' then + if CLKEN = '1' then + DBIN <= '0'; + WR_n <= '1'; + if MCycle = "001" then + if TState = "001" or (TState = "010" and READY = '0') then + DBIN <= IntCycle_n; + end if; + else + if (TState = "001" or (TState = "010" and READY = '0')) and NoRead = '0' and Write = '0' then + DBIN <= '1'; + end if; + if T2Write = 0 then + if TState = "010" and Write = '1' then + WR_n <= '0'; + end if; + else + if (TState = "001" or (TState = "010" and READY = '0')) and Write = '1' then + WR_n <= '0'; + end if; + end if; + end if; + if TState = "010" and READY = '1' then + DI_Reg <= DI; + end if; + end if; + end if; + end process; + +end; diff --git a/modules/cpu-t80/T80_ALU.vhd b/modules/cpu-t80/T80_ALU.vhd new file mode 100644 index 0000000..1192e0b --- /dev/null +++ b/modules/cpu-t80/T80_ALU.vhd @@ -0,0 +1,409 @@ +-------------------------------------------------------------------------------- +-- **** +-- T80(c) core. Attempt to finish all undocumented features and provide +-- accurate timings. +-- Version 350. +-- Copyright (c) 2018 Sorgelig +-- Test passed: ZEXDOC, ZEXALL, Z80Full(*), Z80memptr +-- (*) Currently only SCF and CCF instructions aren't passed X/Y flags check as +-- correct implementation is still unclear. +-- +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- Ver 301 parity flag is just parity for 8080, also overflow for Z80, by Sean Riddle +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- Z80 compatible microprocessor core +-- +-- Version : 0247 +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0214 : Fixed mostly flags, only the block instructions now fail the zex regression test +-- 0238 : Fixed zero flag for 16 bit SBC and ADC +-- 0240 : Added GB operations +-- 0242 : Cleanup +-- 0247 : Cleanup +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; + +entity T80_ALU is + generic( + Mode : integer := 0; + Flag_C : integer := 0; + Flag_N : integer := 1; + Flag_P : integer := 2; + Flag_X : integer := 3; + Flag_H : integer := 4; + Flag_Y : integer := 5; + Flag_Z : integer := 6; + Flag_S : integer := 7 + ); + port( + Arith16 : in std_logic; + Z16 : in std_logic; + WZ : in std_logic_vector(15 downto 0); + XY_State : in std_logic_vector(1 downto 0); + ALU_Op : in std_logic_vector(3 downto 0); + Rot_Akku : in std_logic; + IR : in std_logic_vector(5 downto 0); + ISet : in std_logic_vector(1 downto 0); + BusA : in std_logic_vector(7 downto 0); + BusB : in std_logic_vector(7 downto 0); + F_In : in std_logic_vector(7 downto 0); + Q : out std_logic_vector(7 downto 0); + F_Out : out std_logic_vector(7 downto 0) + ); +end T80_ALU; + +architecture rtl of T80_ALU is + + procedure AddSub(A : std_logic_vector; + B : std_logic_vector; + Sub : std_logic; + Carry_In : std_logic; + signal Res : out std_logic_vector; + signal Carry : out std_logic) is + + variable B_i : unsigned(A'length - 1 downto 0); + variable Res_i : unsigned(A'length + 1 downto 0); + begin + if Sub = '1' then + B_i := not unsigned(B); + else + B_i := unsigned(B); + end if; + + Res_i := unsigned("0" & A & Carry_In) + unsigned("0" & B_i & "1"); + Carry <= Res_i(A'length + 1); + Res <= std_logic_vector(Res_i(A'length downto 1)); + end; + + -- AddSub variables (temporary signals) + signal UseCarry : std_logic; + signal Carry7_v : std_logic; + signal Overflow_v : std_logic; + signal HalfCarry_v : std_logic; + signal Carry_v : std_logic; + signal Q_v : std_logic_vector(7 downto 0); + + signal BitMask : std_logic_vector(7 downto 0); + +begin + + with IR(5 downto 3) select BitMask <= "00000001" when "000", + "00000010" when "001", + "00000100" when "010", + "00001000" when "011", + "00010000" when "100", + "00100000" when "101", + "01000000" when "110", + "10000000" when others; + + UseCarry <= not ALU_Op(2) and ALU_Op(0); + AddSub(BusA(3 downto 0), BusB(3 downto 0), ALU_Op(1), ALU_Op(1) xor (UseCarry and F_In(Flag_C)), Q_v(3 downto 0), HalfCarry_v); + AddSub(BusA(6 downto 4), BusB(6 downto 4), ALU_Op(1), HalfCarry_v, Q_v(6 downto 4), Carry7_v); + AddSub(BusA(7 downto 7), BusB(7 downto 7), ALU_Op(1), Carry7_v, Q_v(7 downto 7), Carry_v); + + -- bug fix - parity flag is just parity for 8080, also overflow for Z80 + process (Carry_v, Carry7_v, Q_v) + begin + if(Mode=2) then + OverFlow_v <= not (Q_v(0) xor Q_v(1) xor Q_v(2) xor Q_v(3) xor + Q_v(4) xor Q_v(5) xor Q_v(6) xor Q_v(7)); else + OverFlow_v <= Carry_v xor Carry7_v; + end if; + end process; + + process (Arith16, ALU_OP, F_In, BusA, BusB, IR, Q_v, Carry_v, HalfCarry_v, OverFlow_v, BitMask, ISet, Z16, Rot_Akku, WZ, XY_State) + variable Q_t : std_logic_vector(7 downto 0); + variable DAA_Q : unsigned(8 downto 0); + begin + Q_t := "--------"; + F_Out <= F_In; + DAA_Q := "---------"; + case ALU_Op is + when "0000" | "0001" | "0010" | "0011" | "0100" | "0101" | "0110" | "0111" => + F_Out(Flag_N) <= '0'; + F_Out(Flag_C) <= '0'; + case ALU_OP(2 downto 0) is + when "000" | "001" => -- ADD, ADC + Q_t := Q_v; + F_Out(Flag_C) <= Carry_v; + F_Out(Flag_H) <= HalfCarry_v; + F_Out(Flag_P) <= OverFlow_v; + when "010" | "011" | "111" => -- SUB, SBC, CP + Q_t := Q_v; + F_Out(Flag_N) <= '1'; + F_Out(Flag_C) <= not Carry_v; + F_Out(Flag_H) <= not HalfCarry_v; + F_Out(Flag_P) <= OverFlow_v; + when "100" => -- AND + Q_t(7 downto 0) := BusA and BusB; + F_Out(Flag_H) <= '1'; + when "101" => -- XOR + Q_t(7 downto 0) := BusA xor BusB; + F_Out(Flag_H) <= '0'; + when others => -- OR "110" + Q_t(7 downto 0) := BusA or BusB; + F_Out(Flag_H) <= '0'; + end case; + if ALU_Op(2 downto 0) = "111" then -- CP + F_Out(Flag_X) <= BusB(3); + F_Out(Flag_Y) <= BusB(5); + else + F_Out(Flag_X) <= Q_t(3); + F_Out(Flag_Y) <= Q_t(5); + end if; + if Q_t(7 downto 0) = "00000000" then + F_Out(Flag_Z) <= '1'; + if Z16 = '1' then + F_Out(Flag_Z) <= F_In(Flag_Z); -- 16 bit ADC,SBC + end if; + else + F_Out(Flag_Z) <= '0'; + end if; + F_Out(Flag_S) <= Q_t(7); + case ALU_Op(2 downto 0) is + when "000" | "001" | "010" | "011" | "111" => -- ADD, ADC, SUB, SBC, CP + when others => + F_Out(Flag_P) <= not (Q_t(0) xor Q_t(1) xor Q_t(2) xor Q_t(3) xor + Q_t(4) xor Q_t(5) xor Q_t(6) xor Q_t(7)); + end case; + if Arith16 = '1' then + F_Out(Flag_S) <= F_In(Flag_S); + F_Out(Flag_Z) <= F_In(Flag_Z); + F_Out(Flag_P) <= F_In(Flag_P); + end if; + when "1100" => + -- DAA + if Mode = 3 then + F_Out(Flag_H) <= '0'; + F_Out(Flag_C) <= F_In(Flag_C); + DAA_Q(7 downto 0) := unsigned(BusA); + DAA_Q(8) := '0'; + if F_In(Flag_N) = '0' then + -- After addition + -- Alow > 9 or H = 1 + if DAA_Q(3 downto 0) > 9 or F_In(Flag_H) = '1' then + DAA_Q := DAA_Q + 6; + end if; + -- new Ahigh > 9 or C = 1 + if DAA_Q(8 downto 4) > 9 or F_In(Flag_C) = '1' then + DAA_Q := DAA_Q + 96; -- 0x60 + end if; + else + -- After subtraction + if F_In(Flag_H) = '1' then + DAA_Q := DAA_Q - 6; + if F_In(Flag_C) = '0' then + DAA_Q(8) := '0'; + end if; + end if; + if F_In(Flag_C) = '1' then + DAA_Q := DAA_Q - 96; -- 0x60 + end if; + end if; + else + F_Out(Flag_H) <= F_In(Flag_H); + F_Out(Flag_C) <= F_In(Flag_C); + DAA_Q(7 downto 0) := unsigned(BusA); + DAA_Q(8) := '0'; + if F_In(Flag_N) = '0' then + -- After addition + -- Alow > 9 or H = 1 + if DAA_Q(3 downto 0) > 9 or F_In(Flag_H) = '1' then + if (DAA_Q(3 downto 0) > 9) then + F_Out(Flag_H) <= '1'; + else + F_Out(Flag_H) <= '0'; + end if; + DAA_Q := DAA_Q + 6; + end if; + -- new Ahigh > 9 or C = 1 + if DAA_Q(8 downto 4) > 9 or F_In(Flag_C) = '1' then + DAA_Q := DAA_Q + 96; -- 0x60 + end if; + else + -- After subtraction + if DAA_Q(3 downto 0) > 9 or F_In(Flag_H) = '1' then + if DAA_Q(3 downto 0) > 5 then + F_Out(Flag_H) <= '0'; + end if; + DAA_Q(7 downto 0) := DAA_Q(7 downto 0) - 6; + end if; + if unsigned(BusA) > 153 or F_In(Flag_C) = '1' then + DAA_Q := DAA_Q - 352; -- 0x160 + end if; + end if; + end if; + F_Out(Flag_X) <= DAA_Q(3); + F_Out(Flag_Y) <= DAA_Q(5); + F_Out(Flag_C) <= F_In(Flag_C) or DAA_Q(8); + Q_t := std_logic_vector(DAA_Q(7 downto 0)); + if DAA_Q(7 downto 0) = "00000000" then + F_Out(Flag_Z) <= '1'; + else + F_Out(Flag_Z) <= '0'; + end if; + F_Out(Flag_S) <= DAA_Q(7); + F_Out(Flag_P) <= not (DAA_Q(0) xor DAA_Q(1) xor DAA_Q(2) xor DAA_Q(3) xor + DAA_Q(4) xor DAA_Q(5) xor DAA_Q(6) xor DAA_Q(7)); + when "1101" | "1110" => + -- RLD, RRD + Q_t(7 downto 4) := BusA(7 downto 4); + if ALU_Op(0) = '1' then + Q_t(3 downto 0) := BusB(7 downto 4); + else + Q_t(3 downto 0) := BusB(3 downto 0); + end if; + F_Out(Flag_H) <= '0'; + F_Out(Flag_N) <= '0'; + F_Out(Flag_X) <= Q_t(3); + F_Out(Flag_Y) <= Q_t(5); + if Q_t(7 downto 0) = "00000000" then + F_Out(Flag_Z) <= '1'; + else + F_Out(Flag_Z) <= '0'; + end if; + F_Out(Flag_S) <= Q_t(7); + F_Out(Flag_P) <= not (Q_t(0) xor Q_t(1) xor Q_t(2) xor Q_t(3) xor + Q_t(4) xor Q_t(5) xor Q_t(6) xor Q_t(7)); + when "1001" => + -- BIT + Q_t(7 downto 0) := BusB and BitMask; + F_Out(Flag_S) <= Q_t(7); + if Q_t(7 downto 0) = "00000000" then + F_Out(Flag_Z) <= '1'; + F_Out(Flag_P) <= '1'; + else + F_Out(Flag_Z) <= '0'; + F_Out(Flag_P) <= '0'; + end if; + F_Out(Flag_H) <= '1'; + F_Out(Flag_N) <= '0'; + if IR(2 downto 0) = "110" or XY_State /= "00" then + F_Out(Flag_X) <= WZ(11); + F_Out(Flag_Y) <= WZ(13); + else + F_Out(Flag_X) <= BusB(3); + F_Out(Flag_Y) <= BusB(5); + end if; + when "1010" => + -- SET + Q_t(7 downto 0) := BusB or BitMask; + when "1011" => + -- RES + Q_t(7 downto 0) := BusB and not BitMask; + when "1000" => + -- ROT + case IR(5 downto 3) is + when "000" => -- RLC + Q_t(7 downto 1) := BusA(6 downto 0); + Q_t(0) := BusA(7); + F_Out(Flag_C) <= BusA(7); + when "010" => -- RL + Q_t(7 downto 1) := BusA(6 downto 0); + Q_t(0) := F_In(Flag_C); + F_Out(Flag_C) <= BusA(7); + when "001" => -- RRC + Q_t(6 downto 0) := BusA(7 downto 1); + Q_t(7) := BusA(0); + F_Out(Flag_C) <= BusA(0); + when "011" => -- RR + Q_t(6 downto 0) := BusA(7 downto 1); + Q_t(7) := F_In(Flag_C); + F_Out(Flag_C) <= BusA(0); + when "100" => -- SLA + Q_t(7 downto 1) := BusA(6 downto 0); + Q_t(0) := '0'; + F_Out(Flag_C) <= BusA(7); + when "110" => -- SLL (Undocumented) / SWAP + if Mode = 3 then + Q_t(7 downto 4) := BusA(3 downto 0); + Q_t(3 downto 0) := BusA(7 downto 4); + F_Out(Flag_C) <= '0'; + else + Q_t(7 downto 1) := BusA(6 downto 0); + Q_t(0) := '1'; + F_Out(Flag_C) <= BusA(7); + end if; + when "101" => -- SRA + Q_t(6 downto 0) := BusA(7 downto 1); + Q_t(7) := BusA(7); + F_Out(Flag_C) <= BusA(0); + when others => -- SRL + Q_t(6 downto 0) := BusA(7 downto 1); + Q_t(7) := '0'; + F_Out(Flag_C) <= BusA(0); + end case; + F_Out(Flag_H) <= '0'; + F_Out(Flag_N) <= '0'; + F_Out(Flag_X) <= Q_t(3); + F_Out(Flag_Y) <= Q_t(5); + F_Out(Flag_S) <= Q_t(7); + if Q_t(7 downto 0) = "00000000" then + F_Out(Flag_Z) <= '1'; + else + F_Out(Flag_Z) <= '0'; + end if; + F_Out(Flag_P) <= not (Q_t(0) xor Q_t(1) xor Q_t(2) xor Q_t(3) xor + Q_t(4) xor Q_t(5) xor Q_t(6) xor Q_t(7)); + if ISet = "00" then + F_Out(Flag_P) <= F_In(Flag_P); + F_Out(Flag_S) <= F_In(Flag_S); + F_Out(Flag_Z) <= F_In(Flag_Z); + end if; + if Mode = 3 and Rot_Akku = '1' then + F_Out(Flag_Z) <= '0'; + end if; + when others => + null; + end case; + Q <= Q_t; + end process; +end; diff --git a/modules/cpu-t80/T80_MCode.vhd b/modules/cpu-t80/T80_MCode.vhd new file mode 100644 index 0000000..554ec9b --- /dev/null +++ b/modules/cpu-t80/T80_MCode.vhd @@ -0,0 +1,2289 @@ +-------------------------------------------------------------------------------- +-- **** +-- T80(c) core. Attempt to finish all undocumented features and provide +-- accurate timings. +-- Version 350. +-- Copyright (c) 2018 Sorgelig +-- Test passed: ZEXDOC, ZEXALL, Z80Full(*), Z80memptr +-- (*) Currently only SCF and CCF instructions aren't passed X/Y flags check as +-- correct implementation is still unclear. +-- +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- Ver 303 add undocumented DDCB and FDCB opcodes by TobiFlex 20.04.2010 +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- Z80 compatible microprocessor core +-- +-- Version : 0250 +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0208 : First complete release +-- 0211 : Fixed IM 1 +-- 0214 : Fixed mostly flags, only the block instructions now fail the zex regression test +-- 0235 : Added IM 2 fix by Mike Johnson +-- 0238 : Added NoRead signal +-- 0238b: Fixed instruction timing for POP and DJNZ +-- 0240 : Added (IX/IY+d) states, removed op-codes from mode 2 and added all remaining mode 3 op-codes +-- 0240mj1 fix for HL inc/dec for INI, IND, INIR, INDR, OUTI, OUTD, OTIR, OTDR +-- 0242 : Fixed I/O instruction timing, cleanup +-- 0250 : Added R800 Multiplier by TobiFlex 2017.10.15 +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use work.T80_Pack.all; + +entity T80_MCode is + generic( + Mode : integer := 0; + Flag_C : integer := 0; + Flag_N : integer := 1; + Flag_P : integer := 2; + Flag_X : integer := 3; + Flag_H : integer := 4; + Flag_Y : integer := 5; + Flag_Z : integer := 6; + Flag_S : integer := 7 + ); + port( + IR : in std_logic_vector(7 downto 0); + ISet : in std_logic_vector(1 downto 0); + MCycle : in std_logic_vector(2 downto 0); + F : in std_logic_vector(7 downto 0); + NMICycle : in std_logic; + IntCycle : in std_logic; + XY_State : in std_logic_vector(1 downto 0); + MCycles : out std_logic_vector(2 downto 0); + TStates : out std_logic_vector(2 downto 0); + Prefix : out std_logic_vector(1 downto 0); -- None,CB,ED,DD/FD + Inc_PC : out std_logic; + Inc_WZ : out std_logic; + IncDec_16 : out std_logic_vector(3 downto 0); -- BC,DE,HL,SP 0 is inc + Read_To_Reg : out std_logic; + Read_To_Acc : out std_logic; + Set_BusA_To : out std_logic_vector(3 downto 0); -- B,C,D,E,H,L,DI/DB,A,SP(L),SP(M),0,F + Set_BusB_To : out std_logic_vector(3 downto 0); -- B,C,D,E,H,L,DI,A,SP(L),SP(M),1,F,PC(L),PC(M),0 + ALU_Op : out std_logic_vector(3 downto 0); + -- ADD, ADC, SUB, SBC, AND, XOR, OR, CP, ROT, BIT, SET, RES, DAA, RLD, RRD, None + Save_ALU : out std_logic; + Rot_Akku : out std_logic; + PreserveC : out std_logic; + Arith16 : out std_logic; + Set_Addr_To : out std_logic_vector(2 downto 0); -- aNone,aXY,aIOA,aSP,aBC,aDE,aZI + IORQ : out std_logic; + Jump : out std_logic; + JumpE : out std_logic; + JumpXY : out std_logic; + Call : out std_logic; + RstP : out std_logic; + LDZ : out std_logic; + LDW : out std_logic; + LDSPHL : out std_logic; + LDHLSP : out std_logic; + ADDSPdd : out std_logic; + Special_LD : out std_logic_vector(2 downto 0); -- A,I;A,R;I,A;R,A;None + ExchangeDH : out std_logic; + ExchangeRp : out std_logic; + ExchangeAF : out std_logic; + ExchangeRS : out std_logic; + ExchangeWH : out std_logic; + I_DJNZ : out std_logic; + I_CPL : out std_logic; + I_CCF : out std_logic; + I_SCF : out std_logic; + I_RETN : out std_logic; + I_BT : out std_logic; + I_BC : out std_logic; + I_BTR : out std_logic; + I_RLD : out std_logic; + I_RRD : out std_logic; + I_INRC : out std_logic; + I_MULUB : out std_logic; + I_MULU : out std_logic; + SetWZ : out std_logic_vector(1 downto 0); + SetDI : out std_logic; + SetEI : out std_logic; + IMode : out std_logic_vector(1 downto 0); + Halt : out std_logic; + NoRead : out std_logic; + Write : out std_logic; + R800_mode : in std_logic; + No_PC : out std_logic; + XYbit_undoc : out std_logic + ); +end T80_MCode; + +architecture rtl of T80_MCode is + + function is_cc_true( + F : std_logic_vector(7 downto 0); + cc : bit_vector(2 downto 0) + ) return boolean is + begin + if Mode = 3 then + case cc is + when "000" => return F(Flag_Z) = '0'; -- NZ + when "001" => return F(Flag_Z) = '1'; -- Z + when "010" => return F(Flag_C) = '0'; -- NC + when "011" => return F(Flag_C) = '1'; -- C + when "100" => return false; + when "101" => return false; + when "110" => return false; + when "111" => return false; + end case; + else + case cc is + when "000" => return F(Flag_Z) = '0'; -- NZ + when "001" => return F(Flag_Z) = '1'; -- Z + when "010" => return F(Flag_C) = '0'; -- NC + when "011" => return F(Flag_C) = '1'; -- C + when "100" => return F(Flag_P) = '0'; -- PO + when "101" => return F(Flag_P) = '1'; -- PE + when "110" => return F(Flag_S) = '0'; -- P + when "111" => return F(Flag_S) = '1'; -- M + end case; + end if; + end; + +begin + + process (IR, ISet, MCycle, F, NMICycle, IntCycle, XY_State, R800_mode) + variable DDD : std_logic_vector(2 downto 0); + variable SSS : std_logic_vector(2 downto 0); + variable DPair : std_logic_vector(1 downto 0); + variable IRB : bit_vector(7 downto 0); + begin + DDD := IR(5 downto 3); + SSS := IR(2 downto 0); + DPair := IR(5 downto 4); + IRB := to_bitvector(IR); + + MCycles <= "001"; + if MCycle = "001" then + TStates <= "100"; + else + TStates <= "011"; + end if; + Prefix <= "00"; + Inc_PC <= '0'; + Inc_WZ <= '0'; + IncDec_16 <= "0000"; + Read_To_Acc <= '0'; + Read_To_Reg <= '0'; + Set_BusB_To <= "0000"; + Set_BusA_To <= "0000"; + ALU_Op <= "0" & IR(5 downto 3); + Save_ALU <= '0'; + Rot_Akku <= '0'; + PreserveC <= '0'; + Arith16 <= '0'; + IORQ <= '0'; + Set_Addr_To <= aNone; + Jump <= '0'; + JumpE <= '0'; + JumpXY <= '0'; + Call <= '0'; + RstP <= '0'; + LDZ <= '0'; + LDW <= '0'; + LDSPHL <= '0'; + LDHLSP <= '0'; + ADDSPdd <= '0'; + Special_LD <= "000"; + ExchangeDH <= '0'; + ExchangeRp <= '0'; + ExchangeAF <= '0'; + ExchangeRS <= '0'; + ExchangeWH <= '0'; + I_DJNZ <= '0'; + I_CPL <= '0'; + I_CCF <= '0'; + I_SCF <= '0'; + I_RETN <= '0'; + I_BT <= '0'; + I_BC <= '0'; + I_BTR <= '0'; + I_RLD <= '0'; + I_RRD <= '0'; + I_INRC <= '0'; + I_MULUB <= '0'; + I_MULU <= '0'; + SetDI <= '0'; + SetEI <= '0'; + IMode <= "11"; + Halt <= '0'; + NoRead <= '0'; + Write <= '0'; + No_PC <= '0'; + XYbit_undoc <= '0'; + SetWZ <= "00"; + + case ISet is + when "00" => + +------------------------------------------------------------------------------ +-- +-- Unprefixed instructions +-- +------------------------------------------------------------------------------ + + case IRB is +-- 8 BIT LOAD GROUP + when "01000000"|"01000001"|"01000010"|"01000011"|"01000100"|"01000101"|"01000111" + |"01001000"|"01001001"|"01001010"|"01001011"|"01001100"|"01001101"|"01001111" + |"01010000"|"01010001"|"01010010"|"01010011"|"01010100"|"01010101"|"01010111" + |"01011000"|"01011001"|"01011010"|"01011011"|"01011100"|"01011101"|"01011111" + |"01100000"|"01100001"|"01100010"|"01100011"|"01100100"|"01100101"|"01100111" + |"01101000"|"01101001"|"01101010"|"01101011"|"01101100"|"01101101"|"01101111" + |"01111000"|"01111001"|"01111010"|"01111011"|"01111100"|"01111101"|"01111111" => + -- LD r,r' + Set_BusB_To(2 downto 0) <= SSS; + ExchangeRp <= '1'; + Set_BusA_To(2 downto 0) <= DDD; + Read_To_Reg <= '1'; + when "00000110"|"00001110"|"00010110"|"00011110"|"00100110"|"00101110"|"00111110" => + -- LD r,n + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + Set_BusA_To(2 downto 0) <= DDD; + Read_To_Reg <= '1'; + when others => null; + end case; + when "01000110"|"01001110"|"01010110"|"01011110"|"01100110"|"01101110"|"01111110" => + -- LD r,(HL) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + Set_BusA_To(2 downto 0) <= DDD; + Read_To_Reg <= '1'; + when others => null; + end case; + when "01110000"|"01110001"|"01110010"|"01110011"|"01110100"|"01110101"|"01110111" => + -- LD (HL),r + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + Set_BusB_To(2 downto 0) <= SSS; + Set_BusB_To(3) <= '0'; + when 2 => + Write <= '1'; + when others => null; + end case; + when "00110110" => + -- LD (HL),n + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + Set_Addr_To <= aXY; + Set_BusB_To(2 downto 0) <= SSS; + Set_BusB_To(3) <= '0'; + when 3 => + Write <= '1'; + when others => null; + end case; + when "00001010" => + -- LD A,(BC) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aBC; + when 2 => + Read_To_Acc <= '1'; + when others => null; + end case; + when "00011010" => + -- LD A,(DE) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aDE; + when 2 => + Read_To_Acc <= '1'; + when others => null; + end case; + when "00111010" => + if Mode = 3 then + -- LDD A,(HL) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + Read_To_Acc <= '1'; + IncDec_16 <= "1110"; + when others => null; + end case; + else + -- LD A,(nn) + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + when 4 => + Read_To_Acc <= '1'; + when others => null; + end case; + end if; + when "00000010" => + -- LD (BC),A + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aBC; + Set_BusB_To <= "0111"; + SetWZ <= "10"; + when 2 => + Write <= '1'; + when others => null; + end case; + when "00010010" => + -- LD (DE),A + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aDE; + Set_BusB_To <= "0111"; + SetWZ <= "10"; + when 2 => + Write <= '1'; + when others => null; + end case; + when "00110010" => + if Mode = 3 then + -- LDD (HL),A + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + Set_BusB_To <= "0111"; + when 2 => + Write <= '1'; + IncDec_16 <= "1110"; + when others => null; + end case; + else + -- LD (nn),A + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + SetWZ <= "10"; + Inc_PC <= '1'; + Set_BusB_To <= "0111"; + when 4 => + Write <= '1'; + when others => null; + end case; + end if; + +-- 16 BIT LOAD GROUP + when "00000001"|"00010001"|"00100001"|"00110001" => + -- LD dd,nn + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + Read_To_Reg <= '1'; + if DPAIR = "11" then + Set_BusA_To(3 downto 0) <= "1000"; + else + Set_BusA_To(2 downto 1) <= DPAIR; + Set_BusA_To(0) <= '1'; + end if; + when 3 => + Inc_PC <= '1'; + Read_To_Reg <= '1'; + if DPAIR = "11" then + Set_BusA_To(3 downto 0) <= "1001"; + else + Set_BusA_To(2 downto 1) <= DPAIR; + Set_BusA_To(0) <= '0'; + end if; + when others => null; + end case; + when "00101010" => + if Mode = 3 then + -- LDI A,(HL) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + Read_To_Acc <= '1'; + IncDec_16 <= "0110"; + when others => null; + end case; + else + -- LD HL,(nn) + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + LDW <= '1'; + when 4 => + Set_BusA_To(2 downto 0) <= "101"; -- L + Read_To_Reg <= '1'; + Inc_WZ <= '1'; + Set_Addr_To <= aZI; + when 5 => + Set_BusA_To(2 downto 0) <= "100"; -- H + Read_To_Reg <= '1'; + when others => null; + end case; + end if; + when "00100010" => + if Mode = 3 then + -- LDI (HL),A + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + Set_BusB_To <= "0111"; + when 2 => + Write <= '1'; + IncDec_16 <= "0110"; + when others => null; + end case; + else + -- LD (nn),HL + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + LDW <= '1'; + Set_BusB_To <= "0101"; -- L + when 4 => + Inc_WZ <= '1'; + Set_Addr_To <= aZI; + Write <= '1'; + Set_BusB_To <= "0100"; -- H + when 5 => + Write <= '1'; + when others => null; + end case; + end if; + when "11111001" => + -- LD SP,HL + if Mode = 3 then + MCycles <= "010"; + if MCycle = "010" then + LDSPHL <= '1'; + end if; + else + TStates <= "110"; + LDSPHL <= '1'; + end if; + when "11000101"|"11010101"|"11100101"|"11110101" => + -- PUSH qq + if Mode = 3 then + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 2 => + TStates <= "101"; + IncDec_16 <= "1111"; + Set_Addr_TO <= aSP; + if DPAIR = "11" then + Set_BusB_To <= "0111"; + else + Set_BusB_To(2 downto 1) <= DPAIR; + Set_BusB_To(0) <= '0'; + Set_BusB_To(3) <= '0'; + end if; + when 3 => + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + if DPAIR = "11" then + Set_BusB_To <= "1011"; + else + Set_BusB_To(2 downto 1) <= DPAIR; + Set_BusB_To(0) <= '1'; + Set_BusB_To(3) <= '0'; + end if; + Write <= '1'; + when 4 => + Write <= '1'; + when others => null; + end case; + else + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "101"; + IncDec_16 <= "1111"; + Set_Addr_TO <= aSP; + if DPAIR = "11" then + Set_BusB_To <= "0111"; + else + Set_BusB_To(2 downto 1) <= DPAIR; + Set_BusB_To(0) <= '0'; + Set_BusB_To(3) <= '0'; + end if; + when 2 => + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + if DPAIR = "11" then + Set_BusB_To <= "1011"; + else + Set_BusB_To(2 downto 1) <= DPAIR; + Set_BusB_To(0) <= '1'; + Set_BusB_To(3) <= '0'; + end if; + Write <= '1'; + when 3 => + Write <= '1'; + when others => null; + end case; + end if; + when "11000001"|"11010001"|"11100001"|"11110001" => + -- POP qq + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aSP; + when 2 => + IncDec_16 <= "0111"; + Set_Addr_To <= aSP; + Read_To_Reg <= '1'; + if DPAIR = "11" then + Set_BusA_To(3 downto 0) <= "1011"; + else + Set_BusA_To(2 downto 1) <= DPAIR; + Set_BusA_To(0) <= '1'; + end if; + when 3 => + IncDec_16 <= "0111"; + Read_To_Reg <= '1'; + if DPAIR = "11" then + Set_BusA_To(3 downto 0) <= "0111"; + else + Set_BusA_To(2 downto 1) <= DPAIR; + Set_BusA_To(0) <= '0'; + end if; + when others => null; + end case; + +-- EXCHANGE, BLOCK TRANSFER AND SEARCH GROUP + when "11101011" => + if Mode /= 3 then + -- EX DE,HL + ExchangeDH <= '1'; + end if; + when "00001000" => + if Mode = 3 then + -- LD (nn),SP + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + LDW <= '1'; + Set_BusB_To <= "1000"; + when 4 => + Inc_WZ <= '1'; + Set_Addr_To <= aZI; + Write <= '1'; + Set_BusB_To <= "1001"; + when 5 => + Write <= '1'; + when others => null; + end case; + elsif Mode < 2 then + -- EX AF,AF' + ExchangeAF <= '1'; + end if; + when "11011001" => + if Mode = 3 then + -- RETI + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_TO <= aSP; + when 2 => + IncDec_16 <= "0111"; + Set_Addr_To <= aSP; + LDZ <= '1'; + when 3 => + Jump <= '1'; + IncDec_16 <= "0111"; + --I_RETN <= '1'; + SetEI <= '1'; + when others => null; + end case; + elsif Mode < 2 then + -- EXX + ExchangeRS <= '1'; + end if; + when "11100011" => + if Mode /= 3 then + -- EX (SP),HL + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aSP; + when 2 => + Set_Addr_To <= aSP; + LDZ <= '1'; + IncDec_16 <= "0111"; -- SP <= SP+1 + when 3 => + TStates <= "100"; + Set_BusB_To <= "0100"; + Set_Addr_To <= aSP; + LDW <= '1'; + when 4 => + Set_BusB_To <= "0101"; + Write <= '1'; + IncDec_16 <= "1111"; -- SP <= SP-1 + Set_Addr_To <= aSP; + when 5 => + ExchangeWH <= '1'; -- save WZ to HL + TStates <= "101"; + Write <= '1'; + when others => null; + end case; + end if; + +-- 8 BIT ARITHMETIC AND LOGICAL GROUP + when "10000000"|"10000001"|"10000010"|"10000011"|"10000100"|"10000101"|"10000111" + |"10001000"|"10001001"|"10001010"|"10001011"|"10001100"|"10001101"|"10001111" + |"10010000"|"10010001"|"10010010"|"10010011"|"10010100"|"10010101"|"10010111" + |"10011000"|"10011001"|"10011010"|"10011011"|"10011100"|"10011101"|"10011111" + |"10100000"|"10100001"|"10100010"|"10100011"|"10100100"|"10100101"|"10100111" + |"10101000"|"10101001"|"10101010"|"10101011"|"10101100"|"10101101"|"10101111" + |"10110000"|"10110001"|"10110010"|"10110011"|"10110100"|"10110101"|"10110111" + |"10111000"|"10111001"|"10111010"|"10111011"|"10111100"|"10111101"|"10111111" => + -- ADD A,r + -- ADC A,r + -- SUB A,r + -- SBC A,r + -- AND A,r + -- OR A,r + -- XOR A,r + -- CP A,r + Set_BusB_To(2 downto 0) <= SSS; + Set_BusA_To(2 downto 0) <= "111"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + when "10000110"|"10001110"|"10010110"|"10011110"|"10100110"|"10101110"|"10110110"|"10111110" => + -- ADD A,(HL) + -- ADC A,(HL) + -- SUB A,(HL) + -- SBC A,(HL) + -- AND A,(HL) + -- OR A,(HL) + -- XOR A,(HL) + -- CP A,(HL) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_BusB_To(2 downto 0) <= SSS; + Set_BusA_To(2 downto 0) <= "111"; + when others => null; + end case; + when "11000110"|"11001110"|"11010110"|"11011110"|"11100110"|"11101110"|"11110110"|"11111110" => + -- ADD A,n + -- ADC A,n + -- SUB A,n + -- SBC A,n + -- AND A,n + -- OR A,n + -- XOR A,n + -- CP A,n + MCycles <= "010"; + if MCycle = "010" then + Inc_PC <= '1'; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_BusB_To(2 downto 0) <= SSS; + Set_BusA_To(2 downto 0) <= "111"; + end if; + when "00000100"|"00001100"|"00010100"|"00011100"|"00100100"|"00101100"|"00111100" => + -- INC r + Set_BusB_To <= "1010"; + Set_BusA_To(2 downto 0) <= DDD; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + PreserveC <= '1'; + ALU_Op <= "0000"; + when "00110100" => + -- INC (HL) + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + TStates <= "100"; + Set_Addr_To <= aXY; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + PreserveC <= '1'; + ALU_Op <= "0000"; + Set_BusB_To <= "1010"; + Set_BusA_To(2 downto 0) <= DDD; + when 3 => + Write <= '1'; + when others => null; + end case; + when "00000101"|"00001101"|"00010101"|"00011101"|"00100101"|"00101101"|"00111101" => + -- DEC r + Set_BusB_To <= "1010"; + Set_BusA_To(2 downto 0) <= DDD; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + PreserveC <= '1'; + ALU_Op <= "0010"; + when "00110101" => + -- DEC (HL) + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + TStates <= "100"; + Set_Addr_To <= aXY; + ALU_Op <= "0010"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + PreserveC <= '1'; + Set_BusB_To <= "1010"; + Set_BusA_To(2 downto 0) <= DDD; + when 3 => + Write <= '1'; + when others => null; + end case; + +-- GENERAL PURPOSE ARITHMETIC AND CPU CONTROL GROUPS + when "00100111" => + -- DAA + Set_BusA_To(2 downto 0) <= "111"; + Read_To_Reg <= '1'; + ALU_Op <= "1100"; + Save_ALU <= '1'; + when "00101111" => + -- CPL + I_CPL <= '1'; + when "00111111" => + -- CCF + I_CCF <= '1'; + when "00110111" => + -- SCF + I_SCF <= '1'; + when "00000000" => + if NMICycle = '1' then + -- NMI + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "101"; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1101"; + when 2 => + Write <= '1'; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1100"; + when 3 => + Write <= '1'; + when others => null; + end case; + elsif IntCycle = '1' then + -- INT (IM 2) + if Mode = 3 then + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "110"; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1101"; + when 2 => + Write <= '1'; + when 3 => -- GB: interrupt is acknowledged on MCycle 3 + LDZ <= '1'; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1100"; + when 4 => + Write <= '1'; + when others => null; + end case; + else + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "101"; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1101"; + when 2 => + --TStates <= "100"; + Write <= '1'; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1100"; + when 3 => + --TStates <= "100"; + Write <= '1'; + when 4 => + Inc_PC <= '1'; + LDZ <= '1'; + when 5 => + Jump <= '1'; + when others => null; + end case; + end if; + else + -- NOP + end if; + when "01110110" => + -- HALT + Halt <= '1'; + when "11110011" => + -- DI + SetDI <= '1'; + when "11111011" => + -- EI + SetEI <= '1'; + +-- 16 BIT ARITHMETIC GROUP + when "00001001"|"00011001"|"00101001"|"00111001" => + -- ADD HL,ss + if Mode = 3 then + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + NoRead <= '1'; + ALU_Op <= "0000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_BusA_To(2 downto 0) <= "101"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + Set_BusB_To(0) <= '1'; + when others => + Set_BusB_To <= "1000"; + end case; + TStates <= "100"; + Arith16 <= '1'; + SetWZ <= "11"; + when 2 => + NoRead <= '1'; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + ALU_Op <= "0001"; + Set_BusA_To(2 downto 0) <= "100"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + when others => + Set_BusB_To <= "1001"; + end case; + Arith16 <= '1'; + when others => + end case; + else + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + No_PC <= '1'; + when 2 => + NoRead <= '1'; + ALU_Op <= "0000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_BusA_To(2 downto 0) <= "101"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + Set_BusB_To(0) <= '1'; + when others => + Set_BusB_To <= "1000"; + end case; + TStates <= "100"; + Arith16 <= '1'; + SetWZ <= "11"; + No_PC <= '1'; + when 3 => + NoRead <= '1'; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + ALU_Op <= "0001"; + Set_BusA_To(2 downto 0) <= "100"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + when others => + Set_BusB_To <= "1001"; + end case; + Arith16 <= '1'; + when others => + end case; + end if; + when "00000011"|"00010011"|"00100011"|"00110011" => + -- INC ss + if Mode = 3 then + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 2 => + IncDec_16(3 downto 2) <= "01"; + IncDec_16(1 downto 0) <= DPair; + when others => + end case; + else + TStates <= "110"; + IncDec_16(3 downto 2) <= "01"; + IncDec_16(1 downto 0) <= DPair; + end if; + when "00001011"|"00011011"|"00101011"|"00111011" => + -- DEC ss + if Mode = 3 then + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 2 => + IncDec_16(3 downto 2) <= "11"; + IncDec_16(1 downto 0) <= DPair; + when others => + end case; + else + TStates <= "110"; + IncDec_16(3 downto 2) <= "11"; + IncDec_16(1 downto 0) <= DPair; + end if; + +-- ROTATE AND SHIFT GROUP + when "00000111" + -- RLCA + |"00010111" + -- RLA + |"00001111" + -- RRCA + |"00011111" => + -- RRA + Set_BusA_To(2 downto 0) <= "111"; + ALU_Op <= "1000"; + Read_To_Reg <= '1'; + Rot_Akku <= '1'; + Save_ALU <= '1'; + +-- JUMP GROUP + when "11000011" => + -- JP nn + if Mode = 3 then + MCycles <= "100"; + else + MCycles <= "011"; + end if; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Inc_PC <= '1'; + Jump <= '1'; + if Mode /= 3 then + LDW <= '1'; + end if; + when others => null; + end case; + when "11000010"|"11001010"|"11010010"|"11011010"|"11100010"|"11101010"|"11110010"|"11111010" => + if IR(5) = '1' and Mode = 3 then + case IRB(4 downto 3) is + when "00" => + -- LD ($FF00+C),A + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aBC; + Set_BusB_To <= "0111"; + IORQ <= '1'; --TH must be earlier to be stable when address is generated + when 2 => + Write <= '1'; + when others => + end case; + when "01" => + -- LD (nn),A + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + Set_BusB_To <= "0111"; + when 4 => + Write <= '1'; + when others => null; + end case; + when "10" => + -- LD A,($FF00+C) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aBC; + IORQ <= '1'; --TH must be earlier to be stable when address is generated + when 2 => + Read_To_Acc <= '1'; + when others => + end case; + when "11" => + -- LD A,(nn) + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + when 4 => + Read_To_Acc <= '1'; + when others => null; + end case; + end case; + else + -- JP cc,nn + if Mode = 3 then + MCycles <= "100"; + else + MCycles <= "011"; + end if; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + if Mode /= 3 then + LDW <= '1'; + end if; + Inc_PC <= '1'; + if is_cc_true(F, to_bitvector(IR(5 downto 3))) then + Jump <= '1'; + elsif Mode = 3 then + MCycles <= "011"; + end if; + when others => null; + end case; + end if; + when "00011000" => + if Mode /= 2 then + -- JR e + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + No_PC <= '1'; + when 3 => + NoRead <= '1'; + JumpE <= '1'; + TStates <= "101"; + when others => null; + end case; + end if; + when "00111000" => + if Mode /= 2 then + -- JR C,e + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + if F(Flag_C) = '0' then + MCycles <= "010"; + else + No_PC <= '1'; + end if; + when 3 => + NoRead <= '1'; + JumpE <= '1'; + TStates <= "101"; + when others => null; + end case; + end if; + when "00110000" => + if Mode /= 2 then + -- JR NC,e + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + if F(Flag_C) = '1' then + MCycles <= "010"; + else + No_PC <= '1'; + end if; + when 3 => + NoRead <= '1'; + JumpE <= '1'; + TStates <= "101"; + when others => null; + end case; + end if; + when "00101000" => + if Mode /= 2 then + -- JR Z,e + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + if F(Flag_Z) = '0' then + MCycles <= "010"; + else + No_PC <= '1'; + end if; + when 3 => + NoRead <= '1'; + JumpE <= '1'; + TStates <= "101"; + when others => null; + end case; + end if; + when "00100000" => + if Mode /= 2 then + -- JR NZ,e + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + if F(Flag_Z) = '1' then + MCycles <= "010"; + else + No_PC <= '1'; + end if; + when 3 => + NoRead <= '1'; + JumpE <= '1'; + TStates <= "101"; + when others => null; + end case; + end if; + when "11101001" => + -- JP (HL) + JumpXY <= '1'; + when "00010000" => + if Mode = 3 then -- STOP and skip next byte + MCycles <= "010"; + I_DJNZ <= '1'; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + when others => null; + end case; + elsif Mode < 2 then + -- DJNZ,e + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "101"; + I_DJNZ <= '1'; + Set_BusB_To <= "1010"; + Set_BusA_To(2 downto 0) <= "000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + ALU_Op <= "0010"; + when 2 => + I_DJNZ <= '1'; + Inc_PC <= '1'; + No_PC <= '1'; + when 3 => + NoRead <= '1'; + JumpE <= '1'; + TStates <= "101"; + when others => null; + end case; + end if; + +-- CALL AND RETURN GROUP + when "11001101" => + -- CALL nn + if Mode = 3 then + MCycles <= "110"; + else + MCycles <= "101"; + end if; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + IncDec_16 <= "1111"; + Inc_PC <= '1'; + TStates <= "100"; + Set_Addr_To <= aSP; + LDW <= '1'; + Set_BusB_To <= "1101"; + when 4 => + Write <= '1'; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1100"; + when 5 => + Write <= '1'; + Call <= '1'; + when others => null; + end case; + when "11000100"|"11001100"|"11010100"|"11011100"|"11100100"|"11101100"|"11110100"|"11111100" => + if IR(5) = '0' or Mode /= 3 then + -- CALL cc,nn + if Mode = 3 then + MCycles <= "110"; + else + MCycles <= "101"; + end if; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Inc_PC <= '1'; + LDW <= '1'; + if is_cc_true(F, to_bitvector(IR(5 downto 3))) then + IncDec_16 <= "1111"; + Set_Addr_TO <= aSP; + TStates <= "100"; + Set_BusB_To <= "1101"; + else + MCycles <= "011"; + end if; + when 4 => + Write <= '1'; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1100"; + when 5 => + Write <= '1'; + Call <= '1'; + when others => null; + end case; + end if; + when "11001001" => + -- RET + if Mode = 3 then + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 2 => + Set_Addr_TO <= aSP; + when 3 => + IncDec_16 <= "0111"; + Set_Addr_To <= aSP; + LDZ <= '1'; + when 4 => + Jump <= '1'; + IncDec_16 <= "0111"; + when others => null; + end case; + else + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + --TStates <= "101"; + Set_Addr_TO <= aSP; + when 2 => + IncDec_16 <= "0111"; + Set_Addr_To <= aSP; + LDZ <= '1'; + when 3 => + Jump <= '1'; + IncDec_16 <= "0111"; + when others => null; + end case; + end if; + when "11000000"|"11001000"|"11010000"|"11011000"|"11100000"|"11101000"|"11110000"|"11111000" => + if IR(5) = '1' and Mode = 3 then + case IRB(4 downto 3) is + when "00" => + -- LD ($FF00+nn),A + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + Set_Addr_To <= aIOA; + Set_BusB_To <= "0111"; + when 3 => + Write <= '1'; + when others => null; + end case; + when "01" => + -- ADD SP,n + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 3 => + Inc_PC <= '1'; + ADDSPdd <= '1'; + when others => + end case; + when "10" => + -- LD A,($FF00+nn) + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + Set_Addr_To <= aIOA; + when 3 => + Read_To_Acc <= '1'; + when others => null; + end case; + when "11" => + -- LD HL,SP+n + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + Inc_PC <= '1'; + when 2 => + LDHLSP <= '1'; + Inc_PC <= '1'; + when 3 => + LDHLSP <= '1'; + when others => null; + end case; + end case; + else + -- RET cc + if Mode = 3 then + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 2 => + if is_cc_true(F, to_bitvector(IR(5 downto 3))) then + Set_Addr_TO <= aSP; + else + MCycles <= "010"; + end if; + TStates <= "101"; + when 3 => + IncDec_16 <= "0111"; + Set_Addr_To <= aSP; + LDZ <= '1'; + when 4 => + Jump <= '1'; + IncDec_16 <= "0111"; + when others => null; + end case; + else + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + if is_cc_true(F, to_bitvector(IR(5 downto 3))) then + Set_Addr_TO <= aSP; + else + MCycles <= "001"; + end if; + TStates <= "101"; + when 2 => + IncDec_16 <= "0111"; + Set_Addr_To <= aSP; + LDZ <= '1'; + when 3 => + Jump <= '1'; + IncDec_16 <= "0111"; + when others => null; + end case; + end if; + end if; + when "11000111"|"11001111"|"11010111"|"11011111"|"11100111"|"11101111"|"11110111"|"11111111" => + -- RST p + if Mode = 3 then + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 2 => + TStates <= "101"; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1101"; + when 3 => + Write <= '1'; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1100"; + when 4 => + Write <= '1'; + RstP <= '1'; + when others => null; + end case; + else + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "101"; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1101"; + when 2 => + Write <= '1'; + IncDec_16 <= "1111"; + Set_Addr_To <= aSP; + Set_BusB_To <= "1100"; + when 3 => + Write <= '1'; + RstP <= '1'; + when others => null; + end case; + end if; + +-- INPUT AND OUTPUT GROUP + when "11011011" => + if Mode /= 3 then + -- IN A,(n) + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + Set_Addr_To <= aIOA; + when 3 => + Read_To_Acc <= '1'; + IORQ <= '1'; + when others => null; + end case; + end if; + when "11010011" => + if Mode /= 3 then + -- OUT (n),A + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + Set_Addr_To <= aIOA; + Set_BusB_To <= "0111"; + when 3 => + Write <= '1'; + IORQ <= '1'; + when others => null; + end case; + end if; + +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ +-- MULTIBYTE INSTRUCTIONS +------------------------------------------------------------------------------ +------------------------------------------------------------------------------ + + when "11001011" => + if Mode /= 2 then + Prefix <= "01"; + end if; + + when "11101101" => + if Mode < 2 then + Prefix <= "10"; + end if; + + when "11011101"|"11111101" => + if Mode < 2 then + Prefix <= "11"; + end if; + + end case; + + when "01" => + +------------------------------------------------------------------------------ +-- +-- CB prefixed instructions +-- +------------------------------------------------------------------------------ + + Set_BusA_To(2 downto 0) <= IR(2 downto 0); + Set_BusB_To(2 downto 0) <= IR(2 downto 0); + + case IRB is + when "00000000"|"00000001"|"00000010"|"00000011"|"00000100"|"00000101"|"00000111" + |"00010000"|"00010001"|"00010010"|"00010011"|"00010100"|"00010101"|"00010111" + |"00001000"|"00001001"|"00001010"|"00001011"|"00001100"|"00001101"|"00001111" + |"00011000"|"00011001"|"00011010"|"00011011"|"00011100"|"00011101"|"00011111" + |"00100000"|"00100001"|"00100010"|"00100011"|"00100100"|"00100101"|"00100111" + |"00101000"|"00101001"|"00101010"|"00101011"|"00101100"|"00101101"|"00101111" + |"00110000"|"00110001"|"00110010"|"00110011"|"00110100"|"00110101"|"00110111" + |"00111000"|"00111001"|"00111010"|"00111011"|"00111100"|"00111101"|"00111111" => + -- RLC r + -- RL r + -- RRC r + -- RR r + -- SLA r + -- SRA r + -- SRL r + -- SLL r (Undocumented) / SWAP r + if XY_State="00" then + if MCycle = "001" then + ALU_Op <= "1000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + end if; + else + -- R/S (IX+d),Reg, undocumented + MCycles <= "011"; + XYbit_undoc <= '1'; + case to_integer(unsigned(MCycle)) is + when 1 | 7=> + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_Addr_To <= aXY; + TStates <= "100"; + when 3 => + Write <= '1'; + when others => null; + end case; + end if; + + when "00000110"|"00010110"|"00001110"|"00011110"|"00101110"|"00111110"|"00100110"|"00110110" => + -- RLC (HL) + -- RL (HL) + -- RRC (HL) + -- RR (HL) + -- SRA (HL) + -- SRL (HL) + -- SLA (HL) + -- SLL (HL) (Undocumented) / SWAP (HL) + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 | 7 => + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_Addr_To <= aXY; + TStates <= "100"; + when 3 => + Write <= '1'; + when others => + end case; + when "01000000"|"01000001"|"01000010"|"01000011"|"01000100"|"01000101"|"01000111" + |"01001000"|"01001001"|"01001010"|"01001011"|"01001100"|"01001101"|"01001111" + |"01010000"|"01010001"|"01010010"|"01010011"|"01010100"|"01010101"|"01010111" + |"01011000"|"01011001"|"01011010"|"01011011"|"01011100"|"01011101"|"01011111" + |"01100000"|"01100001"|"01100010"|"01100011"|"01100100"|"01100101"|"01100111" + |"01101000"|"01101001"|"01101010"|"01101011"|"01101100"|"01101101"|"01101111" + |"01110000"|"01110001"|"01110010"|"01110011"|"01110100"|"01110101"|"01110111" + |"01111000"|"01111001"|"01111010"|"01111011"|"01111100"|"01111101"|"01111111" => + -- BIT b,r + if XY_State="00" then + if MCycle = "001" then + Set_BusB_To(2 downto 0) <= IR(2 downto 0); + ALU_Op <= "1001"; + end if; + else + -- BIT b,(IX+d), undocumented + MCycles <= "010"; + XYbit_undoc <= '1'; + case to_integer(unsigned(MCycle)) is + when 1 | 7=> + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1001"; + TStates <= "100"; + when others => null; + end case; + end if; + + when "01000110"|"01001110"|"01010110"|"01011110"|"01100110"|"01101110"|"01110110"|"01111110" => + -- BIT b,(HL) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 | 7 => + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1001"; + TStates <= "100"; + when others => null; + end case; + when "11000000"|"11000001"|"11000010"|"11000011"|"11000100"|"11000101"|"11000111" + |"11001000"|"11001001"|"11001010"|"11001011"|"11001100"|"11001101"|"11001111" + |"11010000"|"11010001"|"11010010"|"11010011"|"11010100"|"11010101"|"11010111" + |"11011000"|"11011001"|"11011010"|"11011011"|"11011100"|"11011101"|"11011111" + |"11100000"|"11100001"|"11100010"|"11100011"|"11100100"|"11100101"|"11100111" + |"11101000"|"11101001"|"11101010"|"11101011"|"11101100"|"11101101"|"11101111" + |"11110000"|"11110001"|"11110010"|"11110011"|"11110100"|"11110101"|"11110111" + |"11111000"|"11111001"|"11111010"|"11111011"|"11111100"|"11111101"|"11111111" => + -- SET b,r + if XY_State="00" then + if MCycle = "001" then + ALU_Op <= "1010"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + end if; + else + -- SET b,(IX+d),Reg, undocumented + MCycles <= "011"; + XYbit_undoc <= '1'; + case to_integer(unsigned(MCycle)) is + when 1 | 7=> + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1010"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_Addr_To <= aXY; + TStates <= "100"; + when 3 => + Write <= '1'; + when others => null; + end case; + end if; + + when "11000110"|"11001110"|"11010110"|"11011110"|"11100110"|"11101110"|"11110110"|"11111110" => + -- SET b,(HL) + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 | 7 => + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1010"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_Addr_To <= aXY; + TStates <= "100"; + when 3 => + Write <= '1'; + when others => null; + end case; + when "10000000"|"10000001"|"10000010"|"10000011"|"10000100"|"10000101"|"10000111" + |"10001000"|"10001001"|"10001010"|"10001011"|"10001100"|"10001101"|"10001111" + |"10010000"|"10010001"|"10010010"|"10010011"|"10010100"|"10010101"|"10010111" + |"10011000"|"10011001"|"10011010"|"10011011"|"10011100"|"10011101"|"10011111" + |"10100000"|"10100001"|"10100010"|"10100011"|"10100100"|"10100101"|"10100111" + |"10101000"|"10101001"|"10101010"|"10101011"|"10101100"|"10101101"|"10101111" + |"10110000"|"10110001"|"10110010"|"10110011"|"10110100"|"10110101"|"10110111" + |"10111000"|"10111001"|"10111010"|"10111011"|"10111100"|"10111101"|"10111111" => + -- RES b,r + if XY_State="00" then + if MCycle = "001" then + ALU_Op <= "1011"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + end if; + else + -- RES b,(IX+d),Reg, undocumented + MCycles <= "011"; + XYbit_undoc <= '1'; + case to_integer(unsigned(MCycle)) is + when 1 | 7=> + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1011"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_Addr_To <= aXY; + TStates <= "100"; + when 3 => + Write <= '1'; + when others => null; + end case; + end if; + + when "10000110"|"10001110"|"10010110"|"10011110"|"10100110"|"10101110"|"10110110"|"10111110" => + -- RES b,(HL) + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 | 7 => + Set_Addr_To <= aXY; + when 2 => + ALU_Op <= "1011"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_Addr_To <= aXY; + TStates <= "100"; + when 3 => + Write <= '1'; + when others => null; + end case; + end case; + + when others => + +------------------------------------------------------------------------------ +-- +-- ED prefixed instructions +-- +------------------------------------------------------------------------------ + + case IRB is + when "00000000"|"00000001"|"00000010"|"00000011"|"00000100"|"00000101"|"00000110"|"00000111" + |"00001000"|"00001001"|"00001010"|"00001011"|"00001100"|"00001101"|"00001110"|"00001111" + |"00010000"|"00010001"|"00010010"|"00010011"|"00010100"|"00010101"|"00010110"|"00010111" + |"00011000"|"00011001"|"00011010"|"00011011"|"00011100"|"00011101"|"00011110"|"00011111" + |"00100000"|"00100001"|"00100010"|"00100011"|"00100100"|"00100101"|"00100110"|"00100111" + |"00101000"|"00101001"|"00101010"|"00101011"|"00101100"|"00101101"|"00101110"|"00101111" + |"00110000"|"00110001"|"00110010"|"00110011"|"00110100"|"00110101"|"00110110"|"00110111" + |"00111000"|"00111001"|"00111010"|"00111011"|"00111100"|"00111101"|"00111110"|"00111111" + + + |"10000000"|"10000001"|"10000010"|"10000011"|"10000100"|"10000101"|"10000110"|"10000111" + |"10001000"|"10001001"|"10001010"|"10001011"|"10001100"|"10001101"|"10001110"|"10001111" + |"10010000"|"10010001"|"10010010"|"10010011"|"10010100"|"10010101"|"10010110"|"10010111" + |"10011000"|"10011001"|"10011010"|"10011011"|"10011100"|"10011101"|"10011110"|"10011111" + | "10100100"|"10100101"|"10100110"|"10100111" + | "10101100"|"10101101"|"10101110"|"10101111" + | "10110100"|"10110101"|"10110110"|"10110111" + | "10111100"|"10111101"|"10111110"|"10111111" + |"11000000"| "11000010" |"11000100"|"11000101"|"11000110"|"11000111" + |"11001000"| "11001010"|"11001011"|"11001100"|"11001101"|"11001110"|"11001111" + |"11010000"| "11010010"|"11010011"|"11010100"|"11010101"|"11010110"|"11010111" + |"11011000"| "11011010"|"11011011"|"11011100"|"11011101"|"11011110"|"11011111" + |"11100000"|"11100001"|"11100010"|"11100011"|"11100100"|"11100101"|"11100110"|"11100111" + |"11101000"|"11101001"|"11101010"|"11101011"|"11101100"|"11101101"|"11101110"|"11101111" + |"11110000"|"11110001"|"11110010" |"11110100"|"11110101"|"11110110"|"11110111" + |"11111000"|"11111001"|"11111010"|"11111011"|"11111100"|"11111101"|"11111110"|"11111111" => + null; -- NOP, undocumented + when "01110111"|"01111111" => + -- NOP, undocumented + null; +-- 8 BIT LOAD GROUP + when "01010111" => + -- LD A,I + Special_LD <= "100"; + TStates <= "101"; + when "01011111" => + -- LD A,R + Special_LD <= "101"; + TStates <= "101"; + when "01000111" => + -- LD I,A + Special_LD <= "110"; + TStates <= "101"; + when "01001111" => + -- LD R,A + Special_LD <= "111"; + TStates <= "101"; +-- 16 BIT LOAD GROUP + when "01001011"|"01011011"|"01101011"|"01111011" => + -- LD dd,(nn) + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + LDW <= '1'; + when 4 => + Read_To_Reg <= '1'; + if IR(5 downto 4) = "11" then + Set_BusA_To <= "1000"; + else + Set_BusA_To(2 downto 1) <= IR(5 downto 4); + Set_BusA_To(0) <= '1'; + end if; + Inc_WZ <= '1'; + Set_Addr_To <= aZI; + when 5 => + Read_To_Reg <= '1'; + if IR(5 downto 4) = "11" then + Set_BusA_To <= "1001"; + else + Set_BusA_To(2 downto 1) <= IR(5 downto 4); + Set_BusA_To(0) <= '0'; + end if; + when others => null; + end case; + when "01000011"|"01010011"|"01100011"|"01110011" => + -- LD (nn),dd + MCycles <= "101"; + case to_integer(unsigned(MCycle)) is + when 2 => + Inc_PC <= '1'; + LDZ <= '1'; + when 3 => + Set_Addr_To <= aZI; + Inc_PC <= '1'; + LDW <= '1'; + if IR(5 downto 4) = "11" then + Set_BusB_To <= "1000"; + else + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + Set_BusB_To(0) <= '1'; + Set_BusB_To(3) <= '0'; + end if; + when 4 => + Inc_WZ <= '1'; + Set_Addr_To <= aZI; + Write <= '1'; + if IR(5 downto 4) = "11" then + Set_BusB_To <= "1001"; + else + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + Set_BusB_To(0) <= '0'; + Set_BusB_To(3) <= '0'; + end if; + when 5 => + Write <= '1'; + when others => null; + end case; + when "10100000" | "10101000" | "10110000" | "10111000" => + -- LDI, LDD, LDIR, LDDR + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + IncDec_16 <= "1100"; -- BC + when 2 => + Set_BusB_To <= "0110"; + Set_BusA_To(2 downto 0) <= "111"; + ALU_Op <= "0000"; + Set_Addr_To <= aDE; + if IR(3) = '0' then + IncDec_16 <= "0110"; -- IX + else + IncDec_16 <= "1110"; + end if; + when 3 => + I_BT <= '1'; + TStates <= "101"; + Write <= '1'; + if IR(3) = '0' then + IncDec_16 <= "0101"; -- DE + else + IncDec_16 <= "1101"; + end if; + No_PC <= '1'; + when 4 => + NoRead <= '1'; + TStates <= "101"; + when others => null; + end case; + when "10100001" | "10101001" | "10110001" | "10111001" => + -- CPI, CPD, CPIR, CPDR + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + IncDec_16 <= "1100"; -- BC + when 2 => + Set_BusB_To <= "0110"; + Set_BusA_To(2 downto 0) <= "111"; + ALU_Op <= "0111"; + Save_ALU <= '1'; + PreserveC <= '1'; + if IR(3) = '0' then + IncDec_16 <= "0110"; + else + IncDec_16 <= "1110"; + end if; + No_PC <= '1'; + when 3 => + NoRead <= '1'; + I_BC <= '1'; + TStates <= "101"; + No_PC <= '1'; + when 4 => + NoRead <= '1'; + TStates <= "101"; + when others => null; + end case; + when "01000100"|"01001100"|"01010100"|"01011100"|"01100100"|"01101100"|"01110100"|"01111100" => + -- NEG + Alu_OP <= "0010"; + Set_BusB_To <= "0111"; + Set_BusA_To <= "1010"; + Read_To_Acc <= '1'; + Save_ALU <= '1'; + when "01000110"|"01001110"|"01100110"|"01101110" => + -- IM 0 + IMode <= "00"; + when "01010110"|"01110110" => + -- IM 1 + IMode <= "01"; + when "01011110"|"01111110" => + -- IM 2 + IMode <= "10"; +-- 16 bit arithmetic + when "01001010"|"01011010"|"01101010"|"01111010" => + -- ADC HL,ss + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + No_PC <= '1'; + when 2 => + NoRead <= '1'; + ALU_Op <= "0001"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_BusA_To(2 downto 0) <= "101"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + Set_BusB_To(0) <= '1'; + when others => + Set_BusB_To <= "1000"; + end case; + TStates <= "100"; + SetWZ <= "11"; + No_PC <= '1'; + when 3 => + NoRead <= '1'; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + ALU_Op <= "0001"; + Set_BusA_To(2 downto 0) <= "100"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + Set_BusB_To(0) <= '0'; + when others => + Set_BusB_To <= "1001"; + end case; + when others => + end case; + when "01000010"|"01010010"|"01100010"|"01110010" => + -- SBC HL,ss + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + No_PC <= '1'; + when 2 => + NoRead <= '1'; + ALU_Op <= "0011"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_BusA_To(2 downto 0) <= "101"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + Set_BusB_To(0) <= '1'; + when others => + Set_BusB_To <= "1000"; + end case; + TStates <= "100"; + SetWZ <= "11"; + No_PC <= '1'; + when 3 => + NoRead <= '1'; + ALU_Op <= "0011"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + Set_BusA_To(2 downto 0) <= "100"; + case to_integer(unsigned(IR(5 downto 4))) is + when 0|1|2 => + Set_BusB_To(2 downto 1) <= IR(5 downto 4); + when others => + Set_BusB_To <= "1001"; + end case; + when others => + end case; + when "01101111" => + -- RLD -- Read in M2, not M3! fixed by Sorgelig + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + Read_To_Reg <= '1'; + Set_BusB_To(2 downto 0) <= "110"; + Set_BusA_To(2 downto 0) <= "111"; + ALU_Op <= "1101"; + Save_ALU <= '1'; + No_PC <= '1'; + when 3 => + TStates <= "100"; + I_RLD <= '1'; + NoRead <= '1'; + Set_Addr_To <= aXY; + when 4 => + Write <= '1'; + when others => + end case; + when "01100111" => + -- RRD -- Read in M2, not M3! fixed by Sorgelig + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aXY; + when 2 => + Read_To_Reg <= '1'; + Set_BusB_To(2 downto 0) <= "110"; + Set_BusA_To(2 downto 0) <= "111"; + ALU_Op <= "1110"; + Save_ALU <= '1'; + No_PC <= '1'; + when 3 => + TStates <= "100"; + I_RRD <= '1'; + NoRead <= '1'; + Set_Addr_To <= aXY; + when 4 => + Write <= '1'; + when others => + end case; + when "01000101"|"01001101"|"01010101"|"01011101"|"01100101"|"01101101"|"01110101"|"01111101" => + -- RETI/RETN + MCycles <= "011"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_TO <= aSP; + when 2 => + IncDec_16 <= "0111"; + Set_Addr_To <= aSP; + LDZ <= '1'; + when 3 => + Jump <= '1'; + IncDec_16 <= "0111"; + LDW <= '1'; + I_RETN <= '1'; + when others => null; + end case; + when "01000000"|"01001000"|"01010000"|"01011000"|"01100000"|"01101000"|"01110000"|"01111000" => + -- IN r,(C) + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aBC; + SetWZ <= "01"; + when 2 => + IORQ <= '1'; + if IR(5 downto 3) /= "110" then + Read_To_Reg <= '1'; + Set_BusA_To(2 downto 0) <= IR(5 downto 3); + end if; + I_INRC <= '1'; + when others => + end case; + when "01000001"|"01001001"|"01010001"|"01011001"|"01100001"|"01101001"|"01110001"|"01111001" => + -- OUT (C),r + -- OUT (C),0 + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + Set_Addr_To <= aBC; + SetWZ <= "01"; + Set_BusB_To(2 downto 0) <= IR(5 downto 3); + if IR(5 downto 3) = "110" then + Set_BusB_To(3) <= '1'; + end if; + when 2 => + Write <= '1'; + IORQ <= '1'; + when others => + end case; + when "10100010" | "10101010" | "10110010" | "10111010" => + -- INI, IND, INIR, INDR + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "101"; + Set_Addr_To <= aBC; + Set_BusB_To <= "1010"; + Set_BusA_To <= "0000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + ALU_Op <= "0010"; + SetWZ <= "11"; + IncDec_16(3) <= IR(3); + when 2 => + IORQ <= '1'; + Set_BusB_To <= "0110"; + Set_Addr_To <= aXY; + when 3 => + if IR(3) = '0' then + IncDec_16 <= "0110"; + else + IncDec_16 <= "1110"; + end if; + Write <= '1'; + I_BTR <= '1'; + when 4 => + NoRead <= '1'; + TStates <= "101"; + when others => null; + end case; + when "10100011" | "10101011" | "10110011" | "10111011" => + -- OUTI, OUTD, OTIR, OTDR + MCycles <= "100"; + case to_integer(unsigned(MCycle)) is + when 1 => + TStates <= "101"; + Set_Addr_To <= aXY; + Set_BusB_To <= "1010"; + Set_BusA_To <= "0000"; + Read_To_Reg <= '1'; + Save_ALU <= '1'; + ALU_Op <= "0010"; + when 2 => + Set_BusB_To <= "0110"; + Set_Addr_To <= aBC; + SetWZ <= "11"; + IncDec_16(3) <= IR(3); + when 3 => + if IR(3) = '0' then + IncDec_16 <= "0110"; + else + IncDec_16 <= "1110"; + end if; + IORQ <= '1'; + Write <= '1'; + I_BTR <= '1'; + when 4 => + NoRead <= '1'; + TStates <= "101"; + when others => null; + end case; + when "11000001"|"11001001"|"11010001"|"11011001" => + --R800 MULUB + if R800_mode = '1' then + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + NoRead <= '1'; + I_MULUB <= '1'; + Set_BusB_To(2 downto 0) <= IR(5 downto 3); + Set_BusB_To(3) <= '0'; + when 2 => + NoRead <= '1'; + I_MULU <= '1'; + Set_BusA_To(2 downto 0) <= "100"; + when others => null; + end case; + end if; + when "11000011"|"11110011" => + --R800 MULUW + if R800_mode = '1' then + MCycles <= "010"; + case to_integer(unsigned(MCycle)) is + when 1 => + NoRead <= '1'; + if DPAIR = "11" then + Set_BusB_To(3 downto 0) <= "1000"; + else + Set_BusB_To(2 downto 1) <= DPAIR; + Set_BusB_To(0) <= '0'; + Set_BusB_To(3) <= '0'; + end if; + Set_BusA_To(2 downto 0) <= "100"; + when 2 => + TStates <= "101"; + NoRead <= '1'; + I_MULU <= '1'; + Set_BusA_To(2 downto 0) <= "100"; + when others => null; + end case; + end if; + end case; + + end case; + + if Mode = 1 then + if MCycle = "001" then +-- TStates <= "100"; + else + TStates <= "011"; + end if; + end if; + + if Mode = 3 then + if MCycle = "001" then +-- TStates <= "100"; + else + TStates <= "100"; + end if; + end if; + + if Mode < 2 then + if MCycle = "110" then + Inc_PC <= '1'; + if Mode = 1 then + Set_Addr_To <= aXY; + TStates <= "100"; + Set_BusB_To(2 downto 0) <= SSS; + Set_BusB_To(3) <= '0'; + end if; + if IRB = "00110110" or IRB = "11001011" then + Set_Addr_To <= aNone; + end if; + if not (IRB = "00110110" or ISet = "01") then + No_PC <= '1'; + end if; + end if; + if MCycle = "111" then + if Mode = 0 then + TStates <= "101"; + end if; + if ISet /= "01" then + Set_Addr_To <= aXY; + end if; + Set_BusB_To(2 downto 0) <= SSS; + Set_BusB_To(3) <= '0'; + if IRB = "00110110" or ISet = "01" then + -- LD (HL),n + Inc_PC <= '1'; + else + NoRead <= '1'; + end if; + end if; + end if; + + end process; + +end; diff --git a/modules/cpu-t80/T80_Pack.vhd b/modules/cpu-t80/T80_Pack.vhd new file mode 100644 index 0000000..3ac1522 --- /dev/null +++ b/modules/cpu-t80/T80_Pack.vhd @@ -0,0 +1,248 @@ +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- +-- Ver 303 add undocumented DDCB and FDCB opcodes by TobiFlex 20.04.2010 +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- +-- Z80 compatible microprocessor core +-- +-- Version : 0250 +-- +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- + +library IEEE; +use IEEE.std_logic_1164.all; + +package T80_Pack is + + constant aNone : std_logic_vector(2 downto 0) := "111"; + constant aBC : std_logic_vector(2 downto 0) := "000"; + constant aDE : std_logic_vector(2 downto 0) := "001"; + constant aXY : std_logic_vector(2 downto 0) := "010"; + constant aIOA : std_logic_vector(2 downto 0) := "100"; + constant aSP : std_logic_vector(2 downto 0) := "101"; + constant aZI : std_logic_vector(2 downto 0) := "110"; + + component T80 + generic( + Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + IOWait : integer := 0; -- 1 => Single cycle I/O, 1 => Std I/O cycle + Flag_C : integer := 0; + Flag_N : integer := 1; + Flag_P : integer := 2; + Flag_X : integer := 3; + Flag_H : integer := 4; + Flag_Y : integer := 5; + Flag_Z : integer := 6; + Flag_S : integer := 7 + ); + port( + RESET_n : in std_logic; + CLK_n : in std_logic; + CEN : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + IORQ : out std_logic; + NoRead : out std_logic; + Write : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + A : out std_logic_vector(15 downto 0); + DInst : in std_logic_vector(7 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0); + MC : out std_logic_vector(2 downto 0); + TS : out std_logic_vector(2 downto 0); + IntCycle_n : out std_logic; + IntE : out std_logic; + Stop : out std_logic; + R800_mode : in std_logic := '0'; + out0 : in std_logic := '0'; -- 0 => OUT(C),0, 1 => OUT(C),255 + REG : out std_logic_vector(211 downto 0); -- IFF2, IFF1, IM, IY, HL', DE', BC', IX, HL, DE, BC, PC, SP, R, I, F', A', F, A + DIRSet : in std_logic := '0'; + DIR : in std_logic_vector(211 downto 0) := (others => '0') -- IFF2, IFF1, IM, IY, HL', DE', BC', IX, HL, DE, BC, PC, SP, R, I, F', A', F, A + ); + end component; + + component T80_Reg + port( + Clk : in std_logic; + CEN : in std_logic; + WEH : in std_logic; + WEL : in std_logic; + AddrA : in std_logic_vector(2 downto 0); + AddrB : in std_logic_vector(2 downto 0); + AddrC : in std_logic_vector(2 downto 0); + DIH : in std_logic_vector(7 downto 0); + DIL : in std_logic_vector(7 downto 0); + DOAH : out std_logic_vector(7 downto 0); + DOAL : out std_logic_vector(7 downto 0); + DOBH : out std_logic_vector(7 downto 0); + DOBL : out std_logic_vector(7 downto 0); + DOCH : out std_logic_vector(7 downto 0); + DOCL : out std_logic_vector(7 downto 0); + DOR : out std_logic_vector(127 downto 0); + DIRSet : in std_logic; + DIR : in std_logic_vector(127 downto 0) + ); + end component; + + component T80_MCode + generic( + Mode : integer := 0; + Flag_C : integer := 0; + Flag_N : integer := 1; + Flag_P : integer := 2; + Flag_X : integer := 3; + Flag_H : integer := 4; + Flag_Y : integer := 5; + Flag_Z : integer := 6; + Flag_S : integer := 7 + ); + port( + IR : in std_logic_vector(7 downto 0); + ISet : in std_logic_vector(1 downto 0); + MCycle : in std_logic_vector(2 downto 0); + F : in std_logic_vector(7 downto 0); + NMICycle : in std_logic; + IntCycle : in std_logic; + XY_State : in std_logic_vector(1 downto 0); + MCycles : out std_logic_vector(2 downto 0); + TStates : out std_logic_vector(2 downto 0); + Prefix : out std_logic_vector(1 downto 0); -- None,BC,ED,DD/FD + Inc_PC : out std_logic; + Inc_WZ : out std_logic; + IncDec_16 : out std_logic_vector(3 downto 0); -- BC,DE,HL,SP 0 is inc + Read_To_Reg : out std_logic; + Read_To_Acc : out std_logic; + Set_BusA_To : out std_logic_vector(3 downto 0); -- B,C,D,E,H,L,DI/DB,A,SP(L),SP(M),0,F + Set_BusB_To : out std_logic_vector(3 downto 0); -- B,C,D,E,H,L,DI,A,SP(L),SP(M),1,F,PC(L),PC(M),0 + ALU_Op : out std_logic_vector(3 downto 0); + -- ADD, ADC, SUB, SBC, AND, XOR, OR, CP, ROT, BIT, SET, RES, DAA, RLD, RRD, None + Save_ALU : out std_logic; + Rot_Akku : out std_logic; + PreserveC : out std_logic; + Arith16 : out std_logic; + Set_Addr_To : out std_logic_vector(2 downto 0); -- aNone,aXY,aIOA,aSP,aBC,aDE,aZI + IORQ : out std_logic; + Jump : out std_logic; + JumpE : out std_logic; + JumpXY : out std_logic; + Call : out std_logic; + RstP : out std_logic; + LDZ : out std_logic; + LDW : out std_logic; + LDSPHL : out std_logic; + LDHLSP : out std_logic; + ADDSPdd : out std_logic; + Special_LD : out std_logic_vector(2 downto 0); -- A,I;A,R;I,A;R,A;None + ExchangeDH : out std_logic; + ExchangeRp : out std_logic; + ExchangeAF : out std_logic; + ExchangeRS : out std_logic; + ExchangeWH : out std_logic; + I_DJNZ : out std_logic; + I_CPL : out std_logic; + I_CCF : out std_logic; + I_SCF : out std_logic; + I_RETN : out std_logic; + I_BT : out std_logic; + I_BC : out std_logic; + I_BTR : out std_logic; + I_RLD : out std_logic; + I_RRD : out std_logic; + I_INRC : out std_logic; + I_MULUB : out std_logic; + I_MULU : out std_logic; + SetWZ : out std_logic_vector(1 downto 0); + SetDI : out std_logic; + SetEI : out std_logic; + IMode : out std_logic_vector(1 downto 0); + Halt : out std_logic; + NoRead : out std_logic; + Write : out std_logic; + R800_mode : in std_logic; + No_PC : out std_logic; + XYbit_undoc : out std_logic + ); + end component; + + component T80_ALU + generic( + Mode : integer := 0; + Flag_C : integer := 0; + Flag_N : integer := 1; + Flag_P : integer := 2; + Flag_X : integer := 3; + Flag_H : integer := 4; + Flag_Y : integer := 5; + Flag_Z : integer := 6; + Flag_S : integer := 7 + ); + port( + Arith16 : in std_logic; + Z16 : in std_logic; + WZ : in std_logic_vector(15 downto 0); + XY_State : in std_logic_vector(1 downto 0); + ALU_Op : in std_logic_vector(3 downto 0); + Rot_Akku : in std_logic; + IR : in std_logic_vector(5 downto 0); + ISet : in std_logic_vector(1 downto 0); + BusA : in std_logic_vector(7 downto 0); + BusB : in std_logic_vector(7 downto 0); + F_In : in std_logic_vector(7 downto 0); + Q : out std_logic_vector(7 downto 0); + F_Out : out std_logic_vector(7 downto 0) + ); + end component; + +end; diff --git a/modules/cpu-t80/T80_Reg.vhd b/modules/cpu-t80/T80_Reg.vhd new file mode 100644 index 0000000..e7e8645 --- /dev/null +++ b/modules/cpu-t80/T80_Reg.vhd @@ -0,0 +1,152 @@ +-------------------------------------------------------------------------------- +-- **** +-- T80(c) core. Attempt to finish all undocumented features and provide +-- accurate timings. +-- Version 350. +-- Copyright (c) 2018 Sorgelig +-- Test passed: ZEXDOC, ZEXALL, Z80Full(*), Z80memptr +-- (*) Currently only SCF and CCF instructions aren't passed X/Y flags check as +-- correct implementation is still unclear. +-- +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- +-- T80 Registers, technology independent +-- +-- Version : 0244 +-- +-- Copyright (c) 2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t51/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0242 : Initial release +-- +-- 0244 : Changed to single register file +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; + +entity T80_Reg is + port( + Clk : in std_logic; + CEN : in std_logic; + WEH : in std_logic; + WEL : in std_logic; + AddrA : in std_logic_vector(2 downto 0); + AddrB : in std_logic_vector(2 downto 0); + AddrC : in std_logic_vector(2 downto 0); + DIH : in std_logic_vector(7 downto 0); + DIL : in std_logic_vector(7 downto 0); + DOAH : out std_logic_vector(7 downto 0); + DOAL : out std_logic_vector(7 downto 0); + DOBH : out std_logic_vector(7 downto 0); + DOBL : out std_logic_vector(7 downto 0); + DOCH : out std_logic_vector(7 downto 0); + DOCL : out std_logic_vector(7 downto 0); + DOR : out std_logic_vector(127 downto 0); + DIRSet : in std_logic; + DIR : in std_logic_vector(127 downto 0) + ); +end T80_Reg; + +architecture rtl of T80_Reg is + + type Register_Image is array (natural range <>) of std_logic_vector(7 downto 0); + signal RegsH : Register_Image(0 to 7); + signal RegsL : Register_Image(0 to 7); + +begin + + process (Clk) + begin + if rising_edge(Clk) then + if DIRSet = '1' then + RegsL(0) <= DIR( 7 downto 0); + RegsH(0) <= DIR( 15 downto 8); + + RegsL(1) <= DIR( 23 downto 16); + RegsH(1) <= DIR( 31 downto 24); + + RegsL(2) <= DIR( 39 downto 32); + RegsH(2) <= DIR( 47 downto 40); + + RegsL(3) <= DIR( 55 downto 48); + RegsH(3) <= DIR( 63 downto 56); + + RegsL(4) <= DIR( 71 downto 64); + RegsH(4) <= DIR( 79 downto 72); + + RegsL(5) <= DIR( 87 downto 80); + RegsH(5) <= DIR( 95 downto 88); + + RegsL(6) <= DIR(103 downto 96); + RegsH(6) <= DIR(111 downto 104); + + RegsL(7) <= DIR(119 downto 112); + RegsH(7) <= DIR(127 downto 120); + elsif CEN = '1' then + if WEH = '1' then + RegsH(to_integer(unsigned(AddrA))) <= DIH; + end if; + if WEL = '1' then + RegsL(to_integer(unsigned(AddrA))) <= DIL; + end if; + end if; + end if; + end process; + + DOAH <= RegsH(to_integer(unsigned(AddrA))); + DOAL <= RegsL(to_integer(unsigned(AddrA))); + DOBH <= RegsH(to_integer(unsigned(AddrB))); + DOBL <= RegsL(to_integer(unsigned(AddrB))); + DOCH <= RegsH(to_integer(unsigned(AddrC))); + DOCL <= RegsL(to_integer(unsigned(AddrC))); + DOR <= RegsH(7) & RegsL(7) & RegsH(6) & RegsL(6) & RegsH(5) & RegsL(5) & RegsH(4) & RegsL(4) & RegsH(3) & RegsL(3) & RegsH(2) & RegsL(2) & RegsH(1) & RegsL(1) & RegsH(0) & RegsL(0); + +end; diff --git a/modules/cpu-t80/T80a.vhd b/modules/cpu-t80/T80a.vhd new file mode 100644 index 0000000..fdd84d1 --- /dev/null +++ b/modules/cpu-t80/T80a.vhd @@ -0,0 +1,342 @@ +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- +-- Z80 compatible microprocessor core, asynchronous top level +-- +-- Version : 0250 +-- +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0208 : First complete release +-- +-- 0211 : Fixed interrupt cycle +-- +-- 0235 : Updated for T80 interface change +-- +-- 0238 : Updated for T80 interface change +-- +-- 0240 : Updated for T80 interface change +-- +-- 0242 : Updated for T80 interface change +-- +-- 0247 : Fixed bus req/ack cycle +-- +-- 0250 : Added R800 Multiplier by TobiFlex 2017.10.15 +-- +-- Bus signal logic changes from the ZX Spectrum Next were made by: +-- +-- Fabio Belavenuto, Charlie Ingley +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use work.T80_Pack.all; + +entity T80a is + generic( + Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + IOWait : integer := 1 -- 0 => Single I/O cycle, 1 => Std I/O cycle + ); + port( + RESET_n : in std_logic; + R800_mode : in std_logic; + CLK_n : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + A : out std_logic_vector(15 downto 0); + D : inout std_logic_vector(7 downto 0) + ); +end T80a; + +architecture rtl of T80a is + + signal CEN : std_logic; + signal Reset_s : std_logic; + signal IntCycle_n : std_logic; + signal IORQ : std_logic; + signal NoRead : std_logic; + signal Write : std_logic; + signal MREQ : std_logic; + signal MReq_Inhibit : std_logic; + signal Req_Inhibit : std_logic; + signal RD : std_logic; + signal MREQ_n_i : std_logic; + signal MREQ_rw : std_logic; -- 30/10/19 Charlie Ingley-- add MREQ control + signal IORQ_n_i : std_logic; + signal IORQ_t1 : std_logic; -- 30/10/19 Charlie Ingley-- add IORQ control + signal IORQ_t2 : std_logic; -- 30/10/19 Charlie Ingley-- add IORQ control + signal IORQ_rw : std_logic; -- 30/10/19 Charlie Ingley-- add IORQ control + signal IORQ_int : std_logic; -- 30/10/19 Charlie Ingley-- add IORQ interrupt control + signal IORQ_int_inhibit : std_logic_vector(2 downto 0); + signal RD_n_i : std_logic; + signal WR_n_i : std_logic; + signal WR_t2 : std_logic; -- 30/10/19 Charlie Ingley-- add WR control + signal RFSH_n_i : std_logic; + signal BUSAK_n_i : std_logic; + signal A_i : std_logic_vector(15 downto 0); + signal DO : std_logic_vector(7 downto 0); + signal DI_Reg : std_logic_vector (7 downto 0); -- Input synchroniser + signal Wait_s : std_logic; + signal MCycle : std_logic_vector(2 downto 0); + signal TState : std_logic_vector(2 downto 0); + +begin + + CEN <= '1'; + + BUSAK_n <= BUSAK_n_i; -- 30/10/19 Charlie Ingley - IORQ/RD/WR changes + MREQ_rw <= MREQ and (Req_Inhibit or MReq_Inhibit); -- added MREQ timing control + MREQ_n_i <= not MREQ_rw; -- changed MREQ generation + IORQ_rw <= IORQ and not (IORQ_t1 or IORQ_t2); -- added IORQ generation timing control + IORQ_n_i <= not ((IORQ_int and not IORQ_int_inhibit(2)) or IORQ_rw); -- changed IORQ generation + RD_n_i <= not (RD and (MREQ_rw or IORQ_rw)); -- changed RD/IORQ generation + WR_n_i <= not (Write and ((WR_t2 and MREQ_rw) or IORQ_rw)); -- added WR/IORQ timing control + + MREQ_n <= MREQ_n_i when BUSAK_n_i = '1' else 'Z'; + IORQ_n <= IORQ_n_i when BUSAK_n_i = '1' else 'Z'; + RD_n <= RD_n_i when BUSAK_n_i = '1' else 'Z'; + WR_n <= WR_n_i when BUSAK_n_i = '1' else 'Z'; + RFSH_n <= RFSH_n_i when BUSAK_n_i = '1' else 'Z'; + A <= A_i when BUSAK_n_i = '1' else (others => 'Z'); + D <= DO when Write = '1' and BUSAK_n_i = '1' else (others => 'Z'); + + process (RESET_n, CLK_n) + begin + if RESET_n = '0' then + Reset_s <= '0'; + elsif CLK_n'event and CLK_n = '1' then + Reset_s <= '1'; + end if; + end process; + + u0 : T80 + generic map( + Mode => Mode, + IOWait => IOWait) + port map( + R800_mode => R800_mode, + CEN => CEN, + M1_n => M1_n, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => RFSH_n_i, + HALT_n => HALT_n, + WAIT_n => Wait_s, + INT_n => INT_n, + NMI_n => NMI_n, + RESET_n => Reset_s, + BUSRQ_n => BUSRQ_n, + BUSAK_n => BUSAK_n_i, + CLK_n => CLK_n, + A => A_i, + DInst => D, + DI => DI_Reg, + DO => DO, + MC => MCycle, + TS => TState, + IntCycle_n => IntCycle_n); + + process (CLK_n) + begin + if CLK_n'event and CLK_n = '0' then + Wait_s <= WAIT_n; + if TState = "011" and BUSAK_n_i = '1' then + DI_Reg <= to_x01(D); + end if; + end if; + end process; + +-- 30/10/19 Charlie Ingley - Generate WR_t2 to correct MREQ/WR timing + process (Reset_s,CLK_n) + begin + if Reset_s = '0' then + WR_t2 <= '0'; + elsif CLK_n'event and CLK_n = '0' then + if MCycle /= "001" then + if TState = "010" then -- WR starts on falling edge of T2 for MREQ + WR_t2 <= Write; + end if; + end if; + if TState = "011" then -- end WR + WR_t2 <= '0'; + end if; + end if; + end process; + +-- Generate Req_Inhibit + process (Reset_s,CLK_n) + begin + if Reset_s = '0' then + Req_Inhibit <= '1'; -- Charlie Ingley 30/10/19 - changed Req_Inhibit polarity + elsif CLK_n'event and CLK_n = '1' then + if MCycle = "001" and TState = "010" and WAIT_n = '1' then -- by Fabio Belavenuto - fix behavior of Wait_n + Req_Inhibit <= '0'; + else + Req_Inhibit <= '1'; + end if; + end if; + end process; + +-- Generate MReq_Inhibit + process (Reset_s, CLK_n) + begin + if Reset_s = '0' then + MReq_Inhibit <= '1'; -- Charlie Ingley 30/10/19 - changed Req_Inhibit polarity + elsif CLK_n'event and CLK_n = '0' then + if MCycle = "001" and TState = "010" and WAIT_n = '1' then -- by Fabio Belavenuto - fix behavior of Wait_n + MReq_Inhibit <= '0'; + else + MReq_Inhibit <= '1'; + end if; + end if; + end process; + +-- Generate RD for MREQ + process(Reset_s,CLK_n) + begin + if Reset_s = '0' then + RD <= '0'; + MREQ <= '0'; + elsif CLK_n'event and CLK_n = '0' then + if MCycle = "001" then + if TState = "001" then + RD <= IntCycle_n; + MREQ <= IntCycle_n; + end if; + if TState = "011" then + RD <= '0'; + MREQ <= '1'; + end if; + if TState = "100" then + MREQ <= '0'; + end if; + else + if TState = "001" and NoRead = '0' then + RD <= not Write; + MREQ <= not IORQ; + end if; + if TState = "011" then + RD <= '0'; + MREQ <= '0'; + end if; + end if; + end if; + end process; + + -- 30/10/19 Charlie Ingley - Generate IORQ_int for IORQ interrupt timing control + process(Reset_s,CLK_n) + begin + if Reset_s = '0' then + IORQ_int <= '0'; + elsif CLK_n'event and CLK_n = '1' then + if MCycle = "001" then + if TState = "001" then + IORQ_int <= not IntCycle_n; + end if; + if TState = "010" then + IORQ_int <= '0'; + end if; + end if; + end if; + end process; + + process(Reset_s,CLK_n) + begin + if Reset_s = '0' then + IORQ_int_inhibit <= "111"; + elsif CLK_n'event and CLK_n = '0' then + if IntCycle_n = '0' then + if MCycle = "001" then + IORQ_int_inhibit <= IORQ_int_inhibit(1 downto 0) & '0'; + end if; + if MCycle = "010" then + IORQ_int_inhibit <= "111"; + end if; + end if; + end if; + end process; + +-- 30/10/19 Charlie Ingley - Generate IORQ_t1 for IORQ timing control + process(Reset_s, CLK_n) + begin + if Reset_s = '0' then + IORQ_t1 <= '1'; + elsif CLK_n'event and CLK_n = '0' then + if TState = "001" then + IORQ_t1 <= not IntCycle_n; + end if; + if TState = "011" then + IORQ_t1 <= '1'; + end if; + end if; + end process; + +-- 30/10/19 Charlie Ingley - Generate IORQ_t2 for IORQ timing control + process (RESET_n, CLK_n) + begin + if RESET_n = '0' then + IORQ_t2 <= '1'; + elsif CLK_n'event and CLK_n = '1' then + IORQ_t2 <= IORQ_t1; + end if; + end process; + +end; diff --git a/modules/cpu-t80/T80as.vhd b/modules/cpu-t80/T80as.vhd new file mode 100644 index 0000000..9a34c64 --- /dev/null +++ b/modules/cpu-t80/T80as.vhd @@ -0,0 +1,289 @@ +------------------------------------------------------------------------------ +-- 2004.10.18 WR_n active was changed from T2 to T3. +-- modification by Katsumi Degawa +------------------------------------------------------------------------------ +-- t80as.vhd : The non-tristate signal edition of t80a.vhd +-- +-- 2003.2.7 non-tristate modification by Tatsuyuki Satoh +-- +-- 1.separate 'D' to 'DO' and 'DI'. +-- 2.added 'DOE' to 'DO' enable signal.(data direction) +-- 3.MREQ_n,IORQ_n,RD_n,WR_n,RFSH_n,A doesn't become the condition of 'Z'. +-- +-- There is a mark of "--AS" in all the change points. +-- +------------------------------------------------------------------------------ + +-- +-- Z80 compatible microprocessor core, asynchronous top level +-- +-- Version : 0247 +-- +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0208 : First complete release +-- +-- 0211 : Fixed interrupt cycle +-- +-- 0235 : Updated for T80 interface change +-- +-- 0238 : Updated for T80 interface change +-- +-- 0240 : Updated for T80 interface change +-- +-- 0242 : Updated for T80 interface change +-- +-- 0247 : Fixed bus req/ack cycle +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use work.T80_Pack.all; + +entity T80as is + generic( + Mode : integer := 0 -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + ); + port( + RESET_n : in std_logic; + CLK_n : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + A : out std_logic_vector(15 downto 0); +--AS-- D : inout std_logic_vector(7 downto 0) +--AS>> + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0); + DOE : out std_logic +--< 'Z'); +--AS-- D <= DO when Write = '1' and BUSAK_n_i = '1' else (others => 'Z'); +--AS>> + MREQ_n <= MREQ_n_i; + IORQ_n <= IORQ_n_i; + RD_n <= RD_n_i; + WR_n <= WR_n_i; + RFSH_n <= RFSH_n_i; + A <= A_i; + DOE <= Write when BUSAK_n_i = '1' else '0'; +--< Mode, + IOWait => 1) + port map( + CEN => CEN, + M1_n => M1_n, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => RFSH_n_i, + HALT_n => HALT_n, + WAIT_n => Wait_s, + INT_n => INT_n, + NMI_n => NMI_n, + RESET_n => Reset_s, + BUSRQ_n => BUSRQ_n, + BUSAK_n => BUSAK_n_i, + CLK_n => CLK_n, + A => A_i, +-- DInst => D, + DInst => DI, + DI => DI_Reg, + DO => DO, + MC => MCycle, + TS => TState, + IntCycle_n => IntCycle_n); + + process (CLK_n) + begin + if CLK_n'event and CLK_n = '0' then + Wait_s <= WAIT_n; + if TState = "011" and BUSAK_n_i = '1' then +--AS-- DI_Reg <= to_x01(D); +--AS>> + DI_Reg <= to_x01(DI); +--< Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + ); + port( + RESET_n : in std_logic; + CLK : in std_logic; + CEN_p : in std_logic := '1'; + CEN_n : in std_logic := '1'; + WAIT_n : in std_logic := '1'; + INT_n : in std_logic := '1'; + NMI_n : in std_logic := '1'; + BUSRQ_n : in std_logic := '1'; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + OUT0 : in std_logic := '0'; -- 0 => OUT(C),0, 1 => OUT(C),255 + A : out std_logic_vector(15 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0); + R800_mode : in std_logic := '0'; + REG : out std_logic_vector(211 downto 0); -- IFF2, IFF1, IM, IY, HL', DE', BC', IX, HL, DE, BC, PC, SP, R, I, F', A', F, A + DIRSet : in std_logic := '0'; + DIR : in std_logic_vector(211 downto 0) := (others => '0') -- IFF2, IFF1, IM, IY, HL', DE', BC', IX, HL, DE, BC, PC, SP, R, I, F', A', F, A + ); +end T80pa; + +architecture rtl of T80pa is + + signal IntCycle_n : std_logic; + signal IntCycleD_n : std_logic_vector(1 downto 0); + signal IORQ : std_logic; + signal NoRead : std_logic; + signal Write : std_logic; + signal BUSAK : std_logic; + signal DI_Reg : std_logic_vector (7 downto 0); -- Input synchroniser + signal MCycle : std_logic_vector(2 downto 0); + signal TState : std_logic_vector(2 downto 0); + signal CEN_pol : std_logic; + signal CEN : std_logic; +begin + + CEN <= CEN_p and not CEN_pol; + BUSAK_n <= BUSAK; + + u0 : T80 + generic map( + Mode => Mode, + IOWait => 1 + ) + port map( + CEN => CEN, + M1_n => M1_n, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => RFSH_n, + HALT_n => HALT_n, + WAIT_n => '1', + INT_n => INT_n, + NMI_n => NMI_n, + RESET_n => RESET_n, + BUSRQ_n => BUSRQ_n, + BUSAK_n => BUSAK, + CLK_n => CLK, + A => A, + DInst => DI, -- valid at beginning of T3 + DI => DI_Reg, -- latched at middle of T3 + DO => DO, + REG => REG, + MC => MCycle, + TS => TState, + OUT0 => OUT0, + R800_mode => R800_mode, + IntCycle_n => IntCycle_n, + DIRSet => DIRSet, + DIR => DIR + ); + + process(CLK) + begin + if rising_edge(CLK) then + if RESET_n = '0' then + WR_n <= '1'; + RD_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + DI_Reg <= "00000000"; + CEN_pol <= '0'; + elsif CEN_p = '1' and CEN_pol = '0' then + CEN_pol <= '1'; + if MCycle = "001" then + if TState = "010" then + IORQ_n <= '1'; + MREQ_n <= '1'; + RD_n <= '1'; + end if; + else + if TState = "001" and IORQ = '1' then + WR_n <= not Write; + RD_n <= Write; + IORQ_n <= '0'; + end if; + end if; + elsif CEN_n = '1' and CEN_pol = '1' then + if TState = "010" then + CEN_pol <= not WAIT_n; + else + CEN_pol <= '0'; + end if; + if TState = "011" and BUSAK = '1' then + DI_Reg <= DI; + end if; + if MCycle = "001" then + if TState = "001" then + IntCycleD_n <= IntCycleD_n(0) & IntCycle_n; + RD_n <= not IntCycle_n; + MREQ_n <= not IntCycle_n; + IORQ_n <= IntCycleD_n(1); + end if; + if TState = "011" then + IntCycleD_n <= "11"; + RD_n <= '1'; + MREQ_n <= '0'; + end if; + if TState = "100" then + MREQ_n <= '1'; + end if; + else + if NoRead = '0' and IORQ = '0' then + if TState = "001" then + RD_n <= Write; + MREQ_n <= '0'; + end if; + end if; + if TState = "010" then + WR_n <= not Write; + end if; + if TState = "011" then + WR_n <= '1'; + RD_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + end if; + end if; + end if; + end if; + end process; +end; diff --git a/modules/cpu-t80/T80s.vhd b/modules/cpu-t80/T80s.vhd new file mode 100644 index 0000000..6967292 --- /dev/null +++ b/modules/cpu-t80/T80s.vhd @@ -0,0 +1,193 @@ +-- +-- Z80 compatible microprocessor core, synchronous top level +-- Different timing than the original z80 +-- Inputs needs to be synchronous and outputs may glitch +-- +-- Version : 0242 +-- +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0208 : First complete release +-- +-- 0210 : Fixed read with wait +-- +-- 0211 : Fixed interrupt cycle +-- +-- 0235 : Updated for T80 interface change +-- +-- 0236 : Added T2Write generic +-- +-- 0237 : Fixed T2Write with wait state +-- +-- 0238 : Updated for T80 interface change +-- +-- 0240 : Updated for T80 interface change +-- +-- 0242 : Updated for T80 interface change +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use IEEE.STD_LOGIC_UNSIGNED.all; +use work.T80_Pack.all; + +entity T80s is + generic( + Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + T2Write : integer := 1; -- 0 => WR_n active in T3, /=0 => WR_n active in T2 + IOWait : integer := 1 -- 0 => Single cycle I/O, 1 => Std I/O cycle + ); + port( + RESET_n : in std_logic; + CLK : in std_logic; + CEN : in std_logic := '1'; + WAIT_n : in std_logic := '1'; + INT_n : in std_logic := '1'; + NMI_n : in std_logic := '1'; + BUSRQ_n : in std_logic := '1'; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + OUT0 : in std_logic := '0'; -- 0 => OUT(C),0, 1 => OUT(C),255 + A : out std_logic_vector(15 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0) + ); +end T80s; + +architecture rtl of T80s is + + signal IntCycle_n : std_logic; + signal NoRead : std_logic; + signal Write : std_logic; + signal IORQ : std_logic; + signal DI_Reg : std_logic_vector(7 downto 0); + signal MCycle : std_logic_vector(2 downto 0); + signal TState : std_logic_vector(2 downto 0); + +begin + + u0 : T80 + generic map( + Mode => Mode, + IOWait => IOWait) + port map( + CEN => CEN, + M1_n => M1_n, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => RFSH_n, + HALT_n => HALT_n, + WAIT_n => Wait_n, + INT_n => INT_n, + NMI_n => NMI_n, + RESET_n => RESET_n, + BUSRQ_n => BUSRQ_n, + BUSAK_n => BUSAK_n, + CLK_n => CLK, + A => A, + DInst => DI, + DI => DI_Reg, + DO => DO, + MC => MCycle, + TS => TState, + OUT0 => OUT0, + IntCycle_n => IntCycle_n + ); + + process (RESET_n, CLK) + begin + if RESET_n = '0' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + DI_Reg <= "00000000"; + elsif rising_edge(CLK) then + if CEN = '1' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + if MCycle = 1 then + if TState = 1 or (TState = 2 and Wait_n = '0') then + RD_n <= not IntCycle_n; + MREQ_n <= not IntCycle_n; + IORQ_n <= IntCycle_n; + end if; + if TState = 3 then + MREQ_n <= '0'; + end if; + else + if (TState = 1 or (TState = 2 and Wait_n = '0')) and NoRead = '0' and Write = '0' then + RD_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + if T2Write = 0 then + if TState = 2 and Write = '1' then + WR_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + else + if (TState = 1 or (TState = 2 and Wait_n = '0')) and Write = '1' then + WR_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + end if; + end if; + if TState = 2 and Wait_n = '1' then + DI_Reg <= DI; + end if; + end if; + end if; + end process; +end; diff --git a/modules/cpu-t80/T80se.vhd b/modules/cpu-t80/T80se.vhd new file mode 100644 index 0000000..1b0cb9b --- /dev/null +++ b/modules/cpu-t80/T80se.vhd @@ -0,0 +1,192 @@ +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- +-- Z80 compatible microprocessor core, synchronous top level with clock enable +-- Different timing than the original z80 +-- Inputs needs to be synchronous and outputs may glitch +-- +-- Version : 0240 +-- +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0235 : First release +-- +-- 0236 : Added T2Write generic +-- +-- 0237 : Fixed T2Write with wait state +-- +-- 0238 : Updated for T80 interface change +-- +-- 0240 : Updated for T80 interface change +-- +-- 0242 : Updated for T80 interface change +-- +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use work.T80_Pack.all; + +entity T80se is + generic( + Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + T2Write : integer := 0; -- 0 => WR_n active in T3, /=0 => WR_n active in T2 + IOWait : integer := 1 -- 0 => Single cycle I/O, 1 => Std I/O cycle + ); + port( + RESET_n : in std_logic; + CLK_n : in std_logic; + CLKEN : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + A : out std_logic_vector(15 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0) + ); +end T80se; + +architecture rtl of T80se is + + signal IntCycle_n : std_logic; + signal NoRead : std_logic; + signal Write : std_logic; + signal IORQ : std_logic; + signal DI_Reg : std_logic_vector(7 downto 0); + signal MCycle : std_logic_vector(2 downto 0); + signal TState : std_logic_vector(2 downto 0); + +begin + + u0 : T80 + generic map( + Mode => Mode, + IOWait => IOWait) + port map( + CEN => CLKEN, + M1_n => M1_n, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => RFSH_n, + HALT_n => HALT_n, + WAIT_n => Wait_n, + INT_n => INT_n, + NMI_n => NMI_n, + RESET_n => RESET_n, + BUSRQ_n => BUSRQ_n, + BUSAK_n => BUSAK_n, + CLK_n => CLK_n, + A => A, + DInst => DI, + DI => DI_Reg, + DO => DO, + MC => MCycle, + TS => TState, + IntCycle_n => IntCycle_n); + + process (RESET_n, CLK_n) + begin + if RESET_n = '0' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + DI_Reg <= "00000000"; + elsif CLK_n'event and CLK_n = '1' then + if CLKEN = '1' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + if MCycle = "001" then + if TState = "001" or (TState = "010" and Wait_n = '0') then + RD_n <= not IntCycle_n; + MREQ_n <= not IntCycle_n; + IORQ_n <= IntCycle_n; + end if; + if TState = "011" then + MREQ_n <= '0'; + end if; + else + if (TState = "001" or (TState = "010" and Wait_n = '0')) and NoRead = '0' and Write = '0' then + RD_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + if T2Write = 0 then + if TState = "010" and Write = '1' then + WR_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + else + if (TState = "001" or (TState = "010" and Wait_n = '0')) and Write = '1' then + WR_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + end if; + end if; + if TState = "010" and Wait_n = '1' then + DI_Reg <= DI; + end if; + end if; + end if; + end process; + +end; diff --git a/modules/cpu-t80/T80sed.vhd b/modules/cpu-t80/T80sed.vhd new file mode 100644 index 0000000..0c28ec2 --- /dev/null +++ b/modules/cpu-t80/T80sed.vhd @@ -0,0 +1,179 @@ +-- **** +-- T80(b) core. In an effort to merge and maintain bug fixes .... +-- +-- +-- Ver 300 started tidyup +-- MikeJ March 2005 +-- Latest version from www.fpgaarcade.com (original www.opencores.org) +-- +-- **** +-- ** CUSTOM 2 CLOCK MEMORY ACCESS FOR PACMAN, MIKEJ ** +-- +-- Z80 compatible microprocessor core, synchronous top level with clock enable +-- Different timing than the original z80 +-- Inputs needs to be synchronous and outputs may glitch +-- +-- Version : 0238 +-- +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +-- The latest version of this file can be found at: +-- http://www.opencores.org/cvsweb.shtml/t80/ +-- +-- Limitations : +-- +-- File history : +-- +-- 0235 : First release +-- +-- 0236 : Added T2Write generic +-- +-- 0237 : Fixed T2Write with wait state +-- +-- 0238 : Updated for T80 interface change +-- +-- 0242 : Updated for T80 interface change +-- + +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.numeric_std.all; +use work.T80_Pack.all; + +entity T80sed is + port( + RESET_n : in std_logic; + CLK_n : in std_logic; + CLKEN : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + A : out std_logic_vector(15 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0) + ); +end T80sed; + +architecture rtl of T80sed is + + signal IntCycle_n : std_logic; + signal NoRead : std_logic; + signal Write : std_logic; + signal IORQ : std_logic; + signal DI_Reg : std_logic_vector(7 downto 0); + signal MCycle : std_logic_vector(2 downto 0); + signal TState : std_logic_vector(2 downto 0); + +begin + + u0 : T80 + generic map( + Mode => 0, + IOWait => 1) + port map( + CEN => CLKEN, + M1_n => M1_n, + IORQ => IORQ, + NoRead => NoRead, + Write => Write, + RFSH_n => RFSH_n, + HALT_n => HALT_n, + WAIT_n => Wait_n, + INT_n => INT_n, + NMI_n => NMI_n, + RESET_n => RESET_n, + BUSRQ_n => BUSRQ_n, + BUSAK_n => BUSAK_n, + CLK_n => CLK_n, + A => A, + DInst => DI, + DI => DI_Reg, + DO => DO, + MC => MCycle, + TS => TState, + IntCycle_n => IntCycle_n); + + process (RESET_n, CLK_n) + begin + if RESET_n = '0' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + DI_Reg <= "00000000"; + elsif CLK_n'event and CLK_n = '1' then + if CLKEN = '1' then + RD_n <= '1'; + WR_n <= '1'; + IORQ_n <= '1'; + MREQ_n <= '1'; + if MCycle = "001" then + if TState = "001" or (TState = "010" and Wait_n = '0') then + RD_n <= not IntCycle_n; + MREQ_n <= not IntCycle_n; + IORQ_n <= IntCycle_n; + end if; + if TState = "011" then + MREQ_n <= '0'; + end if; + else + if (TState = "001" or TState = "010") and NoRead = '0' and Write = '0' then + RD_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + if ((TState = "001") or (TState = "010")) and Write = '1' then + WR_n <= '0'; + IORQ_n <= not IORQ; + MREQ_n <= IORQ; + end if; + end if; + if TState = "010" and Wait_n = '1' then + DI_Reg <= DI; + end if; + end if; + end if; + end process; + +end; diff --git a/modules/cpu-t80/Z80.vhd b/modules/cpu-t80/Z80.vhd new file mode 100644 index 0000000..db1ad94 --- /dev/null +++ b/modules/cpu-t80/Z80.vhd @@ -0,0 +1,135 @@ +library IEEE; +use IEEE.std_logic_1164.all; +library work; +use work.T80_Pack.all; + +entity Z80 is port + ( + clk : in std_logic; + clk_en : in std_logic; + reset : in std_logic; + + addr : out std_logic_vector(15 downto 0); + datai : in std_logic_vector(7 downto 0); + datao : out std_logic_vector(7 downto 0); + + m1 : out std_logic; + mem_rd : out std_logic; + mem_wr : out std_logic; + io_rd : out std_logic; + io_wr : out std_logic; + + wait_n : in std_logic := '1'; + busrq_n : in std_logic := '1'; + intreq : in std_logic := '0'; + intvec : in std_logic_vector(7 downto 0); + intack : out std_logic; + nmi : in std_logic := '0' + ); +end Z80; + +architecture SYN of Z80 is + + component T80se is + generic + ( + Mode : integer := 0; -- 0 => Z80, 1 => Fast Z80, 2 => 8080, 3 => GB + T2Write : integer := 1 -- 0 => WR_n active in T3, /=0 => WR_n active in T2 + ); + port + ( + RESET_n : in std_logic; + CLK_n : in std_logic; + CLKEN : in std_logic; + WAIT_n : in std_logic; + INT_n : in std_logic; + NMI_n : in std_logic; + BUSRQ_n : in std_logic; + M1_n : out std_logic; + MREQ_n : out std_logic; + IORQ_n : out std_logic; + RD_n : out std_logic; + WR_n : out std_logic; + RFSH_n : out std_logic; + HALT_n : out std_logic; + BUSAK_n : out std_logic; + A : out std_logic_vector(15 downto 0); + DI : in std_logic_vector(7 downto 0); + DO : out std_logic_vector(7 downto 0) + ); + end component T80se; + + -- Signal Declarations + + signal reset_n : std_logic; + signal int_n : std_logic; + signal nmi_n : std_logic; + + signal z80_m1 : std_logic; + signal z80_memreq : std_logic; + signal z80_ioreq : std_logic; + signal z80_rd : std_logic; + signal z80_wr : std_logic; + signal z80_datai : std_logic_vector(7 downto 0); + + -- derived signals (outputs we need to read) + signal z80_memrd : std_logic; + signal z80_iord : std_logic; + signal fetch : std_logic; + + begin + + -- simple inversions + reset_n <= not reset; + int_n <= not intreq; + nmi_n <= not nmi; + + -- direct-connect (outputs we need to read) + m1 <= z80_m1; + mem_rd <= z80_memrd; + io_rd <= z80_iord; + + -- memory signals + z80_memrd <= z80_memreq nor z80_rd; + mem_wr <= z80_memreq nor z80_wr; + + -- io signals + z80_iord <= z80_ioreq nor z80_rd; + io_wr <= z80_ioreq nor z80_wr; + + -- other signals + fetch <= z80_m1 nor z80_memreq; + intack <= z80_m1 nor z80_ioreq; + + -- data in mux + z80_datai <= intvec when ((z80_memrd or z80_iord) = '0') else + datai; + + Z80_uP : T80se + generic map + ( + Mode => 0 -- Z80 + ) + port map + ( + RESET_n => reset_n, + CLK_n => clk, + CLKEN => clk_en, + WAIT_n => wait_n, + INT_n => int_n, + NMI_n => nmi_n, + BUSRQ_n => busrq_n, + M1_n => z80_m1, + MREQ_n => z80_memreq, + IORQ_n => z80_ioreq, + RD_n => z80_rd, + WR_n => z80_wr, + RFSH_n => open, + HALT_n => open, + BUSAK_n => open, + A => addr, + DI => z80_datai, + DO => datao + ); + +end architecture SYN; diff --git a/modules/cpu-t80/index.qip b/modules/cpu-t80/index.qip new file mode 100644 index 0000000..cbae7f7 --- /dev/null +++ b/modules/cpu-t80/index.qip @@ -0,0 +1,13 @@ +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "GBse.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80pa.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80s.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80se.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80a.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80as.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80sed.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T8080se.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80_Reg.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80_MCode.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80_ALU.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "T80_Pack.vhd"] \ No newline at end of file diff --git a/modules/general-sync_fifo/index.qip b/modules/general-sync_fifo/index.qip new file mode 100644 index 0000000..78b207b --- /dev/null +++ b/modules/general-sync_fifo/index.qip @@ -0,0 +1 @@ +set_global_assignment -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "sync_fifo.sv"] diff --git a/modules/general-sync_fifo/sync_fifo.sv b/modules/general-sync_fifo/sync_fifo.sv new file mode 100644 index 0000000..0192291 --- /dev/null +++ b/modules/general-sync_fifo/sync_fifo.sv @@ -0,0 +1,96 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: MIT +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022 Adam Gastineau +//------------------------------------------------------------------------------ +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +//------------------------------------------------------------------------------ +// Easily reusable method for synchronizing multiple bits across clock domains +// Uses a shallow depth (4 entries) FIFO, so make sure to empty it quickly +//------------------------------------------------------------------------------ + +module sync_fifo #( + parameter WIDTH = 2 + ) ( + input wire clk_write, + input wire clk_read, + + input wire write_en, + input wire [WIDTH - 1:0] data_in, + output reg [WIDTH - 1:0] data_out = 0 + ); + + reg read_req = 0; + wire empty; + + wire [WIDTH - 1:0] fifo_out; + + dcfifo dcfifo_component ( + .data(data_in), + .rdclk(clk_read), + .rdreq(read_req), + .wrclk(clk_write), + .wrreq(write_en), + .q(fifo_out), + .rdempty(empty), + .aclr(), + .eccstatus(), + .rdfull(), + .rdusedw(), + .wrempty(), + .wrfull(), + .wrusedw() + ); + + defparam dcfifo_component.intended_device_family = "Cyclone V", + dcfifo_component.lpm_numwords = 4, + dcfifo_component.lpm_showahead = "OFF", + dcfifo_component.lpm_type = "dcfifo", + dcfifo_component.lpm_width = 32, + dcfifo_component.lpm_widthu = 2, + dcfifo_component.overflow_checking = "ON", + dcfifo_component.rdsync_delaypipe = 5, + dcfifo_component.underflow_checking = "ON", + dcfifo_component.use_eab = "ON", + dcfifo_component.wrsync_delaypipe = 5; + + reg [1:0] read_state = 0; + localparam READ_DELAY = 1; + localparam READ_WRITE = 2; + + always @(posedge clk_read) begin + read_req <= 0; + + if (~empty) begin + read_state <= READ_DELAY; + read_req <= 1; + end + + case (read_state) + READ_DELAY: begin + read_state <= READ_WRITE; + end + READ_WRITE: begin + read_state <= 0; + data_out <= fifo_out; + end + endcase + end + +endmodule diff --git a/modules/pocket-dataloader/data_loader.sv b/modules/pocket-dataloader/data_loader.sv new file mode 100644 index 0000000..53e0a49 --- /dev/null +++ b/modules/pocket-dataloader/data_loader.sv @@ -0,0 +1,223 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: MIT +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022 Adam Gastineau +//------------------------------------------------------------------------------ +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +//------------------------------------------------------------------------------ +// +// A data loader for consuming APF bridge writes and directing them to some storage medium +// +// This takes the 32 bit words from APF, and splits it into four / OUTPUT_WORD_SIZE words (4 separate bytes, or 2 16-bit words). +// You can configure the cycle delay by setting WRITE_MEM_CLOCK_DELAY +// +//------------------------------------------------------------------------------ + +module data_loader #( + // Upper 4 bits of address + parameter ADDRESS_MASK_UPPER_4 = 0, + parameter ADDRESS_SIZE = 28, + + // Number of clk_memory cycles to delay each write output + // Min 4. Component will assert this value is within the valid range + // Be aware that APF sends data every ~75 74MHz cycles, so you cannot send data slower than this + parameter WRITE_MEM_CLOCK_DELAY = 4, + + // Number of clk_memory cycles to hold the write_en signal high + // Min 1. Component will assert this value is within the valid range + parameter WRITE_MEM_EN_CYCLE_LENGTH = 1, + + // Word size in number of bytes. Can either be 1 (output 8 bits), or 2 (output 16 bits) + // Component will assert this value is within the valid range + parameter OUTPUT_WORD_SIZE = 1 + ) ( + input wire clk_74a, + input wire clk_memory, + + input wire bridge_wr, + input wire bridge_endian_little, + input wire [31:0] bridge_addr, + input wire [31:0] bridge_wr_data, + + // These outputs are synced to the memory clock + output reg write_en = 0, + output reg [ADDRESS_SIZE-1:0] write_addr = 0, + output reg [8 * OUTPUT_WORD_SIZE - 1:0] write_data = 0 + ); + +`define MAX(x, y) ((x > y) ? x : y) + + localparam WORD_SIZE = 8 * OUTPUT_WORD_SIZE; + // Only use the lower 28 bits of the address + localparam FIFO_SIZE = WORD_SIZE + 28; + + wire mem_empty; + + wire [FIFO_SIZE - 1:0] fifo_out; + + reg read_req = 0; + reg write_req = 0; + reg [31:0] shift_data; + reg [27:0] buff_bridge_addr; + + wire [FIFO_SIZE - 1:0] fifo_in = {shift_data[WORD_SIZE-1:0], buff_bridge_addr[27:0]}; + + dcfifo dcfifo_component ( + .data(fifo_in), + .rdclk(clk_memory), + .rdreq(read_req), + .wrclk(clk_74a), + .wrreq(write_req), + .q(fifo_out), + .rdempty(mem_empty) + // .wrempty(), + // .aclr(), + // .eccstatus(), + // .rdfull(), + // .rdusedw(), + // .wrfull(), + // .wrusedw() + ); + + defparam dcfifo_component.clocks_are_synchronized = "FALSE", + dcfifo_component.intended_device_family = "Cyclone V", + dcfifo_component.lpm_numwords = 4, + dcfifo_component.lpm_showahead = "OFF", + dcfifo_component.lpm_type = "dcfifo", + dcfifo_component.lpm_width = FIFO_SIZE, + dcfifo_component.lpm_widthu = 2, + dcfifo_component.overflow_checking = "OFF", + dcfifo_component.rdsync_delaypipe = 5, + dcfifo_component.underflow_checking = "OFF", + dcfifo_component.use_eab = "OFF", + dcfifo_component.wrsync_delaypipe = 5; + + /// APF to Mem clock + reg prev_bridge_wr = 0; + reg [2:0] write_count = 0; + reg [2:0] write_state = 0; + + localparam WRITE_START = 1; + localparam WRITE_REQ_SHIFT = 2; + + // Receive APF writes and buffer them into the memory clock domain + always @(posedge clk_74a) begin + prev_bridge_wr <= bridge_wr; + + if (~prev_bridge_wr && bridge_wr && bridge_addr[31:28] == ADDRESS_MASK_UPPER_4) begin + // Beginning APF write to core + write_state <= WRITE_REQ_SHIFT; + write_req <= 1; + write_count <= 0; + + shift_data <= bridge_endian_little ? bridge_wr_data : { + bridge_wr_data[7:0], bridge_wr_data[15:8], bridge_wr_data[23:16], bridge_wr_data[31:24] + }; + + buff_bridge_addr <= bridge_addr[27:0]; + end + + case (write_state) + WRITE_START: begin + write_req <= 1; + + write_state <= WRITE_REQ_SHIFT; + end + WRITE_REQ_SHIFT: begin + write_req <= 0; + + // We will be writing again in the next cycle + shift_data <= {8'h0, shift_data[31:WORD_SIZE]}; + buff_bridge_addr <= buff_bridge_addr + OUTPUT_WORD_SIZE; + + write_count <= write_count + 1; + + if (write_count == (4 / OUTPUT_WORD_SIZE) - 1) begin + // Finished write + write_state <= 0; + end + else begin + write_state <= WRITE_START; + end + end + endcase + end + + /// Mem clock to core + + reg [5:0] read_state = 0; + + localparam READ_DELAY = 1; + localparam READ_WRITE = 2; + localparam READ_WRITE_EN_CYCLE_OFF = READ_WRITE + WRITE_MEM_EN_CYCLE_LENGTH; + localparam READ_WRITE_END_DEFAULT = WRITE_MEM_CLOCK_DELAY - 1; + // Must use max to prevent READ_WRITE_END from being the same as READ_WRITE_EN_CYCLE_OFF + localparam READ_WRITE_END = `MAX(READ_WRITE_END_DEFAULT, READ_WRITE_EN_CYCLE_OFF + 1); + localparam HAS_DELAY = READ_WRITE_END_DEFAULT > READ_WRITE_EN_CYCLE_OFF; + + always @(posedge clk_memory) begin + if (read_state != 0) begin + read_state <= read_state + 1; + end + else if (~mem_empty) begin + // Start read + read_state <= READ_DELAY; + read_req <= 1; + end + + case (read_state) + READ_DELAY: begin + read_req <= 0; + write_en <= 0; + end + READ_WRITE: begin + // Read data is available + write_en <= 1; + // Lowest 28 bits are the address + write_addr <= fifo_out[27:0]; + write_data <= fifo_out[WORD_SIZE+27:28]; + read_req <= 0; + end + READ_WRITE_EN_CYCLE_OFF: begin + write_en <= 0; + if (!HAS_DELAY) begin + // No extra delay, immediately go back to start + read_state <= 0; + end + end + READ_WRITE_END: begin + read_state <= 0; + end + endcase + end + + initial begin + // Verify parameters + if (WRITE_MEM_CLOCK_DELAY < 4) begin + $error("WRITE_MEM_CLOCK_DELAY has a minimum value of 4. Received %d", WRITE_MEM_CLOCK_DELAY); + end + if (WRITE_MEM_EN_CYCLE_LENGTH < 1 || WRITE_MEM_EN_CYCLE_LENGTH >= WRITE_MEM_CLOCK_DELAY - 2) begin + $error("WRITE_MEM_EN_CYCLE_LENGTH must be between 1 and %d (inclusive, based off of WRITE_MEM_CLOCK_DELAY). Received %d", WRITE_MEM_CLOCK_DELAY - 2 - 1, WRITE_MEM_EN_CYCLE_LENGTH); + end + if (OUTPUT_WORD_SIZE < 1 || OUTPUT_WORD_SIZE > 2) begin + $error("OUTPUT_WORD_SIZE must be 1 or 2. Received %d", OUTPUT_WORD_SIZE); + end + end + +endmodule diff --git a/modules/pocket-dataloader/data_unloader.sv b/modules/pocket-dataloader/data_unloader.sv new file mode 100644 index 0000000..fba34e8 --- /dev/null +++ b/modules/pocket-dataloader/data_unloader.sv @@ -0,0 +1,257 @@ +// MIT License + +// Copyright (c) 2022 Adam Gastineau + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: + +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. + +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +//////////////////////////////////////////////////////////////////////////////// + +// A data unloader for consuming APF bridge reads, reading from some underlying memory, and supplying that data to APF +// +// This consumes four / OUTPUT_WORD_SIZE words (4 separate bytes, or 2 16-bit words) and sends APF 32 bit words. +// You can configure the cycle delay by setting READ_MEM_CLOCK_DELAY +module data_unloader #( + // Upper 4 bits of address + parameter ADDRESS_MASK_UPPER_4 = 0, + parameter ADDRESS_SIZE = 28, + + // Number of memory clock cycles it takes for a read to complete + parameter READ_MEM_CLOCK_DELAY = 1, + + // Word size in number of bytes. Can either be 1 (input 8 bits), or 2 (input 16 bits) + parameter INPUT_WORD_SIZE = 1 + ) ( + input wire clk_74a, + input wire clk_memory, + + input wire bridge_rd, + input wire bridge_endian_little, + input wire [31:0] bridge_addr, + output reg [31:0] bridge_rd_data = 0, + + // These outputs are synced to the memory clock + output reg read_en = 0, + output reg [ADDRESS_SIZE-1:0] read_addr = 0, + input wire [8 * INPUT_WORD_SIZE - 1:0] read_data + ); + + localparam WORD_SIZE = 8 * INPUT_WORD_SIZE; + + // APF address to memory FIFO + reg [27:0] fifo_address_in = 0; + reg address_read_req = 0; + reg address_write_req = 0; + wire address_empty; + + wire [27:0] fifo_address_out; + + dcfifo fifo_address_req ( + .data(fifo_address_in), + .rdclk(clk_memory), + .rdreq(address_read_req), + .wrclk(clk_74a), + .wrreq(address_write_req), + .q(fifo_address_out), + .rdempty(address_empty) + // .wrempty(), + // .aclr(), + // .eccstatus(), + // .rdfull(), + // .rdusedw(), + // .wrfull(), + // .wrusedw() + ); + defparam fifo_address_req.clocks_are_synchronized = "FALSE", + fifo_address_req.intended_device_family = "Cyclone V", fifo_address_req.lpm_numwords = 4, + fifo_address_req.lpm_showahead = "OFF", fifo_address_req.lpm_type = "dcfifo", + fifo_address_req.lpm_width = 28, fifo_address_req.lpm_widthu = 2, + fifo_address_req.overflow_checking = "OFF", fifo_address_req.rdsync_delaypipe = 5, + fifo_address_req.underflow_checking = "OFF", fifo_address_req.use_eab = "OFF", + fifo_address_req.wrsync_delaypipe = 5; + + // Memory output to APF FIFO + reg data_read_req = 0; + reg data_write_req = 0; + wire data_empty; + + reg [WORD_SIZE - 1:0] fifo_data_in = 0; + wire [WORD_SIZE - 1:0] fifo_data_out; + + dcfifo fifo_data_response ( + .data(fifo_data_in), + .rdclk(clk_74a), + .rdreq(data_read_req), + .wrclk(clk_memory), + .wrreq(data_write_req), + .q(fifo_data_out), + .rdempty(data_empty) + // .wrempty(), + // .aclr(), + // .eccstatus(), + // .rdfull(), + // .rdusedw(), + // .wrfull(), + // .wrusedw() + ); + defparam fifo_data_response.clocks_are_synchronized = "FALSE", + fifo_data_response.intended_device_family = "Cyclone V", fifo_data_response.lpm_numwords = 4, + fifo_data_response.lpm_showahead = "OFF", fifo_data_response.lpm_type = "dcfifo", + fifo_data_response.lpm_width = WORD_SIZE, fifo_data_response.lpm_widthu = 2, + fifo_data_response.overflow_checking = "OFF", fifo_data_response.rdsync_delaypipe = 5, + fifo_data_response.underflow_checking = "OFF", fifo_data_response.use_eab = "OFF", + fifo_data_response.wrsync_delaypipe = 5; + + /// APF side + + reg prev_bridge_rd = 0; + reg [2:0] addr_count = 0; + reg [2:0] addr_state = 0; + + localparam ADDR_START = 1; + localparam ADDR_REQ = 2; + + // Receive APF read addresses and buffer them into the memory clock domain + always @(posedge clk_74a) begin + prev_bridge_rd <= bridge_rd; + + if (~prev_bridge_rd && bridge_rd && bridge_addr[31:28] == ADDRESS_MASK_UPPER_4) begin + // Beginning APF read from core + addr_state <= ADDR_REQ; + address_write_req <= 1; + addr_count <= 0; + fifo_address_in <= bridge_addr[27:0]; + end + + case (addr_state) + ADDR_START: begin + address_write_req <= 1; + addr_state <= ADDR_REQ; + end + ADDR_REQ: begin + address_write_req <= 0; + fifo_address_in <= fifo_address_in + INPUT_WORD_SIZE; + addr_count <= addr_count + 1; + if (addr_count == (4 / INPUT_WORD_SIZE) - 1) begin + // Finished write + addr_count <= 0; + addr_state <= 0; + end + else begin + addr_state <= ADDR_START; + end + end + endcase + end + + reg [2:0] data_send_state = 0; + reg [2:0] apf_data_count = 0; + reg [31:0] apf_bridge_write_data = 0; + + wire [31:0] apf_final_data = {fifo_data_out, apf_bridge_write_data[31-WORD_SIZE:0]}; + + localparam READ_DATA_DELAY = 1; + localparam READ_DATA_WRITE = 2; + + // Receive data from memory and write to APF bridge + always @(posedge clk_74a) begin + if (data_send_state != 0) begin + data_send_state <= data_send_state + 1; + end + else if (~data_empty) begin + // Start data read + data_send_state <= READ_DATA_DELAY; + data_read_req <= 1; + + apf_data_count <= 0; + end + + case (data_send_state) + READ_DATA_DELAY: begin + data_read_req <= 0; + + // Shift current APF data + apf_bridge_write_data <= apf_bridge_write_data >> WORD_SIZE; + end + READ_DATA_WRITE: begin + // Data from memory is available + if (apf_data_count == (4 / INPUT_WORD_SIZE) - 1) begin + // We have all of the data we need, send to APF + bridge_rd_data <= bridge_endian_little ? apf_final_data : { + apf_final_data[7:0], apf_final_data[15:8], apf_final_data[23:16], apf_final_data[31:24] + }; + + data_send_state <= 0; + end + else begin + apf_bridge_write_data <= apf_final_data; + + data_read_req <= 1; + data_send_state <= READ_DATA_DELAY; + + apf_data_count <= apf_data_count + 1; + end + end + endcase + end + + /// Mem side + + reg [5:0] data_read_state = 0; + + localparam READ_ADDRESS_DELAY = 1; + localparam READ_MEM_START = 2; + localparam READ_MEM_COMPLETE = READ_MEM_START + READ_MEM_CLOCK_DELAY; + localparam READ_ADDRESS_END = READ_MEM_COMPLETE + 1; + + always @(posedge clk_memory) begin + if (data_read_state != 0) begin + data_read_state <= data_read_state + 1; + end + else if (~address_empty) begin + // Start address read + data_read_state <= READ_ADDRESS_DELAY; + address_read_req <= 1; + end + + case (data_read_state) + READ_ADDRESS_DELAY: begin + address_read_req <= 0; + end + READ_MEM_START: begin + // Address read data is available + read_en <= 1; + + read_addr <= fifo_address_out[ADDRESS_SIZE-1:0]; + end + READ_MEM_COMPLETE: begin + // We have data to send to APF + read_en <= 0; + + data_write_req <= 1; + fifo_data_in <= read_data; + end + READ_ADDRESS_END: begin + data_write_req <= 0; + + data_read_state <= 0; + end + endcase + end + +endmodule diff --git a/modules/pocket-dataloader/index.qip b/modules/pocket-dataloader/index.qip new file mode 100644 index 0000000..873f0c6 --- /dev/null +++ b/modules/pocket-dataloader/index.qip @@ -0,0 +1,2 @@ +set_global_assignment -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "data_loader.sv"] +set_global_assignment -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "data_unloader.sv"] diff --git a/modules/pocket-i2s/index.qip b/modules/pocket-i2s/index.qip new file mode 100644 index 0000000..f99c1f8 --- /dev/null +++ b/modules/pocket-i2s/index.qip @@ -0,0 +1 @@ +set_global_assignment -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "pocket_i2s.sv"] diff --git a/modules/pocket-i2s/pocket_i2s.sv b/modules/pocket-i2s/pocket_i2s.sv new file mode 100644 index 0000000..677385b --- /dev/null +++ b/modules/pocket-i2s/pocket_i2s.sv @@ -0,0 +1,165 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: MIT +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022 Adam Gastineau +//------------------------------------------------------------------------------ +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +//------------------------------------------------------------------------------ +// A very simple audio i2s bridge to APF, based on their example code +//------------------------------------------------------------------------------ + +module sound_i2s #( + parameter CHANNEL_WIDTH = 15, + parameter SIGNED_INPUT = 0 + ) ( + input wire clk_74a, + input wire clk_audio, + + // Left and Right channels. Can be in an arbitrary clock domain + input wire [CHANNEL_WIDTH - 1:0] audio_l, + input wire [CHANNEL_WIDTH - 1:0] audio_r, + + output reg audio_mclk, + output reg audio_lrck, + output reg audio_dac + ); + + // + // audio i2s generator + // + reg audgen_nextsamp; + + // generate MCLK = 12.288mhz with fractional accumulator + reg [21:0] audgen_accum = 0; + parameter [20:0] CYCLE_48KHZ = 21'd122880 * 2; + + always @(posedge clk_74a) begin + audgen_accum <= audgen_accum + CYCLE_48KHZ; + if (audgen_accum >= 21'd742500) begin + audio_mclk <= ~audio_mclk; + audgen_accum <= audgen_accum - 21'd742500 + CYCLE_48KHZ; + end + end + + // generate SCLK = 3.072mhz by dividing MCLK by 4 + reg [1:0] aud_mclk_divider; + reg prev_audio_mclk; + wire audgen_sclk = aud_mclk_divider[1] /* synthesis keep */; + + always @(posedge clk_74a) begin + if (audio_mclk && ~prev_audio_mclk) begin + aud_mclk_divider <= aud_mclk_divider + 1'b1; + end + + prev_audio_mclk <= audio_mclk; + end + + // Shift out audio data as I2S + // 32 total bits per channel, but only 16 active bits at the start and then 16 dummy bits + // + // Synchronize audio samples coming from the core + localparam CHANNEL_LEFT_HIGH = SIGNED_INPUT ? 16 : 15; + localparam CHANNEL_RIGHT_HIGH = 16 + CHANNEL_LEFT_HIGH; + + // Width of channel with signed component + localparam SIGNED_CHANNEL_WIDTH = SIGNED_INPUT ? CHANNEL_WIDTH : CHANNEL_WIDTH + 1; + + wire [31:0] audgen_sampdata; + + assign audgen_sampdata[CHANNEL_LEFT_HIGH-1:CHANNEL_LEFT_HIGH-CHANNEL_WIDTH] = audio_l; + assign audgen_sampdata[CHANNEL_RIGHT_HIGH-1:CHANNEL_RIGHT_HIGH-CHANNEL_WIDTH] = audio_r; + + generate + if (!SIGNED_INPUT) begin + // If not signed, make sure high bit is 0 + assign audgen_sampdata[31] = 0; + assign audgen_sampdata[15] = 0; + end + endgenerate + + generate + if (15 - SIGNED_CHANNEL_WIDTH > 0) begin + assign audgen_sampdata[31-SIGNED_CHANNEL_WIDTH:16] = 0; + assign audgen_sampdata[15-SIGNED_CHANNEL_WIDTH:0] = 0; + end + endgenerate + + sync_fifo #(.WIDTH(32)) + sync_fifo ( + .clk_write(clk_audio), + .clk_read (clk_74a), + + .write_en(write_en), + .data_in (audgen_sampdata), + .data_out(audgen_sampdata_s) + ); + + reg write_en = 0; + reg [CHANNEL_WIDTH - 1:0] prev_left; + reg [CHANNEL_WIDTH - 1:0] prev_right; + // Mark write when necessary + always @(posedge clk_audio) begin + prev_left <= audio_l; + prev_right <= audio_r; + + write_en <= 0; + + if (audio_l != prev_left || audio_r != prev_right) begin + write_en <= 1; + end + end + + wire [31:0] audgen_sampdata_s; + reg [31:0] audgen_sampshift; + reg [4:0] audio_lrck_cnt; + reg prev_audgen_sclk; + always @(posedge clk_74a) begin + if (prev_audgen_sclk && ~audgen_sclk) begin + audio_dac <= audgen_sampshift[31]; // Output the next bit + audio_lrck_cnt <= audio_lrck_cnt + 1'b1; // 48khz * 64 + if (audio_lrck_cnt == 31) begin + audio_lrck <= ~audio_lrck; // Switch channels + if (~audio_lrck) begin + audgen_sampshift <= audgen_sampdata_s; // Reload sample shifter + end + end + else if (audio_lrck_cnt < 16) begin + audgen_sampshift <= {audgen_sampshift[30:0], 1'b0}; // Only shift for 16 clocks per channel + end + end + + prev_audgen_sclk <= audgen_sclk; + end + + // Verify parameters + initial begin + if (CHANNEL_WIDTH > 16) begin + $error("CHANNEL_WIDTH must be <= 16. Received %d", CHANNEL_WIDTH); + end + + if (SIGNED_INPUT != 0 && SIGNED_INPUT != 1) begin + $error("SIGNED_INPUT must be 0 or 1. Received %d", SIGNED_INPUT); + end + + if (CHANNEL_WIDTH == 16 && SIGNED_INPUT == 0) begin + $error("Cannot have CHANNEL_WIDTH of 16 and an unsigned input"); + end + end + +endmodule diff --git a/modules/pocket-joypad/index.qip b/modules/pocket-joypad/index.qip new file mode 100644 index 0000000..05c286c --- /dev/null +++ b/modules/pocket-joypad/index.qip @@ -0,0 +1 @@ +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "joypad.v"] diff --git a/modules/pocket-joypad/joypad.v b/modules/pocket-joypad/joypad.v new file mode 100644 index 0000000..bec4800 --- /dev/null +++ b/modules/pocket-joypad/joypad.v @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: MPL-2.0 +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022 Marcus Andrade +//------------------------------------------------------------------------------ +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. +// +//------------------------------------------------------------------------------ +// Generic Gamepad interface for the Analogue Pocket +//------------------------------------------------------------------------------ + +module pocket_gamepad + ( + input iCLK, + input [15:0] iJOY, + + output wire PAD_U, + output wire PAD_D, + output wire PAD_L, + output wire PAD_R, + + output wire BTN_A, + output wire BTN_B, + output wire BTN_X, + output wire BTN_Y, + + output wire BTN_L1, + output wire BTN_R1, + + output wire BTN_L2, + output wire BTN_R2, + + output wire BTN_L3, + output wire BTN_R3, + + output wire BTN_SE, + output wire BTN_ST + ); + + assign PAD_U = joy_keys_s[0]; + assign PAD_D = joy_keys_s[1]; + assign PAD_L = joy_keys_s[2]; + assign PAD_R = joy_keys_s[3]; + + assign BTN_A = joy_keys_s[4]; + assign BTN_B = joy_keys_s[5]; + assign BTN_X = joy_keys_s[6]; + assign BTN_Y = joy_keys_s[7]; + + assign BTN_L1 = joy_keys_s[8]; + assign BTN_R1 = joy_keys_s[9]; + + assign BTN_L2 = joy_keys_s[10]; + assign BTN_R2 = joy_keys_s[11]; + + assign BTN_L3 = joy_keys_s[12]; + assign BTN_R3 = joy_keys_s[13]; + + assign BTN_SE = joy_keys_s[14]; + assign BTN_ST = joy_keys_s[15]; + + reg [15:0] joy_keys_s; + + // Sync Joystick to Core Clock + always @ (posedge iCLK) begin + joy_keys_s <= iJOY; + end + +endmodule diff --git a/modules/pocket-video/index.qip b/modules/pocket-video/index.qip new file mode 100644 index 0000000..5572fe2 --- /dev/null +++ b/modules/pocket-video/index.qip @@ -0,0 +1 @@ +set_global_assignment -name SYSTEMVERILOG_FILE [file join $::quartus(qip_path) "pocket_video.sv"] diff --git a/modules/pocket-video/pocket_video.sv b/modules/pocket-video/pocket_video.sv new file mode 100644 index 0000000..8dcbe14 --- /dev/null +++ b/modules/pocket-video/pocket_video.sv @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: MPL-2.0 +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022 Marcus Andrade +//------------------------------------------------------------------------------ +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at https://mozilla.org/MPL/2.0/. +// +//------------------------------------------------------------------------------ +// Generic Video Interface for the Analogue Pocket Display +// +// Note: APF scaler requires HSync and VSync to last for a single clock, and +// video_rgb to be 0 when video_de is low +//------------------------------------------------------------------------------ + +module pocket_video + ( + input iPCLK, //! Display Pixel Clock + input iPCLK_90D, //! Display Pixel Clock 90º Phase Shift + input [2:0] iPRESET, //! Video preset scaling configurations (up to 8) + + input [23:0] iRGB, //! Core: RGB Video + input iVS, //! Core: Vsync + input iHS, //! Core: Hsync + input iDE, //! Core: Data Enable + + output reg [23:0] oRGB, //! Pixel color: Red[23:16] Green[15:8] Blue[7:0] + output reg oVS, //! Frame Vsync Active high + output reg oHS, //! Frame Hsync Active high + output reg oDE, //! Data enable Active high + + output wire oPCLK, //! Display Pixel Clock + output wire oPCLK_90D //! Display Pixel Clock 90º Phase Shift + ); + + assign oPCLK = iPCLK; + assign oPCLK_90D = iPCLK_90D; + + reg [23:0] rRGB; + reg rHS; + reg rVS; + reg rDE; + + always @(posedge iPCLK) begin + oDE <= 0; + oRGB <= {8'b0, iPRESET, 13'b0}; + if (rDE) begin + oDE <= 1; + oRGB <= rRGB; + end + // Set HSync and VSync to be high for a single cycle on the rising edge of the HSync and VSync coming out of the core + oHS <= ~rHS && iHS; + oVS <= ~rVS && iVS; + rVS <= iVS; + rHS <= iHS; + rDE <= iDE; + rRGB <= iRGB; + end + +endmodule diff --git a/modules/sound-sn76489/COPYING b/modules/sound-sn76489/COPYING new file mode 100644 index 0000000..60549be --- /dev/null +++ b/modules/sound-sn76489/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/modules/sound-sn76489/README b/modules/sound-sn76489/README new file mode 100644 index 0000000..3363014 --- /dev/null +++ b/modules/sound-sn76489/README @@ -0,0 +1,143 @@ + +An SN76489AN Compatible Implementation in VHDL +============================================== +Version: $Date: 2006/06/18 19:28:40 $ + +Copyright (c) 2005, 2006, Arnim Laeuger (arnim.laeuger@gmx.net) +See the file COPYING. + + +Integration +----------- + +The sn76489 design exhibits all interface signals as the original chip. It +only differs in the audio data output which is provided as an 8 bit signed +vector instead of an analog output pin. + + generic ( + clock_div_16_g : integer := 1 + -- Set to '1' when operating the design in SN76489 mode. The primary clock + -- input is divided by 16 in this variant. The data sheet mentions the + -- SN76494 which contains a divide-by-2 clock input stage. Set the generic + -- to '0' to enable this mode. + ); + port ( + clock_i : in std_logic; + -- Primary clock input + -- Drive with the target frequency or any integer multiple of it. + + clock_en_i : in std_logic; + -- Clock enable + -- A '1' on this input qualifies a valid rising edge on clock_i. A '0' + -- disables the next rising clock edge, effectivley halting the design + -- until the next enabled rising clock edge. + -- Can be used to run the core at lower frequencies than applied on + -- clock_i. + + res_n_i : in std_logic; + -- Asynchronous low active reset input. + -- Sets all sequential elements to a known state. + + ce_n_i : in std_logic; + -- Chip enable, low active. + + we_n_i : in std_logic; + -- Write enable, low active. + + ready_o : out std_logic; + -- Ready indication to microprocessor. + + d_i : in std_logic_vector(0 to 7); + -- Data input + -- MSB 0 ... 7 LSB + + aout_o : out signed(0 to 7) + -- Audio output, signed vector + -- MSB/SIGN 0 ... 7 LSB + ); + + +Both 8 bit vector ports are defined (0 to 7) which declares bit 0 to be the +MSB and bit 7 to be the LSB. This has been implemented according to TI's data +sheet, thus all register/data format figures apply 1:1 for this design. +Many systems will flip the system data bus bit wise before it is connected to +this PSG. This is simply achieved with the following VHDL construct: + + signal data_s : std_logic_vector(7 downto 0); + + ... + d_i => data_s, + ... + +d_i and data_s will be assigned from left to right, resulting in the expected +bit assignment: + + d_i data_s + 0 7 + 1 6 + ... + 6 1 + 7 0 + + +As this design is fully synchronous, care has to be taken when the design +replaces an SN76489 in asynchronous mode. No problems are expected when +interfacing the code to other synchronous components. + + +Design Hierarchy +---------------- + + sn76489_top + | + +-- sn76489_latch_ctrl + | + +-- sn76489_clock_div + | + +-- sn76489_tone + | | + | \-- sn76489_attentuator + | + +-- sn76489_tone + | | + | \-- sn76489_attentuator + | + +-- sn76489_tone + | | + | \-- sn76489_attentuator + | + \-- sn76489_noise + | + \-- sn76489_attentuator + +Resulting compilation sequence: + + sn76489_comp_pack-p.vhd + sn76489_top.vhd + sn76489_latch_ctrl.vhd + sn76489_latch_ctrl-c.vhd + sn76489_clock_div.vhd + sn76489_clock_div-c.vhd + sn76489_attenuator.vhd + sn76489_attenuator-c.vhd + sn76489_tone.vhd + sn76489_tone-c.vhd + sn76489_noise.vhd + sn76489_noise-c.vhd + sn76489_top-c.vhd + +Skip the files containing VHDL configurations when analyzing the code for +synthesis. + + +References +---------- + +* TI Data sheet SN76489.pdf + ftp://ftp.whtech.com/datasheets%20&%20manuals/SN76489.pdf + +* John Kortink's article on the SN76489: + http://web.inter.nl.net/users/J.Kortink/home/articles/sn76489/ + +* Maxim's "SN76489 notes" in + http://www.smspower.org/maxim/docs/SN76489.txt diff --git a/modules/sound-sn76489/index.qip b/modules/sound-sn76489/index.qip new file mode 100644 index 0000000..e6903c6 --- /dev/null +++ b/modules/sound-sn76489/index.qip @@ -0,0 +1,6 @@ +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) sn76489_top.vhd] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) sn76489_attenuator.vhd] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) sn76489_clock_div.vhd] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) sn76489_latch_ctrl.vhd] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) sn76489_noise.vhd] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) sn76489_tone.vhd] diff --git a/modules/sound-sn76489/sn76489_attenuator.vhd b/modules/sound-sn76489/sn76489_attenuator.vhd new file mode 100644 index 0000000..a7013b2 --- /dev/null +++ b/modules/sound-sn76489/sn76489_attenuator.vhd @@ -0,0 +1,87 @@ +------------------------------------------------------------------------------- +-- +-- Synthesizable model of TI's SN76489AN. +-- +-- $Id: sn76489_attenuator.vhd,v 1.7 2006/02/27 20:30:10 arnim Exp $ +-- +-- Attenuator Module +-- +------------------------------------------------------------------------------- +-- +-- Copyright (c) 2005, 2006, Arnim Laeuger (arnim.laeuger@gmx.net) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +------------------------------------------------------------------------------- + +library ieee; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; + +entity sn76489_attenuator is + + port ( + attenuation_i : in std_logic_vector(0 to 3); + factor_i : in std_logic; + product_o : out std_logic_vector(0 to 7) + ); + +end sn76489_attenuator; + + +architecture rtl of sn76489_attenuator is + type volume_t is array (natural range 0 to 15) of natural; + constant volume_c : volume_t := (31, 25, 20, 16, 12, 10, 8, 6, 5, 4, 3, 2, 2, 2, 1, 0); +begin + + ----------------------------------------------------------------------------- + -- Process attenuate + -- + -- Purpose: + -- Determine the attenuation and generate the resulting product. + -- + -- The maximum attenuation value is 31 which corresponds to volume off. + -- As described in the data sheet, the maximum "playing" attenuation is + -- 28 = 16 + 8 + 4 + -- + -- The table for the volume constants is derived from the following + -- formula (each step is 2dB voltage): + -- v(0) = 31 + -- v(n+1) = v(n) * 0.79432823 + -- + + product_o <= conv_std_logic_vector(volume_c(conv_integer(attenuation_i)), product_o'length) when factor_i = '1' + else (others => '0'); + +end rtl; diff --git a/modules/sound-sn76489/sn76489_clock_div.vhd b/modules/sound-sn76489/sn76489_clock_div.vhd new file mode 100644 index 0000000..65a01da --- /dev/null +++ b/modules/sound-sn76489/sn76489_clock_div.vhd @@ -0,0 +1,136 @@ +------------------------------------------------------------------------------- +-- +-- Synthesizable model of TI's SN76489AN. +-- +-- $Id: sn76489_clock_div.vhd,v 1.4 2005/10/10 21:51:27 arnim Exp $ +-- +-- Clock Divider Circuit +-- +------------------------------------------------------------------------------- +-- +-- Copyright (c) 2005, Arnim Laeuger (arnim.laeuger@gmx.net) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +------------------------------------------------------------------------------- + +library ieee; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; + +entity sn76489_clock_div is + + generic ( + clock_div_16_g : integer := 1 + ); + port ( + clock_i : in std_logic; + clock_en_i : in std_logic; + res_n_i : in std_logic; + clk_en_o : out boolean + ); + +end sn76489_clock_div; + + +library ieee; +use ieee.numeric_std.all; + +architecture rtl of sn76489_clock_div is + + signal cnt_s, + cnt_q : std_logic_vector(3 downto 0); + +begin + + ----------------------------------------------------------------------------- + -- Process seq + -- + -- Purpose: + -- Implements the sequential counter element. + -- + seq: process (clock_i, res_n_i) + begin + if res_n_i = '0' then + cnt_q <= (others => '0'); + elsif clock_i'event and clock_i = '1' then + cnt_q <= cnt_s; + end if; + end process seq; + -- + ----------------------------------------------------------------------------- + + + ----------------------------------------------------------------------------- + -- Process comb + -- + -- Purpose: + -- Implements the combinational counter logic. + -- + comb: process (clock_en_i, + cnt_q) + begin + -- default assignments + cnt_s <= cnt_q; + clk_en_o <= false; + + if clock_en_i = '1' then + + if cnt_q = 0 then + clk_en_o <= true; + + if clock_div_16_g = 1 then + cnt_s <= conv_std_logic_vector(15, cnt_q'length); + elsif clock_div_16_g = 0 then + cnt_s <= conv_std_logic_vector( 1, cnt_q'length); + else + -- pragma translate_off + assert false + report "Generic clock_div_16_g must be either 0 or 1." + severity failure; + -- pragma translate_on + end if; + + else + cnt_s <= cnt_q - 1; + + end if; + + end if; + + end process comb; + -- + ----------------------------------------------------------------------------- + +end rtl; diff --git a/modules/sound-sn76489/sn76489_latch_ctrl.vhd b/modules/sound-sn76489/sn76489_latch_ctrl.vhd new file mode 100644 index 0000000..2fcf5bb --- /dev/null +++ b/modules/sound-sn76489/sn76489_latch_ctrl.vhd @@ -0,0 +1,146 @@ +------------------------------------------------------------------------------- +-- +-- Synthesizable model of TI's SN76489AN. +-- +-- $Id: sn76489_latch_ctrl.vhd,v 1.6 2006/02/27 20:30:10 arnim Exp $ +-- +-- Latch Control Unit +-- +------------------------------------------------------------------------------- +-- +-- Copyright (c) 2005, 2006, Arnim Laeuger (arnim.laeuger@gmx.net) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +------------------------------------------------------------------------------- + +library ieee; +use ieee.std_logic_1164.all; + +entity sn76489_latch_ctrl is + + port ( + clock_i : in std_logic; + clk_en_i : in boolean; + res_n_i : in std_logic; + ce_n_i : in std_logic; + we_n_i : in std_logic; + d_i : in std_logic_vector(0 to 7); + ready_o : out std_logic; + tone1_we_o : out boolean; + tone2_we_o : out boolean; + tone3_we_o : out boolean; + noise_we_o : out boolean; + r2_o : out std_logic + ); + +end sn76489_latch_ctrl; + + +library ieee; +use ieee.numeric_std.all; + +architecture rtl of sn76489_latch_ctrl is + + signal reg_q : std_logic_vector(0 to 2); + signal we_q : boolean; + signal ready_q : std_logic; + signal we_n_d : std_logic; + +begin + + ----------------------------------------------------------------------------- + -- Process seq + -- + -- Purpose: + -- Implements the sequential elements. + -- + seq: process (clock_i, res_n_i) + begin + if res_n_i = '0' then + reg_q <= (others => '0'); + we_q <= false; + ready_q <= '0'; + we_n_d <= '1'; + + elsif clock_i'event and clock_i = '1' then + if clk_en_i then + we_n_d <= we_n_i; + elsif we_n_i = '1' then + we_n_d <= '1'; + end if; + + -- READY Flag Output ---------------------------------------------------- + if ready_q = '0' and we_q then + if clk_en_i then + -- assert READY when write access happened + ready_q <= '1'; + end if; + elsif ce_n_i = '1' then + -- deassert READY when access has finished + ready_q <= '0'; + end if; + + -- Register Selection --------------------------------------------------- + if clk_en_i then + if ce_n_i = '0' and we_n_d = '1' and we_n_i = '0' then + if d_i(0) = '1' then + reg_q <= d_i(1 to 3); + end if; + we_q <= true; + else + we_q <= false; + end if; + end if; + + end if; + end process seq; + -- + ----------------------------------------------------------------------------- + + + ----------------------------------------------------------------------------- + -- Output mapping + ----------------------------------------------------------------------------- + tone1_we_o <= reg_q(0 to 1) = "00" and we_q; + tone2_we_o <= reg_q(0 to 1) = "01" and we_q; + tone3_we_o <= reg_q(0 to 1) = "10" and we_q; + noise_we_o <= reg_q(0 to 1) = "11" and we_q; + + r2_o <= reg_q(2); + + ready_o <= ready_q + when ce_n_i = '0' else + '1'; + +end rtl; diff --git a/modules/sound-sn76489/sn76489_noise.vhd b/modules/sound-sn76489/sn76489_noise.vhd new file mode 100644 index 0000000..f3a7527 --- /dev/null +++ b/modules/sound-sn76489/sn76489_noise.vhd @@ -0,0 +1,267 @@ +------------------------------------------------------------------------------- +-- +-- Synthesizable model of TI's SN76489AN. +-- +-- $Id: sn76489_noise.vhd,v 1.6 2006/02/27 20:30:10 arnim Exp $ +-- +-- Noise Generator +-- +------------------------------------------------------------------------------- +-- +-- Copyright (c) 2005, 2006, Arnim Laeuger (arnim.laeuger@gmx.net) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +------------------------------------------------------------------------------- + +library ieee; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; + +entity sn76489_noise is + + port ( + clock_i : in std_logic; + clk_en_i : in boolean; + res_n_i : in std_logic; + we_i : in boolean; + d_i : in std_logic_vector(0 to 7); + r2_i : in std_logic; + tone3_ff_i : in std_logic; + noise_o : out std_logic_vector(0 to 7) + ); + +end sn76489_noise; + + +architecture rtl of sn76489_noise is + + signal nf_q : std_logic_vector(0 to 1); + signal fb_q : std_logic; + signal a_q : std_logic_vector(0 to 3); + signal freq_cnt_q : std_logic_vector(0 to 6); + signal freq_ff_q : std_logic; + + signal shift_source_s, + shift_source_q : std_logic; + signal shift_rise_edge_s : boolean; + + signal lfsr_q : std_logic_vector(0 to 14); + +begin + + ----------------------------------------------------------------------------- + -- Process cpu_regs + -- + -- Purpose: + -- Implements the registers writable by the CPU. + -- + cpu_regs: process (clock_i, res_n_i) + begin + if res_n_i = '0' then + nf_q <= (others => '0'); + fb_q <= '0'; + a_q <= (others => '1'); + + elsif clock_i'event and clock_i = '1' then + if clk_en_i and we_i then + if r2_i = '0' then + -- access to control register + -- both access types can write to the control register! + nf_q <= d_i(6 to 7); + fb_q <= d_i(5); + + else + -- access to attenuator register + -- both access types can write to the attenuator register! + a_q <= d_i(4 to 7); + + end if; + end if; + end if; + end process cpu_regs; + -- + ----------------------------------------------------------------------------- + + + ----------------------------------------------------------------------------- + -- Process freq_gen + -- + -- Purpose: + -- Implements the frequency generation components. + -- + freq_gen: process (clock_i, res_n_i) + begin + if res_n_i = '0' then + freq_cnt_q <= (others => '0'); + freq_ff_q <= '0'; + + elsif clock_i'event and clock_i = '1' then + if clk_en_i then + if freq_cnt_q = 0 then + -- reload frequency counter according to NF setting + case nf_q is + when "00" => + freq_cnt_q <= conv_std_logic_vector(16 * 2 - 1, freq_cnt_q'length); + when "01" => + freq_cnt_q <= conv_std_logic_vector(16 * 4 - 1, freq_cnt_q'length); + when "10" => + freq_cnt_q <= conv_std_logic_vector(16 * 8 - 1, freq_cnt_q'length); + when others => + null; + end case; + + freq_ff_q <= not freq_ff_q; + + else + -- decrement frequency counter + freq_cnt_q <= freq_cnt_q - 1; + + end if; + + end if; + end if; + end process freq_gen; + -- + ----------------------------------------------------------------------------- + + + ----------------------------------------------------------------------------- + -- Multiplex the source of the LFSR's shift enable + ----------------------------------------------------------------------------- + shift_source_s <= tone3_ff_i + when nf_q = "11" else + freq_ff_q; + + ----------------------------------------------------------------------------- + -- Process rise_edge + -- + -- Purpose: + -- Detect the rising edge of the selected LFSR shift source. + -- + rise_edge: process (clock_i, res_n_i) + begin + if res_n_i = '0' then + shift_source_q <= '0'; + + elsif clock_i'event and clock_i = '1' then + if clk_en_i then + shift_source_q <= shift_source_s; + end if; + end if; + end process rise_edge; + -- + ----------------------------------------------------------------------------- + + -- detect rising edge on shift source + shift_rise_edge_s <= shift_source_q = '0' and shift_source_s = '1'; + + + ----------------------------------------------------------------------------- + -- Process lfsr + -- + -- Purpose: + -- Implements the LFSR that generates noise. + -- Note: This implementation shifts the register right, i.e. from index + -- 15 towards 0 => bit 15 is the input, bit 0 is the output + -- + -- Tapped bits according to MAME's sn76496.c, implemented in function + -- lfsr_tapped_f. + -- + lfsr: process (clock_i, res_n_i) + + function lfsr_tapped_f(lfsr : in std_logic_vector) return std_logic is + constant tapped_bits_c : std_logic_vector(0 to 14) + -- tapped bits are 0, 2, 15 + := "110000000000000"; + variable parity_v : std_logic; + begin + parity_v := '0'; + + for idx in lfsr'low to lfsr'high loop + parity_v := parity_v xor (lfsr(idx) and tapped_bits_c(idx)); + end loop; + + return parity_v; + end; + + begin + if res_n_i = '0' then + -- reset LFSR to "0000000000000001" + lfsr_q <= (others => '0'); + lfsr_q(lfsr_q'right) <= '1'; + + elsif clock_i'event and clock_i = '1' then + if clk_en_i then + if we_i and r2_i = '0' then + -- write to noise register + -- -> reset LFSR + lfsr_q <= (others => '0'); + lfsr_q(lfsr_q'right) <= '1'; + + elsif shift_rise_edge_s then + + -- shift LFSR left towards MSB + for idx in lfsr_q'right-1 downto lfsr_q'left loop + lfsr_q(idx) <= lfsr_q(idx+1); + end loop; + + -- determine input bit + if fb_q = '0' then + -- "Periodic" Noise + -- -> input to LFSR is output + lfsr_q(lfsr_q'right) <= lfsr_q(lfsr_q'left); + else + -- "White" Noise + -- -> input to LFSR is parity of tapped bits + lfsr_q(lfsr_q'right) <= lfsr_tapped_f(lfsr_q); + end if; + + end if; + + end if; + end if; + end process lfsr; + + ----------------------------------------------------------------------------- + -- The attenuator itself + ----------------------------------------------------------------------------- + attenuator_b : entity work.sn76489_attenuator + port map ( + attenuation_i => a_q, + factor_i => lfsr_q(0), + product_o => noise_o + ); + +end rtl; diff --git a/modules/sound-sn76489/sn76489_tone.vhd b/modules/sound-sn76489/sn76489_tone.vhd new file mode 100644 index 0000000..5edc8a4 --- /dev/null +++ b/modules/sound-sn76489/sn76489_tone.vhd @@ -0,0 +1,182 @@ +------------------------------------------------------------------------------- +-- +-- Synthesizable model of TI's SN76489AN. +-- +-- $Id: sn76489_tone.vhd,v 1.5 2006/02/27 20:30:10 arnim Exp $ +-- +-- Tone Generator +-- +------------------------------------------------------------------------------- +-- +-- Copyright (c) 2005, 2006, Arnim Laeuger (arnim.laeuger@gmx.net) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +------------------------------------------------------------------------------- + +library ieee; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; + +entity sn76489_tone is + + port ( + clock_i : in std_logic; + clk_en_i : in boolean; + res_n_i : in std_logic; + we_i : in boolean; + d_i : in std_logic_vector(0 to 7); + r2_i : in std_logic; + ff_o : out std_logic; + tone_o : out std_logic_vector(0 to 7) + ); + +end sn76489_tone; + +architecture rtl of sn76489_tone is + + signal f_q : std_logic_vector(0 to 9); + signal a_q : std_logic_vector(0 to 3); + signal freq_cnt_q : std_logic_vector(0 to 9); + signal freq_ff_q : std_logic; + signal output_ff : std_logic; + + function all_zero(a : in std_logic_vector) return boolean is + variable result_v : boolean; + begin + result_v := true; + + for idx in a'low to a'high loop + if a(idx) /= '0' then + result_v := false; + end if; + end loop; + + return result_v; + end; + +begin + + ----------------------------------------------------------------------------- + -- Process cpu_regs + -- + -- Purpose: + -- Implements the registers writable by the CPU. + -- + cpu_regs: process (clock_i, res_n_i) + begin + if res_n_i = '0' then + f_q <= (others => '0'); + a_q <= (others => '1'); + + elsif clock_i'event and clock_i = '1' then + if clk_en_i and we_i then + if r2_i = '0' then + -- access to frequency register + if d_i(0) = '0' then + f_q(0 to 5) <= d_i(2 to 7); + else + f_q(6 to 9) <= d_i(4 to 7); + end if; + + else + -- access to attenuator register + -- both access types can write to the attenuator register! + a_q <= d_i(4 to 7); + + end if; + end if; + end if; + end process cpu_regs; + -- + ----------------------------------------------------------------------------- + + + ----------------------------------------------------------------------------- + -- Process freq_gen + -- + -- Purpose: + -- Implements the frequency generation components. + -- + freq_gen: process (clock_i, res_n_i) + begin + if res_n_i = '0' then + freq_cnt_q <= (others => '0'); + freq_ff_q <= '0'; + output_ff <= '0'; + + elsif clock_i'event and clock_i = '1' then + if clk_en_i then + if freq_cnt_q = 1 then + -- update counter from frequency register + freq_cnt_q <= f_q; + + -- and toggle the frequency flip-flop if enabled + if (f_q > 5) then + freq_ff_q <= not freq_ff_q; + else + -- if frequency setting is 0, then keep flip-flop at +1 + freq_ff_q <= '1'; + end if; + + -- either way toggle the output_ff - this is used to clock noise + output_ff <= not output_ff; + + else + -- decrement frequency counter + freq_cnt_q <= freq_cnt_q - 1; + + end if; + end if; + end if; + end process freq_gen; + + + ----------------------------------------------------------------------------- + -- The attenuator itself + ----------------------------------------------------------------------------- + attenuator_b : entity work.sn76489_attenuator + port map ( + attenuation_i => a_q, + factor_i => freq_ff_q, + product_o => tone_o + ); + + + ----------------------------------------------------------------------------- + -- Output mapping + ----------------------------------------------------------------------------- + ff_o <= output_ff; + +end rtl; diff --git a/modules/sound-sn76489/sn76489_top.vhd b/modules/sound-sn76489/sn76489_top.vhd new file mode 100644 index 0000000..de3f34a --- /dev/null +++ b/modules/sound-sn76489/sn76489_top.vhd @@ -0,0 +1,202 @@ +------------------------------------------------------------------------------- +-- +-- Synthesizable model of TI's SN76489AN. +-- +-- $Id: sn76489_top.vhd,v 1.9 2006/02/27 20:30:10 arnim Exp $ +-- +-- Chip Toplevel +-- +-- References: +-- +-- * TI Data sheet SN76489.pdf +-- ftp://ftp.whtech.com/datasheets%20&%20manuals/SN76489.pdf +-- +-- * John Kortink's article on the SN76489: +-- http://web.inter.nl.net/users/J.Kortink/home/articles/sn76489/ +-- +-- * Maxim's "SN76489 notes" in +-- http://www.smspower.org/maxim/docs/SN76489.txt +-- +------------------------------------------------------------------------------- +-- +-- Copyright (c) 2005, 2006, Arnim Laeuger (arnim.laeuger@gmx.net) +-- +-- All rights reserved +-- +-- Redistribution and use in source and synthezised forms, with or without +-- modification, are permitted provided that the following conditions are met: +-- +-- Redistributions of source code must retain the above copyright notice, +-- this list of conditions and the following disclaimer. +-- +-- Redistributions in synthesized form must reproduce the above copyright +-- notice, this list of conditions and the following disclaimer in the +-- documentation and/or other materials provided with the distribution. +-- +-- Neither the name of the author nor the names of other contributors may +-- be used to endorse or promote products derived from this software without +-- specific prior written permission. +-- +-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE +-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +-- POSSIBILITY OF SUCH DAMAGE. +-- +-- Please report bugs to the author, but before you do so, please +-- make sure that this is not a derivative work and that +-- you have the latest version of this file. +-- +------------------------------------------------------------------------------- + +library ieee; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.STD_LOGIC_ARITH.ALL; +use IEEE.STD_LOGIC_UNSIGNED.ALL; + +entity sn76489_top is + + generic ( + clock_div_16_g : integer := 1 + ); + port ( + clock_i : in std_logic; + clock_en_i : in std_logic; + res_n_i : in std_logic; + ce_n_i : in std_logic; + we_n_i : in std_logic; + ready_o : out std_logic; + d_i : in std_logic_vector(0 to 7); + aout_o : out std_logic_vector(0 to 7) + ); + +end sn76489_top; + + +library ieee; +use ieee.numeric_std.all; + +architecture struct of sn76489_top is + + signal clk_en_s : boolean; + + signal tone1_we_s, + tone2_we_s, + tone3_we_s, + noise_we_s : boolean; + signal r2_s : std_logic; + + signal tone1_s, + tone2_s, + tone3_s, + noise_s : std_logic_vector(0 to 7); + + signal tone3_ff_s : std_logic; + +begin + + ----------------------------------------------------------------------------- + -- Clock Divider + ----------------------------------------------------------------------------- + clock_div_b : entity work.sn76489_clock_div + generic map ( + clock_div_16_g => clock_div_16_g + ) + port map ( + clock_i => clock_i, + clock_en_i => clock_en_i, + res_n_i => res_n_i, + clk_en_o => clk_en_s + ); + + + ----------------------------------------------------------------------------- + -- Latch Control = CPU Interface + ----------------------------------------------------------------------------- + latch_ctrl_b : entity work.sn76489_latch_ctrl + port map ( + clock_i => clock_i, + clk_en_i => clk_en_s, + res_n_i => res_n_i, + ce_n_i => ce_n_i, + we_n_i => we_n_i, + d_i => d_i, + ready_o => ready_o, + tone1_we_o => tone1_we_s, + tone2_we_o => tone2_we_s, + tone3_we_o => tone3_we_s, + noise_we_o => noise_we_s, + r2_o => r2_s + ); + + + ----------------------------------------------------------------------------- + -- Tone Channel 1 + ----------------------------------------------------------------------------- + tone1_b : entity work.sn76489_tone + port map ( + clock_i => clock_i, + clk_en_i => clk_en_s, + res_n_i => res_n_i, + we_i => tone1_we_s, + d_i => d_i, + r2_i => r2_s, + ff_o => open, + tone_o => tone1_s + ); + + ----------------------------------------------------------------------------- + -- Tone Channel 2 + ----------------------------------------------------------------------------- + tone2_b : entity work.sn76489_tone + port map ( + clock_i => clock_i, + clk_en_i => clk_en_s, + res_n_i => res_n_i, + we_i => tone2_we_s, + d_i => d_i, + r2_i => r2_s, + ff_o => open, + tone_o => tone2_s + ); + + ----------------------------------------------------------------------------- + -- Tone Channel 3 + ----------------------------------------------------------------------------- + tone3_b : entity work.sn76489_tone + port map ( + clock_i => clock_i, + clk_en_i => clk_en_s, + res_n_i => res_n_i, + we_i => tone3_we_s, + d_i => d_i, + r2_i => r2_s, + ff_o => tone3_ff_s, + tone_o => tone3_s + ); + + ----------------------------------------------------------------------------- + -- Noise Channel + ----------------------------------------------------------------------------- + noise_b : entity work.sn76489_noise + port map ( + clock_i => clock_i, + clk_en_i => clk_en_s, + res_n_i => res_n_i, + we_i => noise_we_s, + d_i => d_i, + r2_i => r2_s, + tone3_ff_i => tone3_ff_s, + noise_o => noise_s + ); + + + aout_o <= tone1_s + tone2_s + tone3_s + noise_s; + +end struct; diff --git a/modules/video-scanlines/index.qip b/modules/video-scanlines/index.qip new file mode 100644 index 0000000..7dad3f7 --- /dev/null +++ b/modules/video-scanlines/index.qip @@ -0,0 +1,6 @@ +# ============================================================================== +# Quartus Prime QIP Index File +# ============================================================================== +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "scanlines_top.v"] +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "scanlines_horizontal.v"] +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "scanlines_vertical.v"] diff --git a/modules/video-scanlines/scanlines_horizontal.v b/modules/video-scanlines/scanlines_horizontal.v new file mode 100644 index 0000000..394cb41 --- /dev/null +++ b/modules/video-scanlines/scanlines_horizontal.v @@ -0,0 +1,107 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +//------------------------------------------------------------------------------ +// +// Copyright (c) 2022 OpenGateware authors and contributors +// Copyright (c) 2017 Alexey Melnikov +// Copyright (c) 2015 Till Harbaum +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +//------------------------------------------------------------------------------ +// Generic Video Scanlines +//------------------------------------------------------------------------------ + +module scanlines_horizontal #( + parameter v2 = 0 //! Enable Scanlines V2 + ) ( + input iPCLK, //! Pixel Clock + + input [1:0] iSCANLINES, //! Scanlines (00-None / 01-25% / 10-50% / 11-75%) + input [23:0] iRGB, //! Core: RGB Video + input iHS, //! Core: Vsync + input iVS, //! Core: Hsync + input iDE, //! Core: Data Enable + input iCE, //! Core: Clock Enable + + output reg [23:0] oRGB, //! Video Ouput: RGB Video + output reg oHS, //! Video Ouput: Vsync + output reg oVS, //! Video Ouput: Hsync + output reg oDE, //! Video Ouput: Data Enable + output reg oCE //! Video Ouput: Clock Enable + ); + + reg [1:0] rSCANLINE; //! Scanline Register + always @(posedge iPCLK) begin + reg rOLD_HS, rOLD_VS; + + rOLD_HS <= iHS; rOLD_VS <= iVS; + + if(rOLD_HS && ~iHS) begin + if(v2) begin + rSCANLINE <= rSCANLINE + 1'd1; + if (rSCANLINE == iSCANLINES) + rSCANLINE <= 0; + end + else + rSCANLINE <= rSCANLINE ^ iSCANLINES; + end + if(rOLD_VS && ~iVS) rSCANLINE <= 0; + end + + wire [7:0] r,g,b; //! RGB Signals + assign {r,g,b} = iRGB; + + reg [23:0] rgb_d; //! RGB Data + always @(*) begin + case(rSCANLINE) + 1: //! 25% = 1/2 + 1/4 + rgb_d = { + {1'b0, r[7:1]} + {2'b0, r[7:2]}, + {1'b0, g[7:1]} + {2'b0, g[7:2]}, + {1'b0, b[7:1]} + {2'b0, b[7:2]} + }; + 2: //! 50% = 1/2 + rgb_d = { + {1'b0, r[7:1]}, + {1'b0, g[7:1]}, + {1'b0, b[7:1]} + }; + 3: //! 75% = 1/4 + rgb_d = { + {2'b0, r[7:2]}, + {2'b0, g[7:2]}, + {2'b0, b[7:2]} + }; + default: + rgb_d = {r, g, b}; + endcase + end + + always @(posedge iPCLK) begin + reg [23:0] rgb1, rgb2; + reg de1, de2; + reg vs1, vs2; + reg hs1, hs2; + reg ce1, ce2; + + oRGB <= rgb2; rgb2 <= rgb1; rgb1 <= rgb_d; + oVS <= vs2; vs2 <= vs1; vs1 <= iVS; + oHS <= hs2; hs2 <= hs1; hs1 <= iHS; + oDE <= de2; de2 <= de1; de1 <= iDE; + oCE <= ce2; ce2 <= ce1; ce1 <= iCE; + end + +endmodule diff --git a/modules/video-scanlines/scanlines_top.v b/modules/video-scanlines/scanlines_top.v new file mode 100644 index 0000000..fceb1fb --- /dev/null +++ b/modules/video-scanlines/scanlines_top.v @@ -0,0 +1,100 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +//------------------------------------------------------------------------------ +// +// Copyright (c) 2022 OpenGateware authors and contributors +// Copyright (c) 2017 Alexey Melnikov +// Copyright (c) 2015 Till Harbaum +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +//------------------------------------------------------------------------------ +// Generic Video Scanlines +// H Soft - 25% - b0001 d1 +// H Medium - 50% - b0010 d2 +// H Hard - 75% - b0011 d3 + +// V Soft - 25% - b0100 d4 +// V Medium - 50% - b1000 d8 +// V Hard - 75% - b1100 d12 + +// HV Soft - 25% - b0101 d5 +// HV Medium - 50% - b1010 d10 +// HV Hard - 75% - b1111 d15 +//------------------------------------------------------------------------------ + +module scanlines ( + input iPCLK, //! Pixel Clock + + input [3:0] iSCANLINES, //! Scanlines + + input [23:0] iRGB, //! Core: RGB Video + input iVS, //! Core: Hsync + input iHS, //! Core: Vsync + input iDE, //! Core: Data Enable + + output reg [23:0] oRGB, //! Video Ouput: RGB Video + output reg oVS, //! Video Ouput: Hsync + output reg oHS, //! Video Ouput: Vsync + output reg oDE //! Video Ouput: Data Enable + ); + + wire [23:0] h_video_rgb, v_video_rgb; + wire h_video_de, v_video_de; + wire h_video_vs, v_video_vs; + wire h_video_hs, v_video_hs; + wire [1:0] hscanlines = iSCANLINES[1:0]; + wire [1:0] vscanlines = iSCANLINES[3:2]; + + scanlines_horizontal sh + ( + .iPCLK ( iPCLK ), + .iSCANLINES ( hscanlines ), + + .iRGB ( iRGB ), + .iVS ( iVS ), + .iHS ( iHS ), + .iDE ( iDE ), + + .oRGB ( h_video_rgb ), + .oVS ( h_video_vs ), + .oHS ( h_video_hs ), + .oDE ( h_video_de ) + ); + + scanlines_vertical sv + ( + .iPCLK ( iPCLK ), + .iSCANLINES ( vscanlines ), + + .iRGB ( h_video_rgb ), + .iVS ( h_video_vs ), + .iHS ( h_video_hs ), + .iDE ( h_video_de ), + + .oRGB ( v_video_rgb ), + .oVS ( v_video_vs ), + .oHS ( v_video_hs ), + .oDE ( v_video_de ) + ); + + always @(posedge iPCLK) begin + oRGB <= v_video_rgb; + oHS <= v_video_hs; + oVS <= v_video_vs; + oDE <= v_video_de; + end + +endmodule diff --git a/modules/video-scanlines/scanlines_vertical.v b/modules/video-scanlines/scanlines_vertical.v new file mode 100644 index 0000000..a6c6012 --- /dev/null +++ b/modules/video-scanlines/scanlines_vertical.v @@ -0,0 +1,105 @@ +//------------------------------------------------------------------------------ +// SPDX-License-Identifier: GPL-3.0-or-later +// SPDX-FileType: SOURCE +// SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +//------------------------------------------------------------------------------ +// +// Copyright (c) 2022 OpenGateware authors and contributors +// Copyright (c) 2017 Alexey Melnikov +// Copyright (c) 2015 Till Harbaum +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 3. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +//------------------------------------------------------------------------------ +// Generic Video Scanlines +//------------------------------------------------------------------------------ + +module scanlines_vertical #( + parameter v2 = 0 //! Enable Scanlines V2 + ) ( + input iPCLK, //! Pixel Clock + + input [1:0] iSCANLINES, //! Scanlines + input [23:0] iRGB, //! Core: RGB Video + input iHS, //! Core: Vsync + input iVS, //! Core: Hsync + input iDE, //! Core: Data Enable + input iCE, //! Core: Clock Enable + + output reg [23:0] oRGB, //! Video Ouput: RGB Video + output reg oHS, //! Video Ouput: Vsync + output reg oVS, //! Video Ouput: Hsync + output reg oDE, //! Video Ouput: Data Enable + output reg oCE //! Video Ouput: Clock Enable + ); + + reg [1:0] rSCANLINE; //! Scanline Register + always @(posedge iPCLK) begin + reg rOLD_VS; + rOLD_VS <= iVS; + if(v2) begin + rSCANLINE <= rSCANLINE + 1'd1; + if (rSCANLINE == iSCANLINES) begin + rSCANLINE <= 0; + end + end + else begin + rSCANLINE <= rSCANLINE ^ iSCANLINES; + end + if(rOLD_VS && ~iVS) rSCANLINE <= 0; + end + + wire [7:0] r,g,b; //! RGB Signals + assign {r,g,b} = iRGB; + + reg [23:0] rgb_d; //! RGB Data + always @(*) begin + case(rSCANLINE) + 1: //! 25% = 1/2 + 1/4 + rgb_d = { + {1'b0, r[7:1]} + {2'b0, r[7:2]}, + {1'b0, g[7:1]} + {2'b0, g[7:2]}, + {1'b0, b[7:1]} + {2'b0, b[7:2]} + }; + 2: //! 50% = 1/2 + rgb_d = { + {1'b0, r[7:1]}, + {1'b0, g[7:1]}, + {1'b0, b[7:1]} + }; + 3: //! 75% = 1/4 + rgb_d = { + {2'b0, r[7:2]}, + {2'b0, g[7:2]}, + {2'b0, b[7:2]} + }; + default: + rgb_d = {r, g, b}; + endcase + end + + always @(posedge iPCLK) begin + reg [23:0] rgb1, rgb2; + reg de1, de2; + reg vs1, vs2; + reg hs1, hs2; + reg ce1, ce2; + + oRGB <= rgb2; rgb2 <= rgb1; rgb1 <= rgb_d; + oVS <= vs2; vs2 <= vs1; vs1 <= iVS; + oHS <= hs2; hs2 <= hs1; hs1 <= iHS; + oDE <= de2; de2 <= de1; de1 <= iDE; + oCE <= ce2; ce2 <= ce1; ce1 <= iCE; + end + +endmodule diff --git a/pkg/pocket/Assets/congo/boogermann.congo/Congo Bongo (Rev C).json b/pkg/pocket/Assets/congo/boogermann.congo/Congo Bongo (Rev C).json new file mode 100644 index 0000000..7029e3e --- /dev/null +++ b/pkg/pocket/Assets/congo/boogermann.congo/Congo Bongo (Rev C).json @@ -0,0 +1,21 @@ +{ + "instance": { + "magic": "APF_VER_1", + "variant_select": { + "id": 777, + "select": false + }, + "data_slots": [ + { + "id": 1, + "filename": "congo.rom" + } + ], + "memory_writes": [ + { + "address": "0xf1000000", + "data": "0x0000007f" + } + ] + } +} \ No newline at end of file diff --git a/pkg/pocket/Assets/congo/boogermann.congo/Tip Top.json b/pkg/pocket/Assets/congo/boogermann.congo/Tip Top.json new file mode 100644 index 0000000..c89c742 --- /dev/null +++ b/pkg/pocket/Assets/congo/boogermann.congo/Tip Top.json @@ -0,0 +1,21 @@ +{ + "instance": { + "magic": "APF_VER_1", + "variant_select": { + "id": 777, + "select": false + }, + "data_slots": [ + { + "id": 1, + "filename": "tiptop.rom" + } + ], + "memory_writes": [ + { + "address": "0xf1000000", + "data": "0x0000007f" + } + ] + } +} \ No newline at end of file diff --git a/pkg/pocket/Assets/congo/common/checklist.md5 b/pkg/pocket/Assets/congo/common/checklist.md5 new file mode 100644 index 0000000..8c4e207 --- /dev/null +++ b/pkg/pocket/Assets/congo/common/checklist.md5 @@ -0,0 +1,2 @@ +cd3a3bc0364ae3916edf5d1bec211c0a congo.rom +899902a5c485ac34e4fb4daef1a7a2aa tiptop.rom diff --git a/pkg/pocket/Cores/boogermann.congo/audio.json b/pkg/pocket/Cores/boogermann.congo/audio.json new file mode 100644 index 0000000..ea8e2f4 --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/audio.json @@ -0,0 +1,5 @@ +{ + "audio": { + "magic": "APF_VER_1" + } +} \ No newline at end of file diff --git a/pkg/pocket/Cores/boogermann.congo/core.json b/pkg/pocket/Cores/boogermann.congo/core.json new file mode 100644 index 0000000..cb95ce0 --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/core.json @@ -0,0 +1,36 @@ +{ + "core": { + "magic": "APF_VER_1", + "metadata": { + "platform_ids": [ + "congo" + ], + "shortname": "congo", + "description": "Congo Bongo", + "author": "boogermann", + "url": "https://github.com/opengateware/arcade-congo", + "version": "0.1.0", + "date_release": "2022-11-14" + }, + "framework": { + "target_product": "Analogue Pocket", + "version_required": "1.1", + "sleep_supported": false, + "dock": { + "supported": true, + "analog_output": false + }, + "hardware": { + "link_port": false, + "cartridge_adapter": -1 + } + }, + "cores": [ + { + "name": "default", + "id": 0, + "filename": "bitstream.rbf_r" + } + ] + } +} \ No newline at end of file diff --git a/pkg/pocket/Cores/boogermann.congo/data.json b/pkg/pocket/Cores/boogermann.congo/data.json new file mode 100644 index 0000000..54b0079 --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/data.json @@ -0,0 +1,26 @@ +{ + "data": { + "magic": "APF_VER_1", + "data_slots": [ + { + "name": "Arcade Game", + "id": 0, + "required": true, + "parameters": "0x113", + "extensions": [ + "json" + ] + }, + { + "name": "ROM", + "id": 1, + "required": true, + "parameters": 0, + "extensions": [ + "rom" + ], + "address": "0x00000000" + } + ] + } +} \ No newline at end of file diff --git a/pkg/pocket/Cores/boogermann.congo/icon.bin b/pkg/pocket/Cores/boogermann.congo/icon.bin new file mode 100644 index 0000000..cb4e46d Binary files /dev/null and b/pkg/pocket/Cores/boogermann.congo/icon.bin differ diff --git a/pkg/pocket/Cores/boogermann.congo/icon.png b/pkg/pocket/Cores/boogermann.congo/icon.png new file mode 100644 index 0000000..255e6ec Binary files /dev/null and b/pkg/pocket/Cores/boogermann.congo/icon.png differ diff --git a/pkg/pocket/Cores/boogermann.congo/info.txt b/pkg/pocket/Cores/boogermann.congo/info.txt new file mode 100644 index 0000000..3dfb043 --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/info.txt @@ -0,0 +1,21 @@ +Congo Bongo is an isometric platform game and is Sega's take on Nintendo's legendary "Donkey Kong". +The player takes on the role of a red-nosed safari explorer by the name of Safari Sam, who tries to catch a gorilla named Bongo. + +The game consists of four different scenes. Each is timed by a bonus counter in the upper left corner of the screen. +As time passes, the bonus decreases. If the bonus counter reaches zero, a player life is lost. + +Note: You must provide your own roms to use this core. + +Developer(s) + Sega +Release + 1983 + +This Implementation of a compatible Congo Bongo arcade hardware in HDL is the work of Dar + +Analogue Pocket port by Marcus Andrade (Boogermann) + +Congo Bongo © 1983 Sega. +All trademarks, logos, and copyrights are property of their respective owners. + +The authors and contributors or any of its maintainers are in no way associated with or endorsed by Sega. \ No newline at end of file diff --git a/pkg/pocket/Cores/boogermann.congo/input.json b/pkg/pocket/Cores/boogermann.congo/input.json new file mode 100644 index 0000000..f68bfbb --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/input.json @@ -0,0 +1,29 @@ +{ + "input": { + "magic": "APF_VER_1", + "controllers": [ + { + "type": "default", + "buttons": 1, + "ways": 8, + "mappings": [ + { + "id": 0, + "name": "Jump", + "key": "pad_btn_b" + }, + { + "id": 20, + "name": "Start", + "key": "pad_btn_start" + }, + { + "id": 21, + "name": "Coin", + "key": "pad_btn_select" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/pkg/pocket/Cores/boogermann.congo/interact.json b/pkg/pocket/Cores/boogermann.congo/interact.json new file mode 100644 index 0000000..35a1c6e --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/interact.json @@ -0,0 +1,358 @@ +{ + "interact": { + "magic": "APF_VER_1", + "variables": [ + { + "name": "Reset Core", + "id": 1, + "type": "action", + "enabled": true, + "address": "0xF0000000", + "value": 1 + }, + { + "name": "Scanlines", + "id": 100, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF3000000", + "mask": "0xFFFFFFF0", + "defaultval": 0, + "options": [ + { + "name": "Disabled", + "value": 0 + }, + { + "name": "Horizontal Soft", + "value": 1 + }, + { + "name": "Horizontal Medium", + "value": 2 + }, + { + "name": "Horizontal Hard", + "value": 3 + }, + { + "name": "Vertical Soft", + "value": 4 + }, + { + "name": "Vertical Medium", + "value": 8 + }, + { + "name": "Vertical Hard", + "value": 12 + }, + { + "name": "H/V Soft", + "value": 5 + }, + { + "name": "H/V Medium", + "value": 10 + }, + { + "name": "H/V Hard", + "value": 15 + } + ] + }, + { + "name": "DIP", + "id": 1000, + "type": "number_u32", + "enabled": false, + "address": "0xF1000000" + }, + { + "name": "Bonus Life", + "port": "DSW02", + "id": 2, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF1000000", + "defaultval": 0, + "mask": "0xFFFFFFFC", + "options": [ + { + "name": "10000", + "value": "0x0003" + }, + { + "name": "20000", + "value": "0x0001" + }, + { + "name": "30000", + "value": "0x0002" + }, + { + "name": "40000", + "value": "0x0000" + } + ] + }, + { + "name": "Difficulty", + "port": "DSW02", + "id": 3, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF1000000", + "defaultval": 1, + "mask": "0xFFFFFFF3", + "options": [ + { + "name": "Easy", + "value": "0x000C" + }, + { + "name": "Medium", + "value": "0x0004" + }, + { + "name": "Hard", + "value": "0x0008" + }, + { + "name": "Hardest", + "value": "0x0000" + } + ] + }, + { + "name": "Lives", + "port": "DSW02", + "id": 4, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF1000000", + "defaultval": 0, + "mask": "0xFFFFFFCF", + "options": [ + { + "name": "3", + "value": "0x0030" + }, + { + "name": "4", + "value": "0x0010" + }, + { + "name": "5", + "value": "0x0020" + }, + { + "name": "Free Play", + "value": "0x0000" + } + ] + }, + { + "name": "Sound", + "port": "DSW02", + "id": 5, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF1000000", + "defaultval": 1, + "mask": "0xFFFFFFBF", + "options": [ + { + "name": "Off", + "value": "0x0000" + }, + { + "name": "On", + "value": "0x0040" + } + ] + }, + { + "name": "Cabinet", + "port": "DSW02", + "id": 6, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF1000000", + "defaultval": 0, + "mask": "0xFFFFFF7F", + "options": [ + { + "name": "Upright", + "value": "0x0000" + }, + { + "name": "Cocktail", + "value": "0x0080" + } + ] + }, + { + "name": "Coin B", + "port": "DSW03", + "id": 7, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF1000000", + "defaultval": 5, + "mask": "0xFFFFF0FF", + "options": [ + { + "name": "4 Coins/1 Credit", + "value": "0x0F00" + }, + { + "name": "3 Coins/1 Credit", + "value": "0x0700" + }, + { + "name": "2 Coins/1 Credit", + "value": "0x0B00" + }, + { + "name": "2C/1C 5C/3C 6C/4C", + "value": "0x0600" + }, + { + "name": "2C/1C 3C/2C 4C/3C", + "value": "0x0A00" + }, + { + "name": "1 Coin/1 Credit", + "value": "0x0300" + }, + { + "name": "1C/1C 5C/6C", + "value": "0x0200" + }, + { + "name": "1C/1C 4C/5C", + "value": "0x0C00" + }, + { + "name": "1C/1C 2C/3C", + "value": "0x0400" + }, + { + "name": "1 Coin/2 Credits", + "value": "0x0D00" + }, + { + "name": "1C/2C 5C/11C", + "value": "0x0800" + }, + { + "name": "1C/2C 4C/9C", + "value": "0x0000" + }, + { + "name": "1 Coin/3 Credits", + "value": "0x0500" + }, + { + "name": "1 Coin/4 Credits", + "value": "0x0900" + }, + { + "name": "1 Coin/5 Credits", + "value": "0x0100" + }, + { + "name": "1 Coin/6 Credits", + "value": "0x0E00" + } + ] + }, + { + "name": "Coin A", + "port": "DSW03", + "id": 8, + "type": "list", + "enabled": true, + "persist": true, + "address": "0xF1000000", + "defaultval": 5, + "mask": "0xFFFF0FFF", + "options": [ + { + "name": "4 Coins/1 Credit", + "value": "0xF000" + }, + { + "name": "3 Coins/1 Credit", + "value": "0x7000" + }, + { + "name": "2 Coins/1 Credit", + "value": "0xB000" + }, + { + "name": "2C/1C 5C/3C 6C/4C", + "value": "0x6000" + }, + { + "name": "2C/1C 3C/2C 4C/3C", + "value": "0xA000" + }, + { + "name": "1 Coin/1 Credit", + "value": "0x3000" + }, + { + "name": "1C/1C 5C/6C", + "value": "0x2000" + }, + { + "name": "1C/1C 4C/5C", + "value": "0xC000" + }, + { + "name": "1C/1C 2C/3C", + "value": "0x4000" + }, + { + "name": "1 Coin/2 Credits", + "value": "0xD000" + }, + { + "name": "1C/2C 5C/11C", + "value": "0x8000" + }, + { + "name": "1C/2C 4C/9C", + "value": "0x0000" + }, + { + "name": "1 Coin/3 Credits", + "value": "0x5000" + }, + { + "name": "1 Coin/4 Credits", + "value": "0x9000" + }, + { + "name": "1 Coin/5 Credits", + "value": "0x1000" + }, + { + "name": "1 Coin/6 Credits", + "value": "0xE000" + } + ] + } + ], + "messages": [] + } +} \ No newline at end of file diff --git a/pkg/pocket/Cores/boogermann.congo/variants.json b/pkg/pocket/Cores/boogermann.congo/variants.json new file mode 100644 index 0000000..c2dbd41 --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/variants.json @@ -0,0 +1,6 @@ +{ + "variants": { + "magic": "APF_VER_1", + "variant_list": [] + } +} \ No newline at end of file diff --git a/pkg/pocket/Cores/boogermann.congo/video.json b/pkg/pocket/Cores/boogermann.congo/video.json new file mode 100644 index 0000000..9e6a76e --- /dev/null +++ b/pkg/pocket/Cores/boogermann.congo/video.json @@ -0,0 +1,15 @@ +{ + "video": { + "magic": "APF_VER_1", + "scaler_modes": [ + { + "width": 256, + "height": 224, + "aspect_w": 8, + "aspect_h": 7, + "rotation": 270, + "mirror": 0 + } + ] + } +} \ No newline at end of file diff --git a/pkg/pocket/Platforms/_images/congo.bin b/pkg/pocket/Platforms/_images/congo.bin new file mode 100644 index 0000000..693899f Binary files /dev/null and b/pkg/pocket/Platforms/_images/congo.bin differ diff --git a/pkg/pocket/Platforms/_images/congo.png b/pkg/pocket/Platforms/_images/congo.png new file mode 100644 index 0000000..9874bde Binary files /dev/null and b/pkg/pocket/Platforms/_images/congo.png differ diff --git a/pkg/pocket/Platforms/congo.json b/pkg/pocket/Platforms/congo.json new file mode 100644 index 0000000..1b01f90 --- /dev/null +++ b/pkg/pocket/Platforms/congo.json @@ -0,0 +1,8 @@ +{ + "platform": { + "category": "Arcade", + "name": "Congo Bongo", + "manufacturer": "Sega/Gremlin", + "year": 1983 + } +} \ No newline at end of file diff --git a/pkg/rom-recipes/Assets/congo/common/checklist.md5 b/pkg/rom-recipes/Assets/congo/common/checklist.md5 new file mode 100644 index 0000000..8c4e207 --- /dev/null +++ b/pkg/rom-recipes/Assets/congo/common/checklist.md5 @@ -0,0 +1,2 @@ +cd3a3bc0364ae3916edf5d1bec211c0a congo.rom +899902a5c485ac34e4fb4daef1a7a2aa tiptop.rom diff --git a/pkg/rom-recipes/roms/_PUT_YOUR_ROMS_HERE b/pkg/rom-recipes/roms/_PUT_YOUR_ROMS_HERE new file mode 100644 index 0000000..e69de29 diff --git a/pkg/rom-recipes/tools/make_roms.ps1 b/pkg/rom-recipes/tools/make_roms.ps1 new file mode 100644 index 0000000..419ca32 --- /dev/null +++ b/pkg/rom-recipes/tools/make_roms.ps1 @@ -0,0 +1,23 @@ +#!/usr/bin/pwsh -Command + +$coreName = "bankpanic" +$currentPath = $(Get-Item $($MyInvocation.MyCommand.Path)).DirectoryName +$fileNames = Get-ChildItem -Path "$currentPath\..\xml" -Recurse -Include *.mra + +try { + foreach ($f in $fileNames){ + $outfile = $f.FullName + Write-Host "Converting $outfile ..." + orca.exe -z ..\roms -O ..\Assets\$coreName\common $outfile + } +} catch { + Write-Host "Error: $($_.Exception.Message)" + exit 1 +} finally { + Write-Host "Done." + Write-Host "Copy your rom files to Assets/$coreName/common" + Write-Host "Enjoy!" + timeout /t 10 +} + +exit 0 diff --git a/pkg/rom-recipes/tools/make_roms.sh b/pkg/rom-recipes/tools/make_roms.sh new file mode 100644 index 0000000..f544b78 --- /dev/null +++ b/pkg/rom-recipes/tools/make_roms.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +CORE=congo +PARENT=$(dirname $PWD) +XML=$PARENT/xml +ROMS=$PARENT/roms +ASSETS=$PARENT/Assets/$CORE/common + +find ${XML} -name '*.mra' | while read line; do + echo "Processing file '$line'" + orca -z ${ROMS} -O ${ASSETS} "$line" +done + +exit 0 \ No newline at end of file diff --git a/pkg/rom-recipes/xml/Congo Bongo (Rev C, 2 board stack).mra b/pkg/rom-recipes/xml/Congo Bongo (Rev C, 2 board stack).mra new file mode 100644 index 0000000..7fabd36 --- /dev/null +++ b/pkg/rom-recipes/xml/Congo Bongo (Rev C, 2 board stack).mra @@ -0,0 +1,40 @@ + + Congo Bongo (Rev C) + congo + no + no + 0248 + 1983 + Sega/Gremlin + Isometric Platform + vertical (cw) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pkg/rom-recipes/xml/Tip Top (3 board stack).mra b/pkg/rom-recipes/xml/Tip Top (3 board stack).mra new file mode 100644 index 0000000..33219d5 --- /dev/null +++ b/pkg/rom-recipes/xml/Tip Top (3 board stack).mra @@ -0,0 +1,40 @@ + + Tip Top + tiptop + no + no + 0248 + 1983 + Sega/Gremlin + Isometric Platform + vertical (cw) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/platform/pocket/apf.qip b/platform/pocket/apf.qip new file mode 100644 index 0000000..2fd9aea --- /dev/null +++ b/platform/pocket/apf.qip @@ -0,0 +1,7 @@ +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "apf_top.v"] +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "common.v"] +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "io_bridge_peripheral.v"] +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "io_pad_controller.v"] +set_global_assignment -name SDC_FILE [file join $::quartus(qip_path) "apf_constraints.sdc"] +set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) "mf_ddio_bidir_12.qip"] +set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) "mf_datatable.qip"] diff --git a/platform/pocket/apf_constraints.sdc b/platform/pocket/apf_constraints.sdc new file mode 100644 index 0000000..b168b55 --- /dev/null +++ b/platform/pocket/apf_constraints.sdc @@ -0,0 +1,12 @@ +# +# APF constraints +# Do not edit this file. +# +# Add your own constraints in the \core_constraints.sdc in the core directory, which will also be loaded. + +create_clock -name clk_74a -period 13.468 [get_ports clk_74a] +create_clock -name clk_74b -period 13.468 [get_ports clk_74b] +create_clock -name bridge_spiclk -period 13.468 [get_ports bridge_spiclk] + +# autogenerate PLL clock names for use down below +derive_pll_clocks diff --git a/platform/pocket/apf_top.v b/platform/pocket/apf_top.v new file mode 100644 index 0000000..600b6a1 --- /dev/null +++ b/platform/pocket/apf_top.v @@ -0,0 +1,475 @@ +// Software License Agreement + +// The software supplied herewith by Analogue Enterprises Limited (the "Company”), +// the Analogue Pocket Framework (“APF”), is provided and licensed to you, the +// Company's customer, solely for use in designing, testing and creating +// applications for use with Company's Products or Services. The software is +// owned by the Company and/or its licensors, and is protected under applicable +// laws, including, but not limited to, U.S. copyright law. All rights are +// reserved. By using the APF code you are agreeing to the terms of the End User +// License Agreement (“EULA”) located at [https://www.analogue.link/pocket-eula] +// and incorporated herein by reference. To the extent any use of the APF requires +// application of the MIT License or the GNU General Public License and terms of +// this APF Software License Agreement and EULA are inconsistent with such license, +// the applicable terms of the MIT License or the GNU General Public License, as +// applicable, will prevail. + +// THE SOFTWARE IS PROVIDED "AS-IS" AND WE EXPRESSLY DISCLAIM ANY IMPLIED +// WARRANTIES TO THE FULLEST EXTENT PROVIDED BY LAW, INCLUDING BUT NOT LIMITED TO, +// ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR +// NON-INFRINGEMENT. TO THE EXTENT APPLICABLE LAWS PROHIBIT TERMS OF USE FROM +// DISCLAIMING ANY IMPLIED WARRANTY, SUCH IMPLIED WARRANTY SHALL BE LIMITED TO THE +// MINIMUM WARRANTY PERIOD REQUIRED BY LAW, AND IF NO SUCH PERIOD IS REQUIRED, +// THEN THIRTY (30) DAYS FROM FIRST USE OF THE SOFTWARE. WE CANNOT GUARANTEE AND +// DO NOT PROMISE ANY SPECIFIC RESULTS FROM USE OF THE SOFTWARE. WITHOUT LIMITING +// THE FOREGOING, WE DO NOT WARRANT THAT THE SOFTWARE WILL BE UNINTERRUPTED OR +// ERROR-FREE. IN NO EVENT WILL WE BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY +// INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, SPECIAL OR PUNITIVE DAMAGES, +// INCLUDING BUT NOT LIMITED TO, LOST PROFITS ARISING OUT OF YOUR USE, OR +// INABILITY TO USE, THE SOFTWARE, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY +// OF SUCH DAMAGES. UNDER NO CIRCUMSTANCES SHALL OUR LIABILITY TO YOU FOR ANY +// CLAIM OR CAUSE OF ACTION WHATSOEVER, AND REGARDLESS OF THE FORM OF THE ACTION, +// WHETHER ARISING IN CONTRACT, TORT OR OTHERWISE, EXCEED THE AMOUNT PAID BY YOU +// TO US, IF ANY, DURING THE 90 DAY PERIOD IMMEDIATELY PRECEDING THE DATE ON WHICH +// YOU FIRST ASSERT ANY SUCH CLAIM. THE FOREGOING LIMITATIONS SHALL APPLY TO THE +// FULLEST EXTENT PERMITTED BY APPLICABLE LAW. +// +// 6515C - Analogue Pocket main unit +// SOCRATES FPGA +// +// 2022-08-17 Analogue + +`default_nettype none + +module apf_top ( +/////////////////////////////////////////////////// +// clock inputs 74.25mhz. not phase aligned, so treat these domains as asynchronous + +input wire clk_74a, // mainclk1 +input wire clk_74b, // mainclk1 + +/////////////////////////////////////////////////// +// cartridge interface +// switches between 3.3v and 5v mechanically +// output enable for multibit translators controlled by PIC32 + +// GBA AD[15:8] +inout wire [7:0] cart_tran_bank2, +output wire cart_tran_bank2_dir, + +// GBA AD[7:0] +inout wire [7:0] cart_tran_bank3, +output wire cart_tran_bank3_dir, + +// GBA A[23:16] +inout wire [7:0] cart_tran_bank1, +output wire cart_tran_bank1_dir, + +// GBA [7] PHI# +// GBA [6] WR# +// GBA [5] RD# +// GBA [4] CS1#/CS# +// [3:0] unwired +inout wire [7:4] cart_tran_bank0, +output wire cart_tran_bank0_dir, + +// GBA CS2#/RES# +inout wire cart_tran_pin30, +output wire cart_tran_pin30_dir, +// when GBC cart is inserted, this signal when low or weak will pull GBC /RES low with a special circuit +// the goal is that when unconfigured, the FPGA weak pullups won't interfere. +// thus, if GBC cart is inserted, FPGA must drive this high in order to let the level translators +// and general IO drive this pin. +output wire cart_pin30_pwroff_reset, + +// GBA IRQ/DRQ +inout wire cart_tran_pin31, +output wire cart_tran_pin31_dir, + +// infrared +// avoid driving the TX LED with DC or leaving it stuck on. pulsed usage is fine +input wire port_ir_rx, +output wire port_ir_tx, +output wire port_ir_rx_disable, + +// GBA link port +inout wire port_tran_si, +output wire port_tran_si_dir, +inout wire port_tran_so, +output wire port_tran_so_dir, +inout wire port_tran_sck, +output wire port_tran_sck_dir, +inout wire port_tran_sd, +output wire port_tran_sd_dir, + +/////////////////////////////////////////////////// +// video output to the scaler + +inout wire [11:0] scal_vid, +inout wire scal_clk, +inout wire scal_de, +inout wire scal_skip, +inout wire scal_vs, +inout wire scal_hs, + +output wire scal_audmclk, +input wire scal_audadc, +output wire scal_auddac, +output wire scal_audlrck, + +/////////////////////////////////////////////////// +// communication between main and scaler (aristotle) fpga. +// spi bus with aristotle as controller. + +inout wire bridge_spimosi, +inout wire bridge_spimiso, +inout wire bridge_spiclk, +input wire bridge_spiss, +inout wire bridge_1wire, + +/////////////////////////////////////////////////// +// cellular psram 0 and 1, two chips (64mbit x2 dual die per chip) + +output wire [21:16] cram0_a, +inout wire [15:0] cram0_dq, +input wire cram0_wait, +output wire cram0_clk, +output wire cram0_adv_n, +output wire cram0_cre, +output wire cram0_ce0_n, +output wire cram0_ce1_n, +output wire cram0_oe_n, +output wire cram0_we_n, +output wire cram0_ub_n, +output wire cram0_lb_n, + +output wire [21:16] cram1_a, +inout wire [15:0] cram1_dq, +input wire cram1_wait, +output wire cram1_clk, +output wire cram1_adv_n, +output wire cram1_cre, +output wire cram1_ce0_n, +output wire cram1_ce1_n, +output wire cram1_oe_n, +output wire cram1_we_n, +output wire cram1_ub_n, +output wire cram1_lb_n, + +/////////////////////////////////////////////////// +// sdram, 512mbit x16 + +output wire [12:0] dram_a, +output wire [1:0] dram_ba, +inout wire [15:0] dram_dq, +output wire [1:0] dram_dqm, +output wire dram_clk, +output wire dram_cke, +output wire dram_ras_n, +output wire dram_cas_n, +output wire dram_we_n, + +/////////////////////////////////////////////////// +// sram, 1mbit x16 + +output wire [16:0] sram_a, +inout wire [15:0] sram_dq, +output wire sram_oe_n, +output wire sram_we_n, +output wire sram_ub_n, +output wire sram_lb_n, + +/////////////////////////////////////////////////// +// vblank output to scaler + +input wire vblank, + +/////////////////////////////////////////////////// +// i/o to 6515D breakout usb uart + +output wire dbg_tx, +input wire dbg_rx, + +/////////////////////////////////////////////////// +// i/o pads near jtag connector user can solder to + +output wire user1, +input wire user2, + +/////////////////////////////////////////////////// +// powerup self test, do not use + +inout wire bist, +output wire vpll_feed, + +/////////////////////////////////////////////////// +// RFU internal i2c bus (DNU) + +inout wire aux_sda, +output wire aux_scl + +); + +assign bist = 1'bZ; + +// reset generation + + reg [24:0] count; + reg reset_n; + +initial begin + count <= 0; + reset_n <= 0; +end +always @(posedge clk_74a) begin + count <= count + 1'b1; + + if(count[15]) begin + // exit reset + reset_n <= 1; + end + +end + + + + +// convert 24-bit rgb data to 12-bit DDR for ARISTOTLE + + wire [23:0] video_rgb; + wire video_rgb_clock; + wire video_rgb_clock_90; + wire video_de; + wire video_skip; + wire video_vs; + wire video_hs; + +mf_ddio_bidir_12 isco ( + .oe ( 1'b1 ), + .datain_h ( video_rgb[23:12] ), + .datain_l ( video_rgb[11: 0] ), + .outclock ( video_rgb_clock ), + .padio ( scal_ddio_12 ) +); + +wire [11:0] scal_ddio_12; +assign scal_vid = scal_ddio_12; + +mf_ddio_bidir_12 iscc ( + .oe ( 1'b1 ), + .datain_h ( {video_vs, video_hs, video_de, video_skip} ), + .datain_l ( {video_vs, video_hs, video_de, video_skip} ), + .outclock ( video_rgb_clock ), + .padio ( scal_ddio_ctrl ) +); + +wire [3:0] scal_ddio_ctrl; +assign scal_vs = scal_ddio_ctrl[3]; +assign scal_hs = scal_ddio_ctrl[2]; +assign scal_de = scal_ddio_ctrl[1]; +assign scal_skip = scal_ddio_ctrl[0]; + +mf_ddio_bidir_12 isclk( + .oe ( 1'b1 ), + .datain_h ( 1'b1 ), + .datain_l ( 1'b0 ), + .outclock ( video_rgb_clock_90 ), + .padio ( scal_clk ) +); + + + +// controller data (pad) controller. + wire [31:0] cont1_key; + wire [31:0] cont2_key; + wire [31:0] cont3_key; + wire [31:0] cont4_key; + wire [31:0] cont1_joy; + wire [31:0] cont2_joy; + wire [31:0] cont3_joy; + wire [31:0] cont4_joy; + wire [15:0] cont1_trig; + wire [15:0] cont2_trig; + wire [15:0] cont3_trig; + wire [15:0] cont4_trig; + +io_pad_controller ipm ( + .clk ( clk_74a ), + .reset_n ( reset_n ), + + .pad_1wire ( bridge_1wire ), + + .cont1_key ( cont1_key ), + .cont2_key ( cont2_key ), + .cont3_key ( cont3_key ), + .cont4_key ( cont4_key ), + .cont1_joy ( cont1_joy ), + .cont2_joy ( cont2_joy ), + .cont3_joy ( cont3_joy ), + .cont4_joy ( cont4_joy ), + .cont1_trig ( cont1_trig ), + .cont2_trig ( cont2_trig ), + .cont3_trig ( cont3_trig ), + .cont4_trig ( cont4_trig ) +); + + +// virtual pmp bridge + wire bridge_endian_little; + wire [31:0] bridge_addr; + wire bridge_rd; + wire [31:0] bridge_rd_data; + wire bridge_wr; + wire [31:0] bridge_wr_data; + +io_bridge_peripheral ibs ( + + .clk ( clk_74a ), + .reset_n ( reset_n ), + + .endian_little ( bridge_endian_little ), + + .pmp_addr ( bridge_addr ), + .pmp_rd ( bridge_rd ), + .pmp_rd_data ( bridge_rd_data ), + .pmp_wr ( bridge_wr ), + .pmp_wr_data ( bridge_wr_data ), + + .phy_spimosi ( bridge_spimosi ), + .phy_spimiso ( bridge_spimiso ), + .phy_spiclk ( bridge_spiclk ), + .phy_spiss ( bridge_spiss ) + +); + + +/////////////////////////////////////////////////// +// instantiate the user core top-level + +core_top ic ( + + // physical connections + // + .clk_74a ( clk_74a ), + .clk_74b ( clk_74b ), + + .cart_tran_bank2 ( cart_tran_bank2 ), + .cart_tran_bank2_dir ( cart_tran_bank2_dir ), + .cart_tran_bank3 ( cart_tran_bank3 ), + .cart_tran_bank3_dir ( cart_tran_bank3_dir ), + .cart_tran_bank1 ( cart_tran_bank1 ), + .cart_tran_bank1_dir ( cart_tran_bank1_dir ), + .cart_tran_bank0 ( cart_tran_bank0 ), + .cart_tran_bank0_dir ( cart_tran_bank0_dir ), + .cart_tran_pin30 ( cart_tran_pin30 ), + .cart_tran_pin30_dir ( cart_tran_pin30_dir ), + .cart_pin30_pwroff_reset ( cart_pin30_pwroff_reset ), + .cart_tran_pin31 ( cart_tran_pin31 ), + .cart_tran_pin31_dir ( cart_tran_pin31_dir ), + + .port_ir_rx ( port_ir_rx ), + .port_ir_tx ( port_ir_tx ), + .port_ir_rx_disable ( port_ir_rx_disable ), + + .port_tran_si ( port_tran_si ), + .port_tran_si_dir ( port_tran_si_dir ), + .port_tran_so ( port_tran_so ), + .port_tran_so_dir ( port_tran_so_dir ), + .port_tran_sck ( port_tran_sck ), + .port_tran_sck_dir ( port_tran_sck_dir ), + .port_tran_sd ( port_tran_sd ), + .port_tran_sd_dir ( port_tran_sd_dir ), + + .cram0_a ( cram0_a ), + .cram0_dq ( cram0_dq ), + .cram0_wait ( cram0_wait ), + .cram0_clk ( cram0_clk ), + .cram0_adv_n ( cram0_adv_n ), + .cram0_cre ( cram0_cre ), + .cram0_ce0_n ( cram0_ce0_n ), + .cram0_ce1_n ( cram0_ce1_n ), + .cram0_oe_n ( cram0_oe_n ), + .cram0_we_n ( cram0_we_n ), + .cram0_ub_n ( cram0_ub_n ), + .cram0_lb_n ( cram0_lb_n ), + .cram1_a ( cram1_a ), + .cram1_dq ( cram1_dq ), + .cram1_wait ( cram1_wait ), + .cram1_clk ( cram1_clk ), + .cram1_adv_n ( cram1_adv_n ), + .cram1_cre ( cram1_cre ), + .cram1_ce0_n ( cram1_ce0_n ), + .cram1_ce1_n ( cram1_ce1_n ), + .cram1_oe_n ( cram1_oe_n ), + .cram1_we_n ( cram1_we_n ), + .cram1_ub_n ( cram1_ub_n ), + .cram1_lb_n ( cram1_lb_n ), + + .dram_a ( dram_a ), + .dram_ba ( dram_ba ), + .dram_dq ( dram_dq ), + .dram_dqm ( dram_dqm ), + .dram_clk ( dram_clk ), + .dram_cke ( dram_cke ), + .dram_ras_n ( dram_ras_n ), + .dram_cas_n ( dram_cas_n ), + .dram_we_n ( dram_we_n ), + + .sram_a ( sram_a ), + .sram_dq ( sram_dq ), + .sram_oe_n ( sram_oe_n ), + .sram_we_n ( sram_we_n ), + .sram_ub_n ( sram_ub_n ), + .sram_lb_n ( sram_lb_n ), + + .vblank ( vblank ), + .vpll_feed ( vpll_feed ), + + .dbg_tx ( dbg_tx ), + .dbg_rx ( dbg_rx ), + .user1 ( user1 ), + .user2 ( user2 ), + + .aux_sda ( aux_sda ), + .aux_scl ( aux_scl ), + + + // logical connections with user core + // + .video_rgb ( video_rgb ), + .video_rgb_clock ( video_rgb_clock ), + .video_rgb_clock_90 ( video_rgb_clock_90 ), + .video_de ( video_de ), + .video_skip ( video_skip ), + .video_vs ( video_vs ), + .video_hs ( video_hs ), + + .audio_mclk ( scal_audmclk ), + .audio_adc ( scal_audadc ), + .audio_dac ( scal_auddac ), + .audio_lrck ( scal_audlrck ), + + .bridge_endian_little ( bridge_endian_little ), + .bridge_addr ( bridge_addr ), + .bridge_rd ( bridge_rd ), + .bridge_rd_data ( bridge_rd_data ), + .bridge_wr ( bridge_wr ), + .bridge_wr_data ( bridge_wr_data ), + + .cont1_key ( cont1_key ), + .cont2_key ( cont2_key ), + .cont3_key ( cont3_key ), + .cont4_key ( cont4_key ), + .cont1_joy ( cont1_joy ), + .cont2_joy ( cont2_joy ), + .cont3_joy ( cont3_joy ), + .cont4_joy ( cont4_joy ), + .cont1_trig ( cont1_trig ), + .cont2_trig ( cont2_trig ), + .cont3_trig ( cont3_trig ), + .cont4_trig ( cont4_trig ) + +); + +endmodule + diff --git a/platform/pocket/build_cdf.tcl b/platform/pocket/build_cdf.tcl new file mode 100644 index 0000000..ec99b5d --- /dev/null +++ b/platform/pocket/build_cdf.tcl @@ -0,0 +1,48 @@ +# ============================================================================== +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileType: SOURCE +# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +# ============================================================================== +# @file: build_cd.h +# @brief: Generate a JTAG Chain Description File. +# Create a .cdf file to be used with Quartus Prime Programmer +# ============================================================================== +proc createChainDescriptionFile {revision device outpath project_name} { + set outputFileName "$project_name.cdf" + set outputFile [open $outputFileName "w"] + + puts $outputFile "JedecChain;" + puts $outputFile " FileRevision(JESD32A);" + puts $outputFile " DefaultMfr(6E);" + puts $outputFile "" + puts $outputFile " P ActionCode(Cfg)" + puts $outputFile " Device PartName($device) Path(\"$outpath/\") File(\"$revision.sof\") MfrSpec(OpMask(1));" + puts $outputFile "ChainEnd;" + puts $outputFile "" + puts $outputFile "AlteraBegin;" + puts $outputFile " ChainType(JTAG);" + puts $outputFile "AlteraEnd;" +} + +set project_name [lindex $quartus(args) 1] +set revision [lindex $quartus(args) 2] + +if {[project_exists $project_name]} { + if {[string equal "" $revision]} { + project_open $project_name -revision [get_current_revision $project_name] + } else { + project_open $project_name -revision $revision + } +} else { + post_message -type error "Project $project_name does not exist" + exit +} + +set device [get_global_assignment -name DEVICE] +set outpath [get_global_assignment -name PROJECT_OUTPUT_DIRECTORY] + +if [is_project_open] { + project_close +} + +createChainDescriptionFile $revision $device $outpath $project_name diff --git a/platform/pocket/build_id_gen.tcl b/platform/pocket/build_id_gen.tcl new file mode 100644 index 0000000..91b0627 --- /dev/null +++ b/platform/pocket/build_id_gen.tcl @@ -0,0 +1,171 @@ +# ================================================================================ +# (c) 2011 Altera Corporation. All rights reserved. +# Altera products are protected under numerous U.S. and foreign patents, maskwork +# rights, copyrights and other intellectual property laws. +# +# This reference design file, and your use thereof, is subject to and governed +# by the terms and conditions of the applicable Altera Reference Design License +# Agreement (either as signed by you, agreed by you upon download or as a +# "click-through" agreement upon installation andor found at www.altera.com). +# By using this reference design file, you indicate your acceptance of such terms +# and conditions between you and Altera Corporation. In the event that you do +# not agree with such terms and conditions, you may not use the reference design +# file and please promptly destroy any copies you have made. +# +# This reference design file is being provided on an "as-is" basis and as an +# accommodation and therefore all warranties, representations or guarantees of +# any kind (whether express, implied or statutory) including, without limitation, +# warranties of merchantability, non-infringement, or fitness for a particular +# purpose, are specifically disclaimed. By making this reference design file +# available, Altera expressly does not recommend, suggest or require that this +# reference design file be used in combination with any other product not +# provided by Altera. +# ================================================================================ +# +# Build ID Verilog Module Script +# Jeff Wiencrot - 8/1/2011 +# +# Generates a Verilog module that contains a timestamp, physical address, and host name +# from the current build. These values are available from the build_date, build_time, +# physical_address, and host_name output ports of the build_id module in the build_id.v +# Verilog source file. +# +# The format for each value is as follows: +# Date - 32-bit decimal number of the format mmddyyyy +# Time - 32-bit decimal number of the format hhmmss +# Phyiscal Address - 48-bit hexadecimal number +# Host name - 120-bit hexadecimal number with pairs of digits equal to the +# hexadecimal code for the first 15 ASCII characters of the host +# name. For added clarity, host names that have fewer than 30 +# hexadecimal digits (15 characters) are padded on the left with +# zeros. +# +# Usage: +# +# To manually execute this script, source this file using the following Tcl commands: +# source build_id_verilog.tcl +# +# To have this script automatically execute each time your project is built, use the +# following command (see: http://www.altera.com/support/examples/tcl/auto_processing.html): +# set_global_assignment -name PRE_FLOW_SCRIPT_FILE quartus_sh:build_id_verilog.tcl +# +# Comment out the last line to prevent the process from automatically executing when +# the file is sourced. The process can then be executed with the following command: +# generateBuildID_Verilog +# +# +# For more information, see "build_identification.pdf" +# +# ================================================================================ +# +# 2021-01-21 Analogue +# +# Only care about generating build date/time, so the rest was removed. +# The original can be downloaded from the Intel resource page +# + +proc generateBuildID_Verilog {} { + + # Get the timestamp (see: http://www.altera.com/support/examples/tcl/tcl-date-time-stamp.html) + set buildDate [ clock format [ clock seconds ] -format %Y%m%d ] + set buildTime [ clock format [ clock seconds ] -format %H%M%S ] + + # Create a Verilog file for output + set outputFileName "../platform/pocket/build_id.v" + set outputFile [open $outputFileName "w"] + + # Output the Verilog source + puts $outputFile "// Build ID Verilog Module" + puts $outputFile "//" + puts $outputFile "// Note - these are stored as binary coded decimal" + puts $outputFile "// Date: $buildDate" + puts $outputFile "// Time: $buildTime" + puts $outputFile "" + puts $outputFile "module build_id" + puts $outputFile "(" + puts $outputFile " output \[31:0\] build_date," + puts $outputFile " output \[31:0\] build_time" + puts $outputFile ");" + puts $outputFile "" + puts $outputFile " assign build_date = 32'h$buildDate;" + puts $outputFile " assign build_time = 32'h$buildTime;" + puts $outputFile "" + puts $outputFile "endmodule" + close $outputFile + + + + # Send confirmation message to the Messages window + #post_message "APF core build date/time generated: [pwd]/$outputFileName" + #post_message "Date: $buildDate" + #post_message "Time: $buildTime" +} + + +proc generateBuildID_MIF {} { + + # Get the timestamp (see: http://www.altera.com/support/examples/tcl/tcl-date-time-stamp.html) + set buildDate [ clock format [ clock seconds ] -format %Y%m%d ] + set buildTime [ clock format [ clock seconds ] -format %H%M%S ] + set buildUnique [expr {int(rand()*(4294967295))}] + + set buildDateNoLeadingZeros [string trimleft $buildDate "0"] + set buildTimeNoLeadingZeros [string trimleft $buildTime "0"] + set buildDate4Byte [format "%08d" $buildDateNoLeadingZeros] + set buildTime4Byte [format "%08d" $buildTimeNoLeadingZeros] + set buildUnique4Byte [format "%08x" $buildUnique] + + #set buildDate4Byte \ + [concat [string range $buildDate 0 1] \ + [string range $buildDate 2 3] \ + [string range $buildDate 4 5] \ + [string range $buildDate 6 7] ] + + + set buildDateNumBytes 4 + set buildTimeNumBytes 4 + + # Calculate depth of the memory (8-bit) words + set memoryDepth [expr $buildDateNumBytes + $buildTimeNumBytes] + + # Create a Memory Initialization File for output + set outputFileName "../platform/pocket/build_id.mif" + set outputFile [open $outputFileName "w"] + + # Output the MIF header (see: http://quartushelp.altera.com/current/mergedProjects/reference/glossary/def_mif.htm) + puts $outputFile "-- Build ID Memory Initialization File" + puts $outputFile "--" + puts $outputFile "" + puts $outputFile "DEPTH = 256;" + puts $outputFile "WIDTH = 32;" + puts $outputFile "ADDRESS_RADIX = HEX;" + puts $outputFile "DATA_RADIX = HEX;" + puts $outputFile "" + puts $outputFile "CONTENT" + puts $outputFile "BEGIN" + puts $outputFile "" + puts $outputFile " 0E0 : $buildDate4Byte;" + puts $outputFile " 0E1 : $buildTime4Byte;" + puts $outputFile " 0E2 : $buildUnique4Byte;" + puts $outputFile "" + puts $outputFile "END;" + + # Close file to complete write + close $outputFile + + # Send confirmation message to the Messages window + post_message "APF core build date/time generated: [pwd]/$outputFileName" +} + +generateBuildID_MIF + +# 2021-01-21 Analogue +# +# There are some circumstances where you want all parts of a FPGA flow to be deterministic, especially +# when trying to hash out timing issues. +# You should comment this line out and temporarily bypass buildid generation so that synthesis/par +# have consistent working input. MIF bram contents like above won't affect the random seed or trigger +# recompilation. +# Don't forget to re-enable before you release. +# +# generateBuildID_Verilog diff --git a/platform/pocket/common.v b/platform/pocket/common.v new file mode 100644 index 0000000..bcc5aaa --- /dev/null +++ b/platform/pocket/common.v @@ -0,0 +1,156 @@ +// Software License Agreement + +// The software supplied herewith by Analogue Enterprises Limited (the "Company”), +// the Analogue Pocket Framework (“APF”), is provided and licensed to you, the +// Company's customer, solely for use in designing, testing and creating +// applications for use with Company's Products or Services. The software is +// owned by the Company and/or its licensors, and is protected under applicable +// laws, including, but not limited to, U.S. copyright law. All rights are +// reserved. By using the APF code you are agreeing to the terms of the End User +// License Agreement (“EULA”) located at [https://www.analogue.link/pocket-eula] +// and incorporated herein by reference. To the extent any use of the APF requires +// application of the MIT License or the GNU General Public License and terms of +// this APF Software License Agreement and EULA are inconsistent with such license, +// the applicable terms of the MIT License or the GNU General Public License, as +// applicable, will prevail. + +// THE SOFTWARE IS PROVIDED "AS-IS" AND WE EXPRESSLY DISCLAIM ANY IMPLIED +// WARRANTIES TO THE FULLEST EXTENT PROVIDED BY LAW, INCLUDING BUT NOT LIMITED TO, +// ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR +// NON-INFRINGEMENT. TO THE EXTENT APPLICABLE LAWS PROHIBIT TERMS OF USE FROM +// DISCLAIMING ANY IMPLIED WARRANTY, SUCH IMPLIED WARRANTY SHALL BE LIMITED TO THE +// MINIMUM WARRANTY PERIOD REQUIRED BY LAW, AND IF NO SUCH PERIOD IS REQUIRED, +// THEN THIRTY (30) DAYS FROM FIRST USE OF THE SOFTWARE. WE CANNOT GUARANTEE AND +// DO NOT PROMISE ANY SPECIFIC RESULTS FROM USE OF THE SOFTWARE. WITHOUT LIMITING +// THE FOREGOING, WE DO NOT WARRANT THAT THE SOFTWARE WILL BE UNINTERRUPTED OR +// ERROR-FREE. IN NO EVENT WILL WE BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY +// INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, SPECIAL OR PUNITIVE DAMAGES, +// INCLUDING BUT NOT LIMITED TO, LOST PROFITS ARISING OUT OF YOUR USE, OR +// INABILITY TO USE, THE SOFTWARE, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY +// OF SUCH DAMAGES. UNDER NO CIRCUMSTANCES SHALL OUR LIABILITY TO YOU FOR ANY +// CLAIM OR CAUSE OF ACTION WHATSOEVER, AND REGARDLESS OF THE FORM OF THE ACTION, +// WHETHER ARISING IN CONTRACT, TORT OR OTHERWISE, EXCEED THE AMOUNT PAID BY YOU +// TO US, IF ANY, DURING THE 90 DAY PERIOD IMMEDIATELY PRECEDING THE DATE ON WHICH +// YOU FIRST ASSERT ANY SUCH CLAIM. THE FOREGOING LIMITATIONS SHALL APPLY TO THE +// FULLEST EXTENT PERMITTED BY APPLICABLE LAW. +// +// 2-stage synchronizer +// +module synch_2 #(parameter WIDTH = 1) ( + input wire [WIDTH-1:0] i, // input signal + output reg [WIDTH-1:0] o, // synchronized output + input wire clk, // clock to synchronize on + output wire rise, // one-cycle rising edge pulse + output wire fall // one-cycle falling edge pulse +); + +reg [WIDTH-1:0] stage_1; +reg [WIDTH-1:0] stage_2; +reg [WIDTH-1:0] stage_3; + +assign rise = (WIDTH == 1) ? (o & ~stage_2) : 1'b0; +assign fall = (WIDTH == 1) ? (~o & stage_2) : 1'b0; +always @(posedge clk) + {stage_2, o, stage_1} <= {o, stage_1, i}; + +endmodule + + +// +// 3-stage synchronizer +// +module synch_3 #(parameter WIDTH = 1) ( + input wire [WIDTH-1:0] i, // input signal + output reg [WIDTH-1:0] o, // synchronized output + input wire clk, // clock to synchronize on + output wire rise, // one-cycle rising edge pulse + output wire fall // one-cycle falling edge pulse +); + +reg [WIDTH-1:0] stage_1; +reg [WIDTH-1:0] stage_2; +reg [WIDTH-1:0] stage_3; + +assign rise = (WIDTH == 1) ? (o & ~stage_3) : 1'b0; +assign fall = (WIDTH == 1) ? (~o & stage_3) : 1'b0; +always @(posedge clk) + {stage_3, o, stage_2, stage_1} <= {o, stage_2, stage_1, i}; + +endmodule + + +module bram_block_dp #( + parameter DATA = 32, + parameter ADDR = 7 +) ( + input wire a_clk, + input wire a_wr, + input wire [ADDR-1:0] a_addr, + input wire [DATA-1:0] a_din, + output reg [DATA-1:0] a_dout, + + input wire b_clk, + input wire b_wr, + input wire [ADDR-1:0] b_addr, + input wire [DATA-1:0] b_din, + output reg [DATA-1:0] b_dout +); + +reg [DATA-1:0] mem [(2**ADDR)-1:0]; + +always @(posedge a_clk) begin + if(a_wr) begin + a_dout <= a_din; + mem[a_addr] <= a_din; + end else + a_dout <= mem[a_addr]; +end + +always @(posedge b_clk) begin + if(b_wr) begin + b_dout <= b_din; + mem[b_addr] <= b_din; + end else + b_dout <= mem[b_addr]; +end + +endmodule + + +module bram_block_dp_nonstd #( + parameter DATA = 32, + parameter ADDR = 7, + parameter DEPTH = 128 +) ( + input wire a_clk, + input wire a_wr, + input wire [ADDR-1:0] a_addr, + input wire [DATA-1:0] a_din, + output reg [DATA-1:0] a_dout, + + input wire b_clk, + input wire b_wr, + input wire [ADDR-1:0] b_addr, + input wire [DATA-1:0] b_din, + output reg [DATA-1:0] b_dout +); + +reg [DATA-1:0] mem [DEPTH-1:0]; + +always @(posedge a_clk) begin + if(a_wr) begin + a_dout <= a_din; + mem[a_addr] <= a_din; + end else + a_dout <= mem[a_addr]; +end + +always @(posedge b_clk) begin + if(b_wr) begin + b_dout <= b_din; + mem[b_addr] <= b_din; + end else + b_dout <= mem[b_addr]; +end + +endmodule diff --git a/platform/pocket/io_bridge_peripheral.v b/platform/pocket/io_bridge_peripheral.v new file mode 100644 index 0000000..db2e544 --- /dev/null +++ b/platform/pocket/io_bridge_peripheral.v @@ -0,0 +1,334 @@ +// Software License Agreement + +// The software supplied herewith by Analogue Enterprises Limited (the "Company”), +// the Analogue Pocket Framework (“APF”), is provided and licensed to you, the +// Company's customer, solely for use in designing, testing and creating +// applications for use with Company's Products or Services. The software is +// owned by the Company and/or its licensors, and is protected under applicable +// laws, including, but not limited to, U.S. copyright law. All rights are +// reserved. By using the APF code you are agreeing to the terms of the End User +// License Agreement (“EULA”) located at [https://www.analogue.link/pocket-eula] +// and incorporated herein by reference. To the extent any use of the APF requires +// application of the MIT License or the GNU General Public License and terms of +// this APF Software License Agreement and EULA are inconsistent with such license, +// the applicable terms of the MIT License or the GNU General Public License, as +// applicable, will prevail. + +// THE SOFTWARE IS PROVIDED "AS-IS" AND WE EXPRESSLY DISCLAIM ANY IMPLIED +// WARRANTIES TO THE FULLEST EXTENT PROVIDED BY LAW, INCLUDING BUT NOT LIMITED TO, +// ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR +// NON-INFRINGEMENT. TO THE EXTENT APPLICABLE LAWS PROHIBIT TERMS OF USE FROM +// DISCLAIMING ANY IMPLIED WARRANTY, SUCH IMPLIED WARRANTY SHALL BE LIMITED TO THE +// MINIMUM WARRANTY PERIOD REQUIRED BY LAW, AND IF NO SUCH PERIOD IS REQUIRED, +// THEN THIRTY (30) DAYS FROM FIRST USE OF THE SOFTWARE. WE CANNOT GUARANTEE AND +// DO NOT PROMISE ANY SPECIFIC RESULTS FROM USE OF THE SOFTWARE. WITHOUT LIMITING +// THE FOREGOING, WE DO NOT WARRANT THAT THE SOFTWARE WILL BE UNINTERRUPTED OR +// ERROR-FREE. IN NO EVENT WILL WE BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY +// INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, SPECIAL OR PUNITIVE DAMAGES, +// INCLUDING BUT NOT LIMITED TO, LOST PROFITS ARISING OUT OF YOUR USE, OR +// INABILITY TO USE, THE SOFTWARE, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY +// OF SUCH DAMAGES. UNDER NO CIRCUMSTANCES SHALL OUR LIABILITY TO YOU FOR ANY +// CLAIM OR CAUSE OF ACTION WHATSOEVER, AND REGARDLESS OF THE FORM OF THE ACTION, +// WHETHER ARISING IN CONTRACT, TORT OR OTHERWISE, EXCEED THE AMOUNT PAID BY YOU +// TO US, IF ANY, DURING THE 90 DAY PERIOD IMMEDIATELY PRECEDING THE DATE ON WHICH +// YOU FIRST ASSERT ANY SUCH CLAIM. THE FOREGOING LIMITATIONS SHALL APPLY TO THE +// FULLEST EXTENT PERMITTED BY APPLICABLE LAW. +// +// bridge peripheral for socrates PMP bridge to heraclitus+aristotle +// 2020-2022 Analogue +// +// please note that while writes are immediate, +// reads are buffered by 1 word. this is necessary to maintain +// data throughput while reading from slower data sources like +// sdram. +// reads should always return the current bus value, and kickstart +// into the next read immediately. this way, you have the entire +// next word time to retrieve the data, instead of just a few +// cycles. +// +// the worst-case read/write timing is every 88 cycles @ 74.25mhz +// which is about 1180ns. + +module io_bridge_peripheral ( + +input wire clk, +input wire reset_n, + +input wire endian_little, + +output reg [31:0] pmp_addr, +output reg pmp_addr_valid, +output reg pmp_rd, +input wire [31:0] pmp_rd_data, +output reg pmp_wr, +output reg [31:0] pmp_wr_data, + +inout reg phy_spimosi, +inout reg phy_spimiso, +inout reg phy_spiclk, +input wire phy_spiss + +); + +// +// clock domain: clk (74.25mhz) rising edge +// + wire reset_n_s; +synch_3 s00(reset_n, reset_n_s, clk); + + wire endian_little_s; +synch_3 s01(endian_little, endian_little_s, clk); + + wire phy_spiss_s, phy_spiss_r, phy_spiss_f; +synch_3 s02(phy_spiss, phy_spiss_s, clk, phy_spiss_r, phy_spiss_f); + + + reg [4:0] state; + localparam ST_RESET = 'd0; + localparam ST_IDLE = 'd1; + localparam ST_READ_0 = 'd2; + localparam ST_READ_1 = 'd3; + localparam ST_READ_2 = 'd4; + localparam ST_READ_3 = 'd5; + localparam ST_WRITE_0 = 'd6; + localparam ST_WRITE_1 = 'd7; + localparam ST_WRITE_2 = 'd8; + localparam ST_ADDR_0 = 'd9; + + reg [1:0] addr_cnt; + reg [1:0] data_cnt; + reg [6:0] read_cnt; + + // synchronize rd byte flag's rising edge into clk + wire rx_byte_done_s, rx_byte_done_r; +synch_3 s03(rx_byte_done, rx_byte_done_s, clk, rx_byte_done_r); + + reg [4:0] spis; + localparam ST_SIDLE = 'd1; + localparam ST_SEND_N = 'd6; + localparam ST_SEND_0 = 'd2; + localparam ST_SEND_1 = 'd3; + localparam ST_SEND_2 = 'd4; + localparam ST_SEND_3 = 'd5; + reg spis_tx; + reg [31:0] spis_word_tx; + reg [31:0] spis_word; + reg [4:0] spis_count; + reg spis_done; + + reg rx_byte_done_r_1, rx_byte_done_r_2; + reg [7:0] rx_byte_1, rx_byte_2; + + // handle reversing endianness on both ports + reg [31:0] pmp_wr_data_latch; + reg [31:0] pmp_rd_data_e; // asynchronous + reg [31:0] pmp_rd_data_buf; // buffer the last word for immediate response +always @(*) begin + pmp_wr_data <= endian_little_s ? { pmp_wr_data_latch[7:0], + pmp_wr_data_latch[15:8], + pmp_wr_data_latch[23:16], + pmp_wr_data_latch[31:24] + } : pmp_wr_data_latch; + + pmp_rd_data_e <= endian_little_s ? {pmp_rd_data[7:0], + pmp_rd_data[15:8], + pmp_rd_data[23:16], + pmp_rd_data[31:24] + } : pmp_rd_data; +end + +always @(posedge clk) begin + + rx_byte_2 <= rx_byte_1; + rx_byte_1 <= rx_byte; + + rx_byte_done_r_1 <= rx_byte_done_r; + rx_byte_done_r_2 <= rx_byte_done_r_1; + + case(state) + ST_RESET: begin + addr_cnt <= 0; + data_cnt <= 0; + pmp_wr <= 0; + pmp_rd <= 0; + pmp_addr_valid <= 0; + spis_tx <= 0; + + state <= ST_ADDR_0; + end + ST_ADDR_0: begin + // transaction has started + + if(rx_byte_done_r_2) begin + case(addr_cnt) + 0: pmp_addr[31:24] <= rx_byte_2; + 1: pmp_addr[23:16] <= rx_byte_2; + 2: pmp_addr[15: 8] <= rx_byte_2; + 3: begin + pmp_addr[ 7: 0] <= {rx_byte_2[7:2], 2'b00}; + // address is latched + if( rx_byte_2[0] ) begin + data_cnt <= 0; + state <= ST_WRITE_0; + end else begin + data_cnt <= 0; + read_cnt <= 0; + state <= ST_READ_0; + end + end + endcase + + addr_cnt <= addr_cnt + 1'b1; + end + end + ST_WRITE_0: begin + // give notice, address has become valid + pmp_addr_valid <= 1; + + if(rx_byte_done_r_2) begin + case(data_cnt) + 0: pmp_wr_data_latch[31:24] <= rx_byte_2; + 1: pmp_wr_data_latch[23:16] <= rx_byte_2; + 2: pmp_wr_data_latch[15: 8] <= rx_byte_2; + 3: begin + pmp_wr_data_latch[ 7: 0] <= rx_byte_2; + state <= ST_WRITE_1; + end + endcase + data_cnt <= data_cnt + 1'b1; + end + end + ST_WRITE_1: begin + pmp_wr <= 1; + state <= ST_WRITE_2; + end + ST_WRITE_2: begin + // exited upon new transaction + pmp_wr <= 0; + end + ST_READ_0: begin + pmp_addr_valid <= 1; + + // delay a few cycles + read_cnt <= read_cnt + 1'b1; + if(read_cnt == 4-1) begin + // load the buffer with the current data + // and give the current buffer contents to bridge + spis_word_tx <= pmp_rd_data_e; + spis_tx <= 1; + + state <= ST_READ_1; + end + end + ST_READ_1: begin + pmp_rd <= 1; + state <= ST_READ_2; + end + ST_READ_2: begin + pmp_rd <= 0; + if(spis_done) begin + spis_tx <= 0; + state <= ST_READ_3; + end + end + ST_READ_3: begin + // exited upon new transaction + end + endcase + + + + + // + // word transmit + // + spis_done <= 0; + case(spis) + ST_SIDLE: begin + spis_count <= 0; + + phy_spiclk <= 1'bZ; + phy_spimosi <= 1'bZ; + phy_spimiso <= 1'bZ; + + if(spis_tx) begin + spis_word <= spis_word_tx; + spis <= ST_SEND_N; + end + end + // drive high first + ST_SEND_N: begin + phy_spiclk <= 1'b1; + phy_spimosi <= 1'b1; + phy_spimiso <= 1'b1; + spis <= ST_SEND_0; + end + // tx, shift out bits + ST_SEND_0: begin + phy_spiclk <= 0; + spis <= ST_SEND_1; + phy_spimosi <= spis_word[31]; + phy_spimiso <= spis_word[30]; + spis_word <= {spis_word[29:0], 2'b00}; + end + ST_SEND_1: begin + phy_spiclk <= 1; + spis <= ST_SEND_0; + spis_count <= spis_count + 1'b1; + if(spis_count == 15) spis <= ST_SEND_2; + end + ST_SEND_2: begin + phy_spiclk <= 1'b1; + phy_spimosi <= 1'b1; + phy_spimiso <= 1'b1; + spis <= ST_SEND_3; + spis_done <= 1; + end + ST_SEND_3: begin + spis <= ST_SIDLE; + end + endcase + + if(phy_spiss_s) begin + // select is high, go back to reset + state <= ST_RESET; + spis <= ST_SIDLE; + end + +end + + +// +// clock domain: phy_spiclk rising edge +// + reg [1:0] rx_latch_idx; + reg [7:0] rx_dat; + reg [7:0] rx_byte; // latched by clk, but upon a synchronized trigger + reg rx_byte_done; + +always @(posedge phy_spiclk or posedge phy_spiss) begin + + if(phy_spiss) begin + // reset + rx_byte_done <= 0; + rx_latch_idx <= 0; + + end else begin + // spiclk rising edge, latch data + rx_byte_done <= 0; + + case(rx_latch_idx) + 0: begin rx_dat[7:6] <= {phy_spimosi, phy_spimiso}; rx_latch_idx <= 1; end + 1: begin rx_dat[5:4] <= {phy_spimosi, phy_spimiso}; rx_latch_idx <= 2; end + 2: begin rx_dat[3:2] <= {phy_spimosi, phy_spimiso}; rx_latch_idx <= 3; end + 3: begin + // last bit of the byte + rx_byte <= {rx_dat[7:2], phy_spimosi, phy_spimiso}; + rx_latch_idx <= 0; + rx_byte_done <= 1; + end + endcase + end +end + +endmodule diff --git a/platform/pocket/io_pad_controller.v b/platform/pocket/io_pad_controller.v new file mode 100644 index 0000000..c3f40e6 --- /dev/null +++ b/platform/pocket/io_pad_controller.v @@ -0,0 +1,328 @@ +// Software License Agreement + +// The software supplied herewith by Analogue Enterprises Limited (the "Company”), +// the Analogue Pocket Framework (“APF”), is provided and licensed to you, the +// Company's customer, solely for use in designing, testing and creating +// applications for use with Company's Products or Services. The software is +// owned by the Company and/or its licensors, and is protected under applicable +// laws, including, but not limited to, U.S. copyright law. All rights are +// reserved. By using the APF code you are agreeing to the terms of the End User +// License Agreement (“EULA”) located at [https://www.analogue.link/pocket-eula] +// and incorporated herein by reference. To the extent any use of the APF requires +// application of the MIT License or the GNU General Public License and terms of +// this APF Software License Agreement and EULA are inconsistent with such license, +// the applicable terms of the MIT License or the GNU General Public License, as +// applicable, will prevail. + +// THE SOFTWARE IS PROVIDED "AS-IS" AND WE EXPRESSLY DISCLAIM ANY IMPLIED +// WARRANTIES TO THE FULLEST EXTENT PROVIDED BY LAW, INCLUDING BUT NOT LIMITED TO, +// ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR +// NON-INFRINGEMENT. TO THE EXTENT APPLICABLE LAWS PROHIBIT TERMS OF USE FROM +// DISCLAIMING ANY IMPLIED WARRANTY, SUCH IMPLIED WARRANTY SHALL BE LIMITED TO THE +// MINIMUM WARRANTY PERIOD REQUIRED BY LAW, AND IF NO SUCH PERIOD IS REQUIRED, +// THEN THIRTY (30) DAYS FROM FIRST USE OF THE SOFTWARE. WE CANNOT GUARANTEE AND +// DO NOT PROMISE ANY SPECIFIC RESULTS FROM USE OF THE SOFTWARE. WITHOUT LIMITING +// THE FOREGOING, WE DO NOT WARRANT THAT THE SOFTWARE WILL BE UNINTERRUPTED OR +// ERROR-FREE. IN NO EVENT WILL WE BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY +// INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, SPECIAL OR PUNITIVE DAMAGES, +// INCLUDING BUT NOT LIMITED TO, LOST PROFITS ARISING OUT OF YOUR USE, OR +// INABILITY TO USE, THE SOFTWARE, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY +// OF SUCH DAMAGES. UNDER NO CIRCUMSTANCES SHALL OUR LIABILITY TO YOU FOR ANY +// CLAIM OR CAUSE OF ACTION WHATSOEVER, AND REGARDLESS OF THE FORM OF THE ACTION, +// WHETHER ARISING IN CONTRACT, TORT OR OTHERWISE, EXCEED THE AMOUNT PAID BY YOU +// TO US, IF ANY, DURING THE 90 DAY PERIOD IMMEDIATELY PRECEDING THE DATE ON WHICH +// YOU FIRST ASSERT ANY SUCH CLAIM. THE FOREGOING LIMITATIONS SHALL APPLY TO THE +// FULLEST EXTENT PERMITTED BY APPLICABLE LAW. +// +// pad controller +// 2020-08-17 Analogue +// + +module io_pad_controller ( + +input wire clk, +input wire reset_n, + +inout reg pad_1wire, + +output reg [31:0] cont1_key, +output reg [31:0] cont2_key, +output reg [31:0] cont3_key, +output reg [31:0] cont4_key, +output reg [31:0] cont1_joy, +output reg [31:0] cont2_joy, +output reg [31:0] cont3_joy, +output reg [31:0] cont4_joy, +output reg [15:0] cont1_trig, +output reg [15:0] cont2_trig, +output reg [15:0] cont3_trig, +output reg [15:0] cont4_trig, + +output reg rx_timed_out +); + + wire reset_n_s; +synch_3 s00(reset_n, reset_n_s, clk); + + wire pad_1wire_s, pad_1wire_r, pad_1wire_f; +synch_3 s01(pad_1wire, pad_1wire_s, clk, pad_1wire_r, pad_1wire_f); + + +// +// protocol fsm +// + + reg [20:0] rx_timeout; // ~28ms + + reg [15:0] auto_poll_cnt; // 882us + reg auto_poll_queue; + + reg [18:0] heartbeat_cnt; // 7ms + reg heartbeat_queue; + + + localparam ST_RESET = 'd0; + localparam ST_IDLE = 'd1; + localparam ST_RX_BUTTON_1 = 'd2; + localparam ST_RX_BUTTON_2 = 'd3; + localparam ST_TX_SCALER = 'd4; + localparam ST_END_TX = 'd5; + + reg [3:0] state; + reg [3:0] cnt; + +always @(posedge clk) begin + tx_word_start <= 0; + + auto_poll_cnt <= auto_poll_cnt + 1'b1; + heartbeat_cnt <= heartbeat_cnt + 1'b1; + + // increment rx timeout, override and reset when idle below + rx_timeout <= rx_timeout + 1'b1; + + case(state) + ST_RESET: begin + reset_tr_n <= 0; + rx_timed_out <= 0; + + if(&rx_timeout[19:0]) begin + state <= ST_IDLE; + end + end + ST_IDLE: begin + // idle state + reset_tr_n <= 1; + rx_timeout <= 0; + cnt <= 0; + if(auto_poll_queue) begin + auto_poll_queue <= 0; + + tx_word_start <= 1; + tx_word <= 32'h4A10000C; + + state <= ST_RX_BUTTON_1; + end else if(heartbeat_queue) begin + heartbeat_queue <= 0; + + tx_word_start <= 1; + tx_word <= 32'h4AFE0000; + + state <= ST_END_TX; + end + end + // receive button words + ST_RX_BUTTON_1: begin + if(tx_word_done) begin + state <= ST_RX_BUTTON_2; + end + end + ST_RX_BUTTON_2: begin + if(rx_word_done) begin + cnt <= cnt + 1'b1; + case(cnt) + 0: cont1_key <= rx_word; + 1: cont1_joy <= rx_word; + 2: cont1_trig <= rx_word[15:0]; + + 3: cont2_key <= rx_word; + 4: cont2_joy <= rx_word; + 5: cont2_trig <= rx_word[15:0]; + + 6: cont3_key <= rx_word; + 7: cont3_joy <= rx_word; + 8: cont3_trig <= rx_word[15:0]; + + 9: cont4_key <= rx_word; + 10: cont4_joy <= rx_word; + 11: begin + cont4_trig <= rx_word[15:0]; + state <= ST_IDLE; + end + endcase + end + end + // do nothing + ST_END_TX: begin + // done sending, idle again + if(tx_word_done) begin + state <= ST_IDLE; + end + end + endcase + + + if(&auto_poll_cnt) begin + auto_poll_queue <= 1; + end + if(&heartbeat_cnt) begin + heartbeat_queue <= 1; + end + + if(&rx_timeout) begin + // reset protocol FSM which will also reset t/r engine + rx_timed_out <= 1; + rx_timeout <= 0; + state <= ST_RESET; + end + + if(~reset_n_s) begin + state <= ST_RESET; + end +end + + + + + +// +// word receive/transmit engine +// + reg reset_tr_n; + localparam BITLEN = 60; + + reg rx_word_done; + reg [31:0] rx_word_shift; + reg [31:0] rx_word; + + reg tx_word_start, tx_word_start_1; + reg tx_word_done; + reg [31:0] tx_word; + reg [31:0] tx_word_shift; + + reg [7:0] tr_cnt; + reg [5:0] tr_bit; + + localparam TR_IDLE = 'd1; + localparam TR_TX_START = 'd2; + localparam TR_TX_CONTINUE = 'd3; + localparam TR_TX_DONE = 'd4; + localparam TR_RX_START = 'd5; + localparam TR_RX_WAITEDGE = 'd6; + localparam TR_RX_DONE = 'd7; + + reg [3:0] tr_state; + +always @(posedge clk) begin + + rx_word_done <= 0; + tx_word_done <= 0; + + tx_word_start_1 <= tx_word_start; + + case(tr_state) + TR_IDLE: begin + tr_bit <= 0; + tr_cnt <= 0; + + pad_1wire <= 1'bZ; + + if(tx_word_start & ~tx_word_start_1) begin + // transmit word + tx_word_shift <= tx_word; + tr_state <= TR_TX_START; + end + + if(pad_1wire_f) begin + // receive word + tr_state <= TR_RX_START; + end + end + + // transmit 32bit + TR_TX_START: begin + // insert delay + tr_cnt <= tr_cnt + 1'b1; + if(&tr_cnt) begin + // drive from tristate(high) to explicitly high to prevent glitching + pad_1wire <= 1'b1; + tr_state <= TR_TX_CONTINUE; + end + end + TR_TX_CONTINUE: begin + tr_cnt <= tr_cnt + 1'b1; + case(tr_cnt) + 0: begin + pad_1wire <= 1'b0; + end + (BITLEN/3): begin + pad_1wire <= tx_word_shift[31]; + end + (BITLEN*2/3): begin + pad_1wire <= 1'b1; + end + (BITLEN-1): begin + tr_cnt <= 0; + tx_word_shift <= {tx_word_shift[30:0], 1'b1}; + + tr_bit <= tr_bit + 1'b1; + if(tr_bit == 31) begin + tr_state <= TR_TX_DONE; + end + end + endcase + end + TR_TX_DONE: begin + tx_word_done <= 1; + tr_state <= TR_IDLE; + end + + // receive 32bit + TR_RX_START: begin + tr_cnt <= tr_cnt + 1'b1; + case(tr_cnt) + (BITLEN/2-4): begin + rx_word_shift <= {rx_word_shift[30:0], pad_1wire_s}; + end + (BITLEN*5/6): begin + tr_cnt <= 0; + + // wait for next falling edge + tr_state <= TR_RX_WAITEDGE; + tr_bit <= tr_bit + 1'b1; + if(tr_bit == 31) begin + // if this is bit32, don't wait and finish + tr_state <= TR_RX_DONE; + end + end + endcase + end + TR_RX_WAITEDGE: begin + if(pad_1wire_f) begin + tr_state <= TR_RX_START; + end + end + TR_RX_DONE: begin + rx_word <= rx_word_shift; + rx_word_done <= 1; + tr_state <= TR_IDLE; + end + + default: begin + tr_state <= TR_IDLE; + end + endcase + + if(~reset_n_s | ~reset_tr_n) tr_state <= TR_IDLE; +end + +endmodule diff --git a/platform/pocket/mf_datatable.qip b/platform/pocket/mf_datatable.qip new file mode 100644 index 0000000..9c3a0f7 --- /dev/null +++ b/platform/pocket/mf_datatable.qip @@ -0,0 +1,4 @@ +set_global_assignment -name IP_TOOL_NAME "RAM: 2-PORT" +set_global_assignment -name IP_TOOL_VERSION "18.1" +set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}" +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "mf_datatable.v"] diff --git a/platform/pocket/mf_datatable.v b/platform/pocket/mf_datatable.v new file mode 100644 index 0000000..33c26be --- /dev/null +++ b/platform/pocket/mf_datatable.v @@ -0,0 +1,247 @@ +// megafunction wizard: %RAM: 2-PORT% +// GENERATION: STANDARD +// VERSION: WM1.0 +// MODULE: altsyncram + +// ============================================================ +// File Name: mf_datatable.v +// Megafunction Name(s): +// altsyncram +// +// Simulation Library Files(s): +// altera_mf +// ============================================================ +// ************************************************************ +// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! +// +// 18.1.1 Build 646 04/11/2019 SJ Lite Edition +// ************************************************************ + + +//Copyright (C) 2019 Intel Corporation. All rights reserved. +//Your use of Intel Corporation's design tools, logic functions +//and other software and tools, and any partner logic +//functions, and any output files from any of the foregoing +//(including device programming or simulation files), and any +//associated documentation or information are expressly subject +//to the terms and conditions of the Intel Program License +//Subscription Agreement, the Intel Quartus Prime License Agreement, +//the Intel FPGA IP License Agreement, or other applicable license +//agreement, including, without limitation, that your use is for +//the sole purpose of programming logic devices manufactured by +//Intel and sold by Intel or its authorized distributors. Please +//refer to the applicable agreement for further details, at +//https://fpgasoftware.intel.com/eula. + + +// synopsys translate_off +`timescale 1 ps / 1 ps +// synopsys translate_on +module mf_datatable ( + address_a, + address_b, + clock_a, + clock_b, + data_a, + data_b, + wren_a, + wren_b, + q_a, + q_b); + + input [7:0] address_a; + input [7:0] address_b; + input clock_a; + input clock_b; + input [31:0] data_a; + input [31:0] data_b; + input wren_a; + input wren_b; + output [31:0] q_a; + output [31:0] q_b; +`ifndef ALTERA_RESERVED_QIS +// synopsys translate_off +`endif + tri1 clock_a; + tri0 wren_a; + tri0 wren_b; +`ifndef ALTERA_RESERVED_QIS +// synopsys translate_on +`endif + + wire [31:0] sub_wire0; + wire [31:0] sub_wire1; + wire [31:0] q_a = sub_wire0[31:0]; + wire [31:0] q_b = sub_wire1[31:0]; + + altsyncram altsyncram_component ( + .address_a (address_a), + .address_b (address_b), + .clock0 (clock_a), + .clock1 (clock_b), + .data_a (data_a), + .data_b (data_b), + .wren_a (wren_a), + .wren_b (wren_b), + .q_a (sub_wire0), + .q_b (sub_wire1), + .aclr0 (1'b0), + .aclr1 (1'b0), + .addressstall_a (1'b0), + .addressstall_b (1'b0), + .byteena_a (1'b1), + .byteena_b (1'b1), + .clocken0 (1'b1), + .clocken1 (1'b1), + .clocken2 (1'b1), + .clocken3 (1'b1), + .eccstatus (), + .rden_a (1'b1), + .rden_b (1'b1)); + defparam + altsyncram_component.address_reg_b = "CLOCK1", + altsyncram_component.clock_enable_input_a = "BYPASS", + altsyncram_component.clock_enable_input_b = "BYPASS", + altsyncram_component.clock_enable_output_a = "BYPASS", + altsyncram_component.clock_enable_output_b = "BYPASS", + altsyncram_component.indata_reg_b = "CLOCK1", + altsyncram_component.init_file = "./apf/build_id.mif", + altsyncram_component.intended_device_family = "Cyclone V", + altsyncram_component.lpm_type = "altsyncram", + altsyncram_component.numwords_a = 256, + altsyncram_component.numwords_b = 256, + altsyncram_component.operation_mode = "BIDIR_DUAL_PORT", + altsyncram_component.outdata_aclr_a = "NONE", + altsyncram_component.outdata_aclr_b = "NONE", + altsyncram_component.outdata_reg_a = "CLOCK0", + altsyncram_component.outdata_reg_b = "CLOCK1", + altsyncram_component.power_up_uninitialized = "FALSE", + altsyncram_component.read_during_write_mode_port_a = "NEW_DATA_NO_NBE_READ", + altsyncram_component.read_during_write_mode_port_b = "NEW_DATA_NO_NBE_READ", + altsyncram_component.widthad_a = 8, + altsyncram_component.widthad_b = 8, + altsyncram_component.width_a = 32, + altsyncram_component.width_b = 32, + altsyncram_component.width_byteena_a = 1, + altsyncram_component.width_byteena_b = 1, + altsyncram_component.wrcontrol_wraddress_reg_b = "CLOCK1"; + + +endmodule + +// ============================================================ +// CNX file retrieval info +// ============================================================ +// Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0" +// Retrieval info: PRIVATE: ADDRESSSTALL_B NUMERIC "0" +// Retrieval info: PRIVATE: BYTEENA_ACLR_A NUMERIC "0" +// Retrieval info: PRIVATE: BYTEENA_ACLR_B NUMERIC "0" +// Retrieval info: PRIVATE: BYTE_ENABLE_A NUMERIC "0" +// Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0" +// Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8" +// Retrieval info: PRIVATE: BlankMemory NUMERIC "0" +// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0" +// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "0" +// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0" +// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0" +// Retrieval info: PRIVATE: CLRdata NUMERIC "0" +// Retrieval info: PRIVATE: CLRq NUMERIC "0" +// Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0" +// Retrieval info: PRIVATE: CLRrren NUMERIC "0" +// Retrieval info: PRIVATE: CLRwraddress NUMERIC "0" +// Retrieval info: PRIVATE: CLRwren NUMERIC "0" +// Retrieval info: PRIVATE: Clock NUMERIC "5" +// Retrieval info: PRIVATE: Clock_A NUMERIC "0" +// Retrieval info: PRIVATE: Clock_B NUMERIC "0" +// Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0" +// Retrieval info: PRIVATE: INDATA_ACLR_B NUMERIC "0" +// Retrieval info: PRIVATE: INDATA_REG_B NUMERIC "1" +// Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A" +// Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0" +// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V" +// Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0" +// Retrieval info: PRIVATE: JTAG_ID STRING "NONE" +// Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0" +// Retrieval info: PRIVATE: MEMSIZE NUMERIC "8192" +// Retrieval info: PRIVATE: MEM_IN_BITS NUMERIC "0" +// Retrieval info: PRIVATE: MIFfilename STRING "./apf/build_id.mif" +// Retrieval info: PRIVATE: OPERATION_MODE NUMERIC "3" +// Retrieval info: PRIVATE: OUTDATA_ACLR_B NUMERIC "0" +// Retrieval info: PRIVATE: OUTDATA_REG_B NUMERIC "1" +// Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0" +// Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_MIXED_PORTS NUMERIC "2" +// Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "3" +// Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_B NUMERIC "3" +// Retrieval info: PRIVATE: REGdata NUMERIC "1" +// Retrieval info: PRIVATE: REGq NUMERIC "1" +// Retrieval info: PRIVATE: REGrdaddress NUMERIC "0" +// Retrieval info: PRIVATE: REGrren NUMERIC "0" +// Retrieval info: PRIVATE: REGwraddress NUMERIC "1" +// Retrieval info: PRIVATE: REGwren NUMERIC "1" +// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" +// Retrieval info: PRIVATE: USE_DIFF_CLKEN NUMERIC "0" +// Retrieval info: PRIVATE: UseDPRAM NUMERIC "1" +// Retrieval info: PRIVATE: VarWidth NUMERIC "0" +// Retrieval info: PRIVATE: WIDTH_READ_A NUMERIC "32" +// Retrieval info: PRIVATE: WIDTH_READ_B NUMERIC "32" +// Retrieval info: PRIVATE: WIDTH_WRITE_A NUMERIC "32" +// Retrieval info: PRIVATE: WIDTH_WRITE_B NUMERIC "32" +// Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0" +// Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "1" +// Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0" +// Retrieval info: PRIVATE: enable NUMERIC "0" +// Retrieval info: PRIVATE: rden NUMERIC "0" +// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all +// Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK1" +// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS" +// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "BYPASS" +// Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS" +// Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS" +// Retrieval info: CONSTANT: INDATA_REG_B STRING "CLOCK1" +// Retrieval info: CONSTANT: INIT_FILE STRING "./apf/build_id.mif" +// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V" +// Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram" +// Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "256" +// Retrieval info: CONSTANT: NUMWORDS_B NUMERIC "256" +// Retrieval info: CONSTANT: OPERATION_MODE STRING "BIDIR_DUAL_PORT" +// Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE" +// Retrieval info: CONSTANT: OUTDATA_ACLR_B STRING "NONE" +// Retrieval info: CONSTANT: OUTDATA_REG_A STRING "CLOCK0" +// Retrieval info: CONSTANT: OUTDATA_REG_B STRING "CLOCK1" +// Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE" +// Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_A STRING "NEW_DATA_NO_NBE_READ" +// Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_B STRING "NEW_DATA_NO_NBE_READ" +// Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "8" +// Retrieval info: CONSTANT: WIDTHAD_B NUMERIC "8" +// Retrieval info: CONSTANT: WIDTH_A NUMERIC "32" +// Retrieval info: CONSTANT: WIDTH_B NUMERIC "32" +// Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1" +// Retrieval info: CONSTANT: WIDTH_BYTEENA_B NUMERIC "1" +// Retrieval info: CONSTANT: WRCONTROL_WRADDRESS_REG_B STRING "CLOCK1" +// Retrieval info: USED_PORT: address_a 0 0 8 0 INPUT NODEFVAL "address_a[7..0]" +// Retrieval info: USED_PORT: address_b 0 0 8 0 INPUT NODEFVAL "address_b[7..0]" +// Retrieval info: USED_PORT: clock_a 0 0 0 0 INPUT VCC "clock_a" +// Retrieval info: USED_PORT: clock_b 0 0 0 0 INPUT NODEFVAL "clock_b" +// Retrieval info: USED_PORT: data_a 0 0 32 0 INPUT NODEFVAL "data_a[31..0]" +// Retrieval info: USED_PORT: data_b 0 0 32 0 INPUT NODEFVAL "data_b[31..0]" +// Retrieval info: USED_PORT: q_a 0 0 32 0 OUTPUT NODEFVAL "q_a[31..0]" +// Retrieval info: USED_PORT: q_b 0 0 32 0 OUTPUT NODEFVAL "q_b[31..0]" +// Retrieval info: USED_PORT: wren_a 0 0 0 0 INPUT GND "wren_a" +// Retrieval info: USED_PORT: wren_b 0 0 0 0 INPUT GND "wren_b" +// Retrieval info: CONNECT: @address_a 0 0 8 0 address_a 0 0 8 0 +// Retrieval info: CONNECT: @address_b 0 0 8 0 address_b 0 0 8 0 +// Retrieval info: CONNECT: @clock0 0 0 0 0 clock_a 0 0 0 0 +// Retrieval info: CONNECT: @clock1 0 0 0 0 clock_b 0 0 0 0 +// Retrieval info: CONNECT: @data_a 0 0 32 0 data_a 0 0 32 0 +// Retrieval info: CONNECT: @data_b 0 0 32 0 data_b 0 0 32 0 +// Retrieval info: CONNECT: @wren_a 0 0 0 0 wren_a 0 0 0 0 +// Retrieval info: CONNECT: @wren_b 0 0 0 0 wren_b 0 0 0 0 +// Retrieval info: CONNECT: q_a 0 0 32 0 @q_a 0 0 32 0 +// Retrieval info: CONNECT: q_b 0 0 32 0 @q_b 0 0 32 0 +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_datatable.v TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_datatable.inc FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_datatable.cmp FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_datatable.bsf FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_datatable_inst.v FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_datatable_bb.v FALSE +// Retrieval info: LIB_FILE: altera_mf diff --git a/platform/pocket/mf_ddio_bidir_12.qip b/platform/pocket/mf_ddio_bidir_12.qip new file mode 100644 index 0000000..40c4266 --- /dev/null +++ b/platform/pocket/mf_ddio_bidir_12.qip @@ -0,0 +1,5 @@ +set_global_assignment -name IP_TOOL_NAME "ALTDDIO_BIDIR" +set_global_assignment -name IP_TOOL_VERSION "18.1" +set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}" +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "mf_ddio_bidir_12.v"] +set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "mf_ddio_bidir_12.ppf"] diff --git a/platform/pocket/mf_ddio_bidir_12.v b/platform/pocket/mf_ddio_bidir_12.v new file mode 100644 index 0000000..6bac1ab --- /dev/null +++ b/platform/pocket/mf_ddio_bidir_12.v @@ -0,0 +1,134 @@ +// megafunction wizard: %ALTDDIO_BIDIR% +// GENERATION: STANDARD +// VERSION: WM1.0 +// MODULE: ALTDDIO_BIDIR + +// ============================================================ +// File Name: mf_ddio_bidir_12.v +// Megafunction Name(s): +// ALTDDIO_BIDIR +// +// Simulation Library Files(s): +// altera_mf +// ============================================================ +// ************************************************************ +// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! +// +// 18.1.1 Build 646 04/11/2019 SJ Lite Edition +// ************************************************************ + + +//Copyright (C) 2019 Intel Corporation. All rights reserved. +//Your use of Intel Corporation's design tools, logic functions +//and other software and tools, and any partner logic +//functions, and any output files from any of the foregoing +//(including device programming or simulation files), and any +//associated documentation or information are expressly subject +//to the terms and conditions of the Intel Program License +//Subscription Agreement, the Intel Quartus Prime License Agreement, +//the Intel FPGA IP License Agreement, or other applicable license +//agreement, including, without limitation, that your use is for +//the sole purpose of programming logic devices manufactured by +//Intel and sold by Intel or its authorized distributors. Please +//refer to the applicable agreement for further details, at +//https://fpgasoftware.intel.com/eula. + + +// synopsys translate_off +`timescale 1 ps / 1 ps +// synopsys translate_on +module mf_ddio_bidir_12 ( + datain_h, + datain_l, + inclock, + oe, + outclock, + dataout_h, + dataout_l, + padio); + + input [11:0] datain_h; + input [11:0] datain_l; + input inclock; + input oe; + input outclock; + output [11:0] dataout_h; + output [11:0] dataout_l; + inout [11:0] padio; + + wire [11:0] sub_wire0; + wire [11:0] sub_wire1; + wire [11:0] dataout_h = sub_wire0[11:0]; + wire [11:0] dataout_l = sub_wire1[11:0]; + + altddio_bidir ALTDDIO_BIDIR_component ( + .datain_h (datain_h), + .datain_l (datain_l), + .inclock (inclock), + .oe (oe), + .outclock (outclock), + .padio (padio), + .dataout_h (sub_wire0), + .dataout_l (sub_wire1), + .aclr (1'b0), + .aset (1'b0), + .combout (), + .dqsundelayedout (), + .inclocken (1'b1), + .oe_out (), + .outclocken (1'b1), + .sclr (1'b0), + .sset (1'b0)); + defparam + ALTDDIO_BIDIR_component.extend_oe_disable = "OFF", + ALTDDIO_BIDIR_component.implement_input_in_lcell = "OFF", + ALTDDIO_BIDIR_component.intended_device_family = "Cyclone V", + ALTDDIO_BIDIR_component.invert_output = "OFF", + ALTDDIO_BIDIR_component.lpm_hint = "UNUSED", + ALTDDIO_BIDIR_component.lpm_type = "altddio_bidir", + ALTDDIO_BIDIR_component.oe_reg = "UNREGISTERED", + ALTDDIO_BIDIR_component.power_up_high = "OFF", + ALTDDIO_BIDIR_component.width = 12; + + +endmodule + +// ============================================================ +// CNX file retrieval info +// ============================================================ +// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all +// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone V" +// Retrieval info: CONSTANT: EXTEND_OE_DISABLE STRING "OFF" +// Retrieval info: CONSTANT: IMPLEMENT_INPUT_IN_LCELL STRING "OFF" +// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone V" +// Retrieval info: CONSTANT: INVERT_OUTPUT STRING "OFF" +// Retrieval info: CONSTANT: LPM_HINT STRING "UNUSED" +// Retrieval info: CONSTANT: LPM_TYPE STRING "altddio_bidir" +// Retrieval info: CONSTANT: OE_REG STRING "UNREGISTERED" +// Retrieval info: CONSTANT: POWER_UP_HIGH STRING "OFF" +// Retrieval info: CONSTANT: WIDTH NUMERIC "12" +// Retrieval info: USED_PORT: datain_h 0 0 12 0 INPUT NODEFVAL "datain_h[11..0]" +// Retrieval info: CONNECT: @datain_h 0 0 12 0 datain_h 0 0 12 0 +// Retrieval info: USED_PORT: datain_l 0 0 12 0 INPUT NODEFVAL "datain_l[11..0]" +// Retrieval info: CONNECT: @datain_l 0 0 12 0 datain_l 0 0 12 0 +// Retrieval info: USED_PORT: dataout_h 0 0 12 0 OUTPUT NODEFVAL "dataout_h[11..0]" +// Retrieval info: CONNECT: dataout_h 0 0 12 0 @dataout_h 0 0 12 0 +// Retrieval info: USED_PORT: dataout_l 0 0 12 0 OUTPUT NODEFVAL "dataout_l[11..0]" +// Retrieval info: CONNECT: dataout_l 0 0 12 0 @dataout_l 0 0 12 0 +// Retrieval info: USED_PORT: inclock 0 0 0 0 INPUT_CLK_EXT NODEFVAL "inclock" +// Retrieval info: CONNECT: @inclock 0 0 0 0 inclock 0 0 0 0 +// Retrieval info: USED_PORT: oe 0 0 0 0 INPUT NODEFVAL "oe" +// Retrieval info: CONNECT: @oe 0 0 0 0 oe 0 0 0 0 +// Retrieval info: USED_PORT: outclock 0 0 0 0 INPUT_CLK_EXT NODEFVAL "outclock" +// Retrieval info: CONNECT: @outclock 0 0 0 0 outclock 0 0 0 0 +// Retrieval info: USED_PORT: padio 0 0 12 0 BIDIR NODEFVAL "padio[11..0]" +// Retrieval info: CONNECT: padio 0 0 12 0 @padio 0 0 12 0 +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12.v TRUE FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12.qip TRUE FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12.bsf FALSE TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12_inst.v FALSE TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12_bb.v FALSE TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12.inc FALSE TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12.cmp FALSE TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL mf_ddio_bidir_12.ppf TRUE FALSE +// Retrieval info: LIB_FILE: altera_mf diff --git a/platform/pocket/pocket.tcl b/platform/pocket/pocket.tcl new file mode 100644 index 0000000..034a9b4 --- /dev/null +++ b/platform/pocket/pocket.tcl @@ -0,0 +1,718 @@ +# ============================================================================== +# SPDX-License-Identifier: CC0-1.0 +# SPDX-FileType: SOURCE +# SPDX-FileCopyrightText: (c) 2022, OpenGateware authors and contributors +# ============================================================================== +# +# Platform Global/Location/Instance Assignments +# +# ============================================================================== +# Hardware Information +# ============================================================================== +set_global_assignment -name FAMILY "Cyclone V" +set_global_assignment -name DEVICE 5CEBA4F23C8 +set_global_assignment -name DEVICE_FILTER_PACKAGE FBGA +set_global_assignment -name DEVICE_FILTER_PIN_COUNT 484 +set_global_assignment -name DEVICE_FILTER_SPEED_GRADE 8 + +# ============================================================================== +# Classic Timing Assignments +# ============================================================================== +set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0 +set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85 +set_global_assignment -name TIMEQUEST_MULTICORNER_ANALYSIS ON + +# ============================================================================== +# Assembler Assignments +# ============================================================================== +set_global_assignment -name ENABLE_OCT_DONE OFF +set_global_assignment -name USE_CONFIGURATION_DEVICE ON +set_global_assignment -name GENERATE_RBF_FILE ON + +# ============================================================================== +# Power Estimation Assignments +# ============================================================================== +set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "23 MM HEAT SINK WITH 200 LFPM AIRFLOW" +set_global_assignment -name POWER_BOARD_THERMAL_MODEL "NONE (CONSERVATIVE)" + +# ============================================================================== +# Signal Tap Assignments +# ============================================================================== +set_global_assignment -name ENABLE_SIGNALTAP ON + +# ============================================================================== +# Pin & Location Assignments +# ============================================================================== +set_location_assignment PIN_V15 -to clk_74a +set_location_assignment PIN_H16 -to clk_74b +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to clk_74a +set_instance_assignment -name IO_STANDARD "1.8 V" -to clk_74b + +# ============================================================================== +# SPI bus with Aristotle +# ============================================================================== +set_location_assignment PIN_T17 -to bridge_spiclk +set_location_assignment PIN_M21 -to bridge_spimiso +set_location_assignment PIN_M20 -to bridge_spimosi +set_location_assignment PIN_L19 -to bridge_1wire +set_location_assignment PIN_H14 -to bridge_spiss +set_instance_assignment -name IO_STANDARD "1.8 V" -to bridge_spiclk +set_instance_assignment -name IO_STANDARD "1.8 V" -to bridge_spimiso +set_instance_assignment -name IO_STANDARD "1.8 V" -to bridge_spimosi +set_instance_assignment -name IO_STANDARD "1.8 V" -to bridge_1wire +set_instance_assignment -name IO_STANDARD "1.8 V" -to bridge_spiss +set_instance_assignment -name CURRENT_STRENGTH_NEW 8MA -to bridge_spiclk +set_instance_assignment -name CURRENT_STRENGTH_NEW 8MA -to bridge_spimiso +set_instance_assignment -name CURRENT_STRENGTH_NEW 8MA -to bridge_spimosi +set_instance_assignment -name CURRENT_STRENGTH_NEW 8MA -to bridge_1wire +set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_spiclk +set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_spimiso +set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_spimosi +set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_1wire + +# ============================================================================== +# Cartridge interface +# ============================================================================== +set_location_assignment PIN_AA9 -to cart_tran_bank0[7] +set_location_assignment PIN_AB8 -to cart_tran_bank0[6] +set_location_assignment PIN_AA8 -to cart_tran_bank0[5] +set_location_assignment PIN_AB7 -to cart_tran_bank0[4] +set_location_assignment PIN_AB6 -to cart_tran_bank0_dir +set_location_assignment PIN_AA10 -to cart_tran_bank1[7] +set_location_assignment PIN_AB10 -to cart_tran_bank1[6] +set_location_assignment PIN_Y10 -to cart_tran_bank1[5] +set_location_assignment PIN_AB11 -to cart_tran_bank1[4] +set_location_assignment PIN_Y11 -to cart_tran_bank1[3] +set_location_assignment PIN_AB12 -to cart_tran_bank1[2] +set_location_assignment PIN_AA12 -to cart_tran_bank1[1] +set_location_assignment PIN_AB13 -to cart_tran_bank1[0] +set_location_assignment PIN_AA13 -to cart_tran_bank1_dir +set_location_assignment PIN_AB15 -to cart_tran_bank2[7] +set_location_assignment PIN_AA15 -to cart_tran_bank2[6] +set_location_assignment PIN_AB17 -to cart_tran_bank2[5] +set_location_assignment PIN_AA17 -to cart_tran_bank2[4] +set_location_assignment PIN_AB18 -to cart_tran_bank2[3] +set_location_assignment PIN_AB20 -to cart_tran_bank2[0] +set_location_assignment PIN_AA19 -to cart_tran_bank2[1] +set_location_assignment PIN_AA18 -to cart_tran_bank2[2] +set_location_assignment PIN_AA14 -to cart_tran_bank2_dir +set_location_assignment PIN_AA20 -to cart_tran_bank3[7] +set_location_assignment PIN_AB21 -to cart_tran_bank3[6] +set_location_assignment PIN_AB22 -to cart_tran_bank3[5] +set_location_assignment PIN_AA22 -to cart_tran_bank3[4] +set_location_assignment PIN_Y21 -to cart_tran_bank3[3] +set_location_assignment PIN_Y22 -to cart_tran_bank3[2] +set_location_assignment PIN_W21 -to cart_tran_bank3[1] +set_location_assignment PIN_W22 -to cart_tran_bank3[0] +set_location_assignment PIN_V21 -to cart_tran_bank3_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank0[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank0[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank0[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank0[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank0_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank1_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank2_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_bank3_dir + +# ============================================================================== +# GBA CS2#/RES# +# ============================================================================== +set_location_assignment PIN_AB5 -to cart_tran_pin30_dir +set_location_assignment PIN_L8 -to cart_tran_pin30 +set_location_assignment PIN_L17 -to cart_pin30_pwroff_reset +set_instance_assignment -name IO_STANDARD "1.8 V" -to cart_pin30_pwroff_reset +set_instance_assignment -name IO_STANDARD "1.8 V" -to cart_tran_pin30 +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_pin30_dir +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cart_pin30_pwroff_reset +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cart_tran_pin30 + +# ============================================================================== +# GBA IRQ/DRQ +# ============================================================================== +set_location_assignment PIN_K9 -to cart_tran_pin31 +set_location_assignment PIN_U22 -to cart_tran_pin31_dir +set_instance_assignment -name IO_STANDARD "1.8 V" -to cart_tran_pin31 +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to cart_tran_pin31_dir +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cart_tran_pin31 + +# ============================================================================== +# GBA link port +# ============================================================================== +set_location_assignment PIN_V10 -to port_tran_si +set_location_assignment PIN_V9 -to port_tran_si_dir +set_location_assignment PIN_J11 -to port_tran_so +set_location_assignment PIN_T13 -to port_tran_so_dir +set_location_assignment PIN_AA7 -to port_tran_sck +set_location_assignment PIN_Y9 -to port_tran_sck_dir +set_location_assignment PIN_R9 -to port_tran_sd +set_location_assignment PIN_T9 -to port_tran_sd_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to port_tran_si +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to port_tran_si_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to port_tran_so_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to port_tran_sck +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to port_tran_sck_dir +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to port_tran_sd +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to port_tran_sd_dir +set_instance_assignment -name IO_STANDARD "1.8 V" -to port_tran_so +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to port_tran_so + +# ============================================================================== +# I/O to 6515D Breakout USB UART +# ============================================================================== +set_location_assignment PIN_K21 -to dbg_tx +set_location_assignment PIN_K22 -to dbg_rx +set_instance_assignment -name IO_STANDARD "1.8 V" -to dbg_rx +set_instance_assignment -name IO_STANDARD "1.8 V" -to dbg_tx +set_instance_assignment -name CURRENT_STRENGTH_NEW 8MA -to dbg_tx + +# ============================================================================== +# Infrared +# ============================================================================== +set_location_assignment PIN_H10 -to port_ir_rx +set_location_assignment PIN_H11 -to port_ir_tx +set_location_assignment PIN_L18 -to port_ir_rx_disable +set_instance_assignment -name IO_STANDARD "1.8 V" -to port_ir_tx +set_instance_assignment -name IO_STANDARD "1.8 V" -to port_ir_rx +set_instance_assignment -name IO_STANDARD "1.8 V" -to port_ir_rx_disable +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to port_ir_tx +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to port_ir_rx_disable +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to port_ir_rx + +# ============================================================================== +# RFU internal I2C bus (DNU) +# ============================================================================== +set_location_assignment PIN_M16 -to aux_scl +set_location_assignment PIN_M18 -to aux_sda +set_instance_assignment -name IO_STANDARD "1.8 V" -to aux_sda +set_instance_assignment -name IO_STANDARD "1.8 V" -to aux_scl +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to aux_sda +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to aux_scl + +# ============================================================================== +# I/O pads near jtag connector user can solder to +# ============================================================================== +set_location_assignment PIN_M22 -to user1 +set_location_assignment PIN_L22 -to user2 +set_instance_assignment -name IO_STANDARD "1.8 V" -to user1 +set_instance_assignment -name IO_STANDARD "1.8 V" -to user2 + +# ============================================================================== +# VBlank output to scaler +# ============================================================================== +set_location_assignment PIN_N19 -to vblank +set_instance_assignment -name IO_STANDARD "1.8 V" -to vblank + +# ============================================================================== +# Video output to the scaler +# ============================================================================== +set_location_assignment PIN_H15 -to scal_audadc +set_location_assignment PIN_K19 -to scal_auddac +set_location_assignment PIN_K17 -to scal_audlrck +set_location_assignment PIN_K16 -to scal_audmclk +set_location_assignment PIN_R17 -to scal_clk +set_location_assignment PIN_N20 -to scal_de +set_location_assignment PIN_P17 -to scal_hs +set_location_assignment PIN_N21 -to scal_skip +set_location_assignment PIN_T15 -to scal_vs +set_location_assignment PIN_R16 -to scal_vid[11] +set_location_assignment PIN_R15 -to scal_vid[10] +set_location_assignment PIN_R22 -to scal_vid[9] +set_location_assignment PIN_T22 -to scal_vid[8] +set_location_assignment PIN_T18 -to scal_vid[7] +set_location_assignment PIN_T19 -to scal_vid[6] +set_location_assignment PIN_T20 -to scal_vid[5] +set_location_assignment PIN_P19 -to scal_vid[4] +set_location_assignment PIN_P18 -to scal_vid[3] +set_location_assignment PIN_N16 -to scal_vid[2] +set_location_assignment PIN_P22 -to scal_vid[1] +set_location_assignment PIN_R21 -to scal_vid[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_audadc +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_auddac +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_audlrck +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_audmclk +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_clk +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_de +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_hs +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_skip +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vid[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to scal_vs +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_auddac +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_audlrck +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_audmclk +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_clk +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_de +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_hs +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_skip +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[0] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[10] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[11] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[1] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[2] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[3] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[4] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[5] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[6] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[7] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[8] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vid[9] +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to scal_vs + +# ============================================================================== +# SDRAM, 512mbit x16 +# ============================================================================== +set_location_assignment PIN_J17 -to dram_a[12] +set_location_assignment PIN_F15 -to dram_a[11] +set_location_assignment PIN_C13 -to dram_a[10] +set_location_assignment PIN_G17 -to dram_a[9] +set_location_assignment PIN_J18 -to dram_a[8] +set_location_assignment PIN_F14 -to dram_a[7] +set_location_assignment PIN_E15 -to dram_a[6] +set_location_assignment PIN_E16 -to dram_a[5] +set_location_assignment PIN_F13 -to dram_a[4] +set_location_assignment PIN_E14 -to dram_a[3] +set_location_assignment PIN_F12 -to dram_a[2] +set_location_assignment PIN_D12 -to dram_a[1] +set_location_assignment PIN_D17 -to dram_a[0] +set_location_assignment PIN_E12 -to dram_ba[1] +set_location_assignment PIN_C16 -to dram_ba[0] +set_location_assignment PIN_K20 -to dram_dq[15] +set_location_assignment PIN_G11 -to dram_dq[14] +set_location_assignment PIN_J19 -to dram_dq[13] +set_location_assignment PIN_H13 -to dram_dq[12] +set_location_assignment PIN_G13 -to dram_dq[11] +set_location_assignment PIN_G16 -to dram_dq[10] +set_location_assignment PIN_G15 -to dram_dq[9] +set_location_assignment PIN_J13 -to dram_dq[8] +set_location_assignment PIN_A12 -to dram_dq[7] +set_location_assignment PIN_A13 -to dram_dq[6] +set_location_assignment PIN_B12 -to dram_dq[5] +set_location_assignment PIN_A14 -to dram_dq[4] +set_location_assignment PIN_B13 -to dram_dq[3] +set_location_assignment PIN_A15 -to dram_dq[2] +set_location_assignment PIN_B15 -to dram_dq[1] +set_location_assignment PIN_C15 -to dram_dq[0] +set_location_assignment PIN_D13 -to dram_dqm[0] +set_location_assignment PIN_H18 -to dram_dqm[1] +set_location_assignment PIN_B16 -to dram_cas_n +set_location_assignment PIN_G18 -to dram_cke +set_location_assignment PIN_G12 -to dram_clk +set_location_assignment PIN_B11 -to dram_ras_n +set_location_assignment PIN_C11 -to dram_we_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[12] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_a[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_ba[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_ba[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_cas_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_cke +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_clk +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[12] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[13] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[14] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[15] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dq[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dqm[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_dqm[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_ras_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to dram_we_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[12] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_a[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_ba[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_ba[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_cas_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_cke +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[12] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[13] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[14] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[15] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dq[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dqm[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_dqm[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_ras_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to dram_we_n +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to dram_clk + +# ============================================================================== +# Cellular PSRAM 0 - 64mbit x2 dual die per chip +# ============================================================================== +set_location_assignment PIN_H8 -to cram0_a[21] +set_location_assignment PIN_H9 -to cram0_a[20] +set_location_assignment PIN_B7 -to cram0_a[19] +set_location_assignment PIN_B6 -to cram0_a[18] +set_location_assignment PIN_C6 -to cram0_a[17] +set_location_assignment PIN_H6 -to cram0_a[16] +set_location_assignment PIN_J9 -to cram0_dq[15] +set_location_assignment PIN_L7 -to cram0_dq[14] +set_location_assignment PIN_F9 -to cram0_dq[13] +set_location_assignment PIN_E7 -to cram0_dq[12] +set_location_assignment PIN_A8 -to cram0_dq[11] +set_location_assignment PIN_D9 -to cram0_dq[10] +set_location_assignment PIN_A10 -to cram0_dq[9] +set_location_assignment PIN_C9 -to cram0_dq[8] +set_location_assignment PIN_J7 -to cram0_dq[7] +set_location_assignment PIN_G6 -to cram0_dq[6] +set_location_assignment PIN_F10 -to cram0_dq[5] +set_location_assignment PIN_E9 -to cram0_dq[4] +set_location_assignment PIN_D7 -to cram0_dq[3] +set_location_assignment PIN_A9 -to cram0_dq[2] +set_location_assignment PIN_C8 -to cram0_dq[1] +set_location_assignment PIN_B10 -to cram0_dq[0] +set_location_assignment PIN_J8 -to cram0_adv_n +set_location_assignment PIN_B5 -to cram0_ce0_n +set_location_assignment PIN_E10 -to cram0_ce1_n +set_location_assignment PIN_G10 -to cram0_clk +set_location_assignment PIN_F7 -to cram0_cre +set_location_assignment PIN_A5 -to cram0_lb_n +set_location_assignment PIN_D6 -to cram0_oe_n +set_location_assignment PIN_A7 -to cram0_ub_n +set_location_assignment PIN_K7 -to cram0_wait +set_location_assignment PIN_G8 -to cram0_we_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[12] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[13] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[14] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_dq[15] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_a[16] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_a[17] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_a[18] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_a[19] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_a[20] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_a[21] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_adv_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_ce0_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_ce1_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_clk +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_cre +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_lb_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_oe_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_ub_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_wait +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram0_we_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[12] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[13] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[14] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_dq[15] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_a[16] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_a[17] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_a[18] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_a[19] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_a[20] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_a[21] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_adv_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_ce0_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_ce1_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_cre +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_lb_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_oe_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_ub_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_wait +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram0_we_n +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to cram0_clk + +# ============================================================================== +# Cellular PSRAM 1 - 64mbit x2 dual die per chip +# ============================================================================== +set_location_assignment PIN_Y3 -to cram1_a[21] +set_location_assignment PIN_AA2 -to cram1_a[20] +set_location_assignment PIN_L2 -to cram1_a[19] +set_location_assignment PIN_N1 -to cram1_a[18] +set_location_assignment PIN_U1 -to cram1_a[17] +set_location_assignment PIN_U2 -to cram1_a[16] +set_location_assignment PIN_W8 -to cram1_dq[15] +set_location_assignment PIN_U6 -to cram1_dq[14] +set_location_assignment PIN_R7 -to cram1_dq[13] +set_location_assignment PIN_R6 -to cram1_dq[12] +set_location_assignment PIN_P7 -to cram1_dq[11] +set_location_assignment PIN_N6 -to cram1_dq[10] +set_location_assignment PIN_C2 -to cram1_dq[9] +set_location_assignment PIN_D3 -to cram1_dq[8] +set_location_assignment PIN_V6 -to cram1_dq[7] +set_location_assignment PIN_U7 -to cram1_dq[6] +set_location_assignment PIN_M6 -to cram1_dq[5] +set_location_assignment PIN_R5 -to cram1_dq[4] +set_location_assignment PIN_P6 -to cram1_dq[3] +set_location_assignment PIN_E2 -to cram1_dq[2] +set_location_assignment PIN_G2 -to cram1_dq[1] +set_location_assignment PIN_C1 -to cram1_dq[0] +set_location_assignment PIN_U8 -to cram1_adv_n +set_location_assignment PIN_N2 -to cram1_ce0_n +set_location_assignment PIN_T8 -to cram1_ce1_n +set_location_assignment PIN_W2 -to cram1_clk +set_location_assignment PIN_T7 -to cram1_cre +set_location_assignment PIN_L1 -to cram1_lb_n +set_location_assignment PIN_M7 -to cram1_oe_n +set_location_assignment PIN_G1 -to cram1_ub_n +set_location_assignment PIN_W9 -to cram1_wait +set_location_assignment PIN_AA1 -to cram1_we_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[0] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[1] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[2] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[3] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[4] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[5] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[6] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[7] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[8] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[9] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[10] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[11] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[12] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[13] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[14] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_dq[15] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_a[16] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_a[17] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_a[18] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_a[19] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_a[20] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_a[21] +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_adv_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_ce0_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_ce1_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_clk +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_cre +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_lb_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_oe_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_ub_n +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_wait +set_instance_assignment -name IO_STANDARD "1.8 V" -to cram1_we_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[0] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[1] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[2] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[3] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[4] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[5] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[6] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[7] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[8] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[9] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[10] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[11] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[12] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[13] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[14] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_dq[15] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_a[16] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_a[17] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_a[18] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_a[19] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_a[20] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_a[21] +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_adv_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_ce0_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_ce1_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_cre +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_lb_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_oe_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_ub_n +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_wait +set_instance_assignment -name CURRENT_STRENGTH_NEW 4MA -to cram1_we_n +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to cram1_clk + +# ============================================================================== +# SRAM, 1mbit x16 +# ============================================================================== +set_location_assignment PIN_V16 -to sram_a[16] +set_location_assignment PIN_U12 -to sram_a[15] +set_location_assignment PIN_U15 -to sram_a[14] +set_location_assignment PIN_R10 -to sram_a[13] +set_location_assignment PIN_V14 -to sram_a[12] +set_location_assignment PIN_T10 -to sram_a[11] +set_location_assignment PIN_U11 -to sram_a[10] +set_location_assignment PIN_Y14 -to sram_a[9] +set_location_assignment PIN_U13 -to sram_a[8] +set_location_assignment PIN_Y19 -to sram_a[7] +set_location_assignment PIN_P8 -to sram_a[6] +set_location_assignment PIN_V19 -to sram_a[5] +set_location_assignment PIN_N9 -to sram_a[4] +set_location_assignment PIN_U21 -to sram_a[3] +set_location_assignment PIN_M8 -to sram_a[2] +set_location_assignment PIN_M9 -to sram_a[1] +set_location_assignment PIN_T14 -to sram_a[0] +set_location_assignment PIN_Y15 -to sram_dq[15] +set_location_assignment PIN_W16 -to sram_dq[14] +set_location_assignment PIN_Y16 -to sram_dq[13] +set_location_assignment PIN_Y17 -to sram_dq[12] +set_location_assignment PIN_V20 -to sram_dq[11] +set_location_assignment PIN_V18 -to sram_dq[10] +set_location_assignment PIN_U20 -to sram_dq[9] +set_location_assignment PIN_U16 -to sram_dq[8] +set_location_assignment PIN_R12 -to sram_dq[7] +set_location_assignment PIN_V13 -to sram_dq[6] +set_location_assignment PIN_T12 -to sram_dq[5] +set_location_assignment PIN_W19 -to sram_dq[4] +set_location_assignment PIN_Y20 -to sram_dq[3] +set_location_assignment PIN_P14 -to sram_dq[2] +set_location_assignment PIN_P9 -to sram_dq[1] +set_location_assignment PIN_N8 -to sram_dq[0] +set_location_assignment PIN_U17 -to sram_ub_n +set_location_assignment PIN_R11 -to sram_we_n +set_location_assignment PIN_R14 -to sram_oe_n +set_location_assignment PIN_P12 -to sram_lb_n +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[13] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[14] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[15] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[16] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_a[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[13] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[14] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[15] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_dq[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_lb_n +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_oe_n +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_ub_n +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to sram_we_n + +# ============================================================================== +# Powerup self test (DO NOT USE) +# ============================================================================== +set_location_assignment PIN_P16 -to vpll_feed +set_location_assignment PIN_U10 -to bist +set_instance_assignment -name IO_STANDARD "3.3-V LVCMOS" -to bist +set_instance_assignment -name IO_STANDARD "1.8 V" -to vpll_feed +set_instance_assignment -name OUTPUT_TERMINATION "SERIES 50 OHM WITHOUT CALIBRATION" -to vpll_feed + +# ============================================================================== +# Advanced I/O Timing Assignments +# ============================================================================== +set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise +set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall +set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise +set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall + +# ============================================================================== +# Scripts +# ============================================================================== +set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:../platform/pocket/build_id_gen.tcl" +set_global_assignment -name POST_FLOW_SCRIPT_FILE "quartus_sh:../platform/pocket/build_cdf.tcl" + +# ============================================================================== +# Framework Files +# ============================================================================== +set_global_assignment -name QIP_FILE ../platform/pocket/apf.qip +set_global_assignment -name QIP_FILE ../target/pocket/core.qip diff --git a/projects/congo_pocket.qip b/projects/congo_pocket.qip new file mode 100644 index 0000000..6cf6cf2 --- /dev/null +++ b/projects/congo_pocket.qip @@ -0,0 +1,15 @@ +# ============================================================================== +# Quartus Prime Platform Specific Modules File +# Generated by OpenGateware - Gateman CLI v0.1.0 +# ============================================================================== +# A single file that contains paths to platform specific third-party modules. +# Quartus will use this file but won't edit it. +# You need to edit it manually to add/remove files here. +# ============================================================================== + +set_global_assignment -name QIP_FILE "../modules/general-sync_fifo/index.qip" +set_global_assignment -name QIP_FILE "../modules/pocket-i2s/index.qip" +set_global_assignment -name QIP_FILE "../modules/pocket-joypad/index.qip" +set_global_assignment -name QIP_FILE "../modules/pocket-dataloader/index.qip" +set_global_assignment -name QIP_FILE "../modules/pocket-video/index.qip" +set_global_assignment -name QIP_FILE "../modules/video-scanlines/index.qip" \ No newline at end of file diff --git a/projects/congo_pocket.qpf b/projects/congo_pocket.qpf new file mode 100644 index 0000000..2ffc2e0 --- /dev/null +++ b/projects/congo_pocket.qpf @@ -0,0 +1,11 @@ +# ============================================================================== +# Quartus Prime Project File +# Generated by OpenGateware - Gateman CLI v0.1.0 +# ============================================================================== + +QUARTUS_VERSION = "18.1" +DATE = "12:50:13 November 14, 2022" + +# Revisions + +PROJECT_REVISION = "congo_pocket" diff --git a/projects/congo_pocket.qsf b/projects/congo_pocket.qsf new file mode 100644 index 0000000..d5535d4 --- /dev/null +++ b/projects/congo_pocket.qsf @@ -0,0 +1,67 @@ +# ============================================================================== +# Quartus Prime Settings File +# Generated by OpenGateware - Gateman CLI v0.1.0 +# ============================================================================== +# WARNING: DO NOT ADD FILES TO THE PROJECT VIA THE QUARTUS IDE! +# Add them manually to congo_pocket.qip or Quartus will overwrite this file. +# ============================================================================== + +# ============================================================================== +# Project-Wide Assignments +# ============================================================================== +set_global_assignment -name ORIGINAL_QUARTUS_VERSION 18.1.1 +set_global_assignment -name LAST_QUARTUS_VERSION "17.1.0 Standard Edition" +set_global_assignment -name TOP_LEVEL_ENTITY apf_top +set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top +set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top +set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top +set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files + +# ============================================================================== +# Compiler Assignments +# ============================================================================== +set_global_assignment -name NUM_PARALLEL_PROCESSORS ALL +set_global_assignment -name OPTIMIZATION_MODE "HIGH PERFORMANCE EFFORT" +set_global_assignment -name SAVE_DISK_SPACE OFF +set_global_assignment -name SEED 1 +set_global_assignment -name SMART_RECOMPILE ON + +# ============================================================================== +# Analysis & Synthesis Assignments +# ============================================================================== +set_global_assignment -name ADV_NETLIST_OPT_SYNTH_WYSIWYG_REMAP ON +set_global_assignment -name MUX_RESTRUCTURE OFF +set_global_assignment -name OPTIMIZATION_TECHNIQUE SPEED +set_global_assignment -name PRE_MAPPING_RESYNTHESIS ON +set_global_assignment -name SAFE_STATE_MACHINE ON +set_global_assignment -name SYNTH_PROTECT_SDC_CONSTRAINT ON + +# ============================================================================== +# Fitter Assignments +# ============================================================================== +set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_100MHZ +set_global_assignment -name CRC_ERROR_OPEN_DRAIN ON +set_global_assignment -name ECO_OPTIMIZE_TIMING ON +set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 256 +set_global_assignment -name FITTER_EFFORT "AUTO FIT" +set_global_assignment -name PERIPHERY_TO_CORE_PLACEMENT_AND_ROUTING_OPTIMIZATION ON +set_global_assignment -name PHYSICAL_SYNTHESIS_ASYNCHRONOUS_SIGNAL_PIPELINING ON +set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC ON +set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION ON +set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING ON +set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS ON +set_global_assignment -name ROUTER_LCELL_INSERTION_AND_LOGIC_DUPLICATION ON +set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "PASSIVE SERIAL" + +# ============================================================================== +# Platform/Core Assignments +# ============================================================================== +source ../platform/pocket/pocket.tcl +set_global_assignment -name QIP_FILE congo_pocket.qip +set_global_assignment -name SDC_FILE congo_pocket.sdc +set_global_assignment -name QIP_FILE ../rtl/congo.qip + +# ============================================================================== + + +set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top \ No newline at end of file diff --git a/projects/congo_pocket.sdc b/projects/congo_pocket.sdc new file mode 100644 index 0000000..4b5d796 --- /dev/null +++ b/projects/congo_pocket.sdc @@ -0,0 +1,61 @@ +# ============================================================================== +# Quartus Prime Synopsys Design Constraint File +# Generated by OpenGateware - Gateman CLI v0.1.0 +# ============================================================================== +# pocket SDC settings +# Users are recommended to modify this file to match users logic. +# Put your clock groups in here as well as any net assignments. +# ============================================================================== + +# ============================================================================== +# Time Information +# ============================================================================== + +# ============================================================================== +# Create Clock +# ============================================================================== + +# ============================================================================== +# Create Generated Clock +# ============================================================================== + +# ============================================================================== +# Set Clock Latency +# ============================================================================== + +# ============================================================================== +# Set Clock Uncertainty +# ============================================================================== + +# ============================================================================== +# Set Input Delay +# ============================================================================== + +# ============================================================================== +# Set Output Delay +# ============================================================================== + +# ============================================================================== +# Set Clock Groups +# ============================================================================== + +# ============================================================================== +# Set False Path +# ============================================================================== + +# ============================================================================== +# Set Multicycle Path +# ============================================================================== + +# ============================================================================== +# Set Maximum Delay +# ============================================================================== + +# ============================================================================== +# Set Minimum Delay +# ============================================================================== + +# ============================================================================== +# Set Input Transition +# ============================================================================== + diff --git a/rtl/congo.qip b/rtl/congo.qip new file mode 100644 index 0000000..b38d42d --- /dev/null +++ b/rtl/congo.qip @@ -0,0 +1,15 @@ +# ============================================================================== +# RTL +# ============================================================================== +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "samples_player.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "dpram.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "gen_ram.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "congo_sound_board.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "congo_samples.vhd"] +set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "congo_bongo.vhd"] + +# ============================================================================== +# MODULES +# ============================================================================== +set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) "../modules/cpu-t80/index.qip"] +set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) "../modules/sound-sn76489/index.qip"] diff --git a/rtl/congo_bongo.vhd b/rtl/congo_bongo.vhd new file mode 100644 index 0000000..bdf9c4b --- /dev/null +++ b/rtl/congo_bongo.vhd @@ -0,0 +1,1219 @@ +--------------------------------------------------------------------------------- +-- Congo Bongo by Dar (darfpga@aol.fr) (12/11/2022) +-- http://darfpga.blogspot.fr +--------------------------------------------------------------------------------- +-- +-- release rev 00 : initial release +-- (12/11/2022) +--------------------------------------------------------------------------------- +-- gen_ram.vhd & io_ps2_keyboard +-------------------------------- +-- Copyright 2005-2008 by Peter Wendrich (pwsoft@syntiac.com) +-- http://www.syntiac.com/fpga64.html +--------------------------------------------------------------------------------- +-- T80/T80se - Version : 304 +----------------------------- +-- Z80 compatible microprocessor core +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +--------------------------------------------------------------------------------- +-- Synthesizable model of TI's SN76489AN +-- Copyright (c) 2005, 2006, Arnim Laeuger (arnim.laeuger@gmx.net) +--------------------------------------------------------------------------------- +-- +-- Educational use only +-- Do not redistribute synthetized file with roms +-- Do not redistribute roms whatever the form +-- Use at your own risk +--------------------------------------------------------------------------------- + +-- Features : +-- Video : TV 15kHz +-- Coctail mode : Yes +-- Sound : OK + +-- Use with MAME roms from congo.zip +-- +-- Use make_congo_proms.bat to build vhd file from binaries +-- (CRC list included) + +-- Congo Bongo (Gremlin/SEGA) : Congo Bongo is mainly identical to Zaxxon except +-- those : +-- +-- Use a DMA to transfert sprite data from wram to sprite ram +-- Use a color ram instead of color rom +-- CPU has more rom +-- Map data is half size +-- Sprite graphics is twice size +-- Registers/Inputs use mostly different addresses +-- Sound board uses analog circuit + 2xSN76486 +-- +-- See Zaxxon.vhd for more details +-- +--------------------------------------------------------------------------------- +-- Global screen flip is fully managed at hardware level. This allow to +-- easily add an external flip screen feature. +--------------------------------------------------------------------------------- + +library ieee; +use ieee.std_logic_1164.all; +use ieee.std_logic_unsigned.all; +use ieee.numeric_std.all; + +entity congo_bongo is +port( + clock_24 : in std_logic; + reset : in std_logic; + pause : in std_logic; +-- tv15Khz_mode : in std_logic; + video_r : out std_logic_vector(2 downto 0); + video_g : out std_logic_vector(2 downto 0); + video_b : out std_logic_vector(1 downto 0); + video_clk : out std_logic; + video_csync : out std_logic; + video_hblank : out std_logic; + video_vblank : out std_logic; + video_hs : out std_logic; + video_vs : out std_logic; + video_ce : out std_logic; + + audio_out_l : out std_logic_vector(15 downto 0); + audio_out_r : out std_logic_vector(15 downto 0); + + coin1 : in std_logic; + coin2 : in std_logic; + start1 : in std_logic; + start2 : in std_logic; + + left : in std_logic; + right : in std_logic; + up : in std_logic; + down : in std_logic; + fire : in std_logic; + + left_c : in std_logic; + right_c : in std_logic; + up_c : in std_logic; + down_c : in std_logic; + fire_c : in std_logic; + + sw1_input : in std_logic_vector( 7 downto 0); + sw2_input : in std_logic_vector( 7 downto 0); + + service : in std_logic; + flip_screen : in std_logic; + + dl_addr : in std_logic_vector(17 downto 0); + dl_wr : in std_logic; + dl_data : in std_logic_vector( 7 downto 0); + + dbg_cpu_addr : out std_logic_vector(15 downto 0) + ); +end congo_bongo; + +architecture struct of congo_bongo is + + signal reset_n : std_logic; + signal clock_vid : std_logic; + signal clock_vidn: std_logic; + signal clock_cnt : std_logic_vector(3 downto 0) := "0000"; + + signal hcnt : std_logic_vector(8 downto 0) := (others=>'0'); -- horizontal counter + signal vcnt : std_logic_vector(8 downto 0) := (others=>'0'); -- vertical counter + signal hflip : std_logic_vector(8 downto 0) := (others=>'0'); -- horizontal counter flip + signal vflip : std_logic_vector(8 downto 0) := (others=>'0'); -- vertical counter flip + signal hflip2 : std_logic_vector(8 downto 0) := (others=>'0'); -- horizontal counter flip + + signal hs_cnt, vs_cnt :std_logic_vector(9 downto 0) ; + signal hsync0, hsync1, hsync2, hsync3, hsync4 : std_logic; + signal top_frame : std_logic := '0'; + + signal pix_ena : std_logic; + signal cpu_ena : std_logic; + + signal cpu_addr : std_logic_vector(15 downto 0); + signal cpu_di : std_logic_vector( 7 downto 0); + signal cpu_do : std_logic_vector( 7 downto 0); + signal cpu_wr_n : std_logic; +-- signal cpu_rd_n : std_logic; + signal cpu_mreq_n : std_logic; +-- signal cpu_ioreq_n : std_logic; + signal cpu_irq_n : std_logic; + signal cpu_m1_n : std_logic; + + signal cpu_rom_do : std_logic_vector(7 downto 0); + + signal wram_addr : std_logic_vector(11 downto 0); + signal wram_we : std_logic; + signal wram_do : std_logic_vector(7 downto 0); + signal wram_do_to_cpu: std_logic_vector(7 downto 0); -- registred ram data for cpu + + signal dma_src_addr : std_logic_vector(11 downto 0); + signal dma_dst_addr : std_logic_vector( 7 downto 0); + signal dma_started : std_logic; + signal dma_cnt : std_logic_vector( 7 downto 0); + signal dma_step : std_logic_vector( 3 downto 0); + + signal ch_ram_addr: std_logic_vector(9 downto 0); + signal ch_ram_we : std_logic; + signal ch_ram_do : std_logic_vector(7 downto 0); + signal ch_ram_do_to_cpu: std_logic_vector(7 downto 0); -- registred ram data for cpu + + signal color_ram_we : std_logic; + signal color_ram_do : std_logic_vector(7 downto 0); + + signal ch_code : std_logic_vector(7 downto 0); + signal ch_color : std_logic_vector(3 downto 0); + + signal ch_code_line_1 : std_logic_vector(11 downto 0); + signal ch_code_line_2 : std_logic_vector(11 downto 0); + signal ch_bit_nb : integer range 0 to 7; + signal ch_graphx1_do : std_logic_vector( 7 downto 0); + signal ch_graphx2_do : std_logic_vector( 7 downto 0); + signal ch_vid : std_logic_vector( 1 downto 0); + + signal palette_addr : std_logic_vector(7 downto 0); + signal palette_do : std_logic_vector(7 downto 0); + + signal map_offset_h : std_logic_vector(11 downto 0); + signal map_offset_l1 : std_logic_vector( 7 downto 0); + signal map_offset_l2 : std_logic_vector( 7 downto 0); + + signal map_addr : std_logic_vector(12 downto 0); + signal map1_do : std_logic_vector( 7 downto 0); + signal map2_do : std_logic_vector( 7 downto 0); + + signal bg_graphics_addr : std_logic_vector(12 downto 0); + signal bg_graphics1_do : std_logic_vector( 7 downto 0); + signal bg_graphics2_do : std_logic_vector( 7 downto 0); + signal bg_graphics3_do : std_logic_vector( 7 downto 0); + signal bg_bit_nb : integer range 0 to 7; + signal bg_color_a : std_logic_vector(3 downto 0); + signal bg_color : std_logic_vector(3 downto 0); + signal bg_vid : std_logic_vector(2 downto 0); + signal bg_code_line : std_logic_vector(9 downto 0); + + signal dma_do : std_logic_vector(7 downto 0); + signal sp_ram_addr : std_logic_vector(7 downto 0); + signal sp_ram_we : std_logic; + signal sp_ram_do : std_logic_vector(7 downto 0); + signal sp_ram_do_to_sp_machine : std_logic_vector(7 downto 0); + + signal sp_vcnt : std_logic_vector(7 downto 0); + signal sp_on_line : std_logic; + + signal sp_online_ram_we : std_logic; + signal sp_online_ram_addr : std_logic_vector(4 downto 0); + signal sp_online_ram_di : std_logic_vector(8 downto 0); + signal sp_online_ram_do : std_logic_vector(8 downto 0); + + signal vflip_r : std_logic_vector(8 downto 0); + signal sp_online_vcnt : std_logic_vector(7 downto 0); + signal sp_line : std_logic_vector(7 downto 0); + signal sp_code : std_logic_vector(7 downto 0); + signal sp_color : std_logic_vector(7 downto 0); + signal sp_color_r : std_logic_vector(4 downto 0); + + signal sp_code_line : std_logic_vector(13 downto 0); + signal sp_hflip : std_logic; + signal sp_vflip : std_logic; + + signal sp_graphics_addr : std_logic_vector(13 downto 0); + signal sp_graphics1_do : std_logic_vector( 7 downto 0); + signal sp_graphics2_do : std_logic_vector( 7 downto 0); + signal sp_graphics3_do : std_logic_vector( 7 downto 0); + + signal sp_ok : std_logic; + signal sp_bit_hpos : std_logic_vector(7 downto 0); + signal sp_bit_nb : integer range 0 to 7; + + signal sp_buffer_ram_addr : std_logic_vector(7 downto 0); + signal sp_buffer_ram_we : std_logic; + signal sp_buffer_ram_di : std_logic_vector(7 downto 0); + signal sp_buffer_ram_do : std_logic_vector(7 downto 0); + + signal sp_vid : std_logic_vector(7 downto 0); + + signal vblkn, vblkn_r : std_logic; + signal int_on : std_logic := '0'; + + signal flip_cpu : std_logic := '0'; + signal flip : std_logic := '0'; + signal ch_color_ref : std_logic := '0'; + signal bg_position : std_logic_vector(10 downto 0) := (others => '0'); + signal bg_color_ref : std_logic := '0'; + signal bg_enable : std_logic := '0'; + + signal p1_input : std_logic_vector(7 downto 0); + signal p2_input : std_logic_vector(7 downto 0); + + signal gen_input : std_logic_vector(7 downto 0); + + signal coin1_r, coin1_mem, coin1_ena : std_logic := '0'; + signal coin2_r, coin2_mem, coin2_ena : std_logic := '0'; + + signal sound_cmd : std_logic_vector( 7 downto 0); + signal audio_out : std_logic_vector(15 downto 0); + + signal cpu_rom_we : std_logic; + signal ch_1_rom_we : std_logic; + signal ch_2_rom_we : std_logic; + signal bg_1_rom_we : std_logic; + signal bg_2_rom_we : std_logic; + signal bg_3_rom_we : std_logic; + signal sp_1_rom_we : std_logic; + signal sp_2_rom_we : std_logic; + signal sp_3_rom_we : std_logic; + signal map_1_rom_we : std_logic; + signal map_2_rom_we : std_logic; + signal palette_rom_we : std_logic; + +begin + +clock_vid <= clock_24; +clock_vidn <= not clock_24; +reset_n <= not reset; + +-- debug +--process (reset, clock_vid) +--begin +---- if rising_edge(clock_vid) and cpu_ena ='1' and cpu_mreq_n ='0' then +---- dbg_cpu_addr <= cpu_addr; +---- if rising_edge(clock_vid) then +---- dbg_cpu_addr <= sp_buffer_ram_do & sp_graphics1_do; +---- end if; +--end process; + +-- make enables clock from clock_vid +process (clock_vid, reset) +begin + if reset='1' then + clock_cnt <= (others=>'0'); + else + if rising_edge(clock_vid) then + if clock_cnt = "1111" then -- divide by 16 + clock_cnt <= (others=>'0'); + else + clock_cnt <= clock_cnt + 1; + end if; + end if; + end if; +end process; +-- _ _ _ _ _ _ _ _ _ _ _ +-- |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| | clock_vid 24MHz +-- ___ ___ ___ ___ ___ +-- ___| |___| |___| |___| |___| |__ clock_cnt(0) 12MHz +-- _______ _______ __ +-- _______| |_______| |_______| clock_cnt(1) 6MHz +-- ___ ___ ___ +-- ___| |___________| |___________| |__ pix_ena 6MHz +-- +-- _______ _______________ _______________ __ +-- _______|_______________|_______________|__ video +-- ___ ___ +-- ___| |___________________________| |__ cpu_ena 3MHz +-- +-- + +pix_ena <= '1' when clock_cnt(1 downto 0) = "01" else '0'; -- (6MHz) +cpu_ena <= '1' when hcnt(0) = '0' and pix_ena = '1' else '0'; -- (3MHz) + +video_ce <= pix_ena; +video_clk <= clock_vid; + +--------------------------------------- +-- Video scanner 384x264 @6.083 MHz -- +-- display 256x224 -- +-- -- +-- line : 63.13us -> 15.84kHz -- +-- frame : 16.67ms -> 60.00Hz -- +--------------------------------------- + +process (reset, clock_vid) +begin + if reset='1' then + hcnt <= (others=>'0'); + vcnt <= (others=>'0'); + top_frame <= '0'; + else + if rising_edge(clock_vid) then + if pix_ena = '1' then + + -- main horizontal / vertical counters + hcnt <= hcnt + 1; + if hcnt = 511 then + hcnt <= std_logic_vector(to_unsigned(128,9)); + end if; + + if hcnt = 128+8+8 then + vcnt <= vcnt + 1; + if vcnt = 263 then + vcnt <= (others=>'0'); + top_frame <= not top_frame; + end if; + end if; + + -- set syncs position + if hcnt = 170 then -- tune screen H position here + hs_cnt <= (others => '0'); + if (vcnt = 248) then -- tune screen V position here + vs_cnt <= (others => '0'); + else + vs_cnt <= vs_cnt +1; + end if; + + else + hs_cnt <= hs_cnt + 1; + end if; + + if vs_cnt = 1 then video_vs <= '0'; + elsif vs_cnt = 3 then video_vs <= '1'; + end if; + + -- blanking +-- video_blankn <= '0'; + +-- if (hcnt >= 256+9-5 or hcnt < 128+9-5) and +-- vcnt >= 17 and vcnt < 240 then video_blankn <= '1';end if; +-- + if hcnt = 256+9-5 then + video_hblank <= '0'; + end if; + if hcnt = 128+9-5 then + video_hblank <= '1'; + end if; + + if hcnt = 256+9-5 then + video_vblank <= '1'; + if vcnt >= 16 and vcnt < 240 then + video_vblank <= '0'; + end if; + end if; + + -- build syncs pattern (composite) + if hs_cnt = 0 then hsync0 <= '0'; video_hs <= '0'; + elsif hs_cnt = 29 then hsync0 <= '1'; video_hs <= '1'; + end if; + + if hs_cnt = 0 then hsync1 <= '0'; + elsif hs_cnt = 14 then hsync1 <= '1'; + elsif hs_cnt = 192+ 0 then hsync1 <= '0'; + elsif hs_cnt = 192+14 then hsync1 <= '1'; + end if; + + if hs_cnt = 0 then hsync2 <= '0'; + elsif hs_cnt = 192-29 then hsync2 <= '1'; + elsif hs_cnt = 192 then hsync2 <= '0'; + elsif hs_cnt = 384-29 then hsync2 <= '1'; + end if; + + if hs_cnt = 0 then hsync3 <= '0'; + elsif hs_cnt = 14 then hsync3 <= '1'; + elsif hs_cnt = 192 then hsync3 <= '0'; + elsif hs_cnt = 384-29 then hsync3 <= '1'; + end if; + + if hs_cnt = 0 then hsync4 <= '0'; + elsif hs_cnt = 192-29 then hsync4 <= '1'; + elsif hs_cnt = 192 then hsync4 <= '0'; + elsif hs_cnt = 192+14 then hsync4 <= '1'; + end if; + + if vs_cnt = 1 then video_csync <= hsync1; + elsif vs_cnt = 2 then video_csync <= hsync1; + elsif vs_cnt = 3 then video_csync <= hsync1; + elsif vs_cnt = 4 and top_frame = '1' then video_csync <= hsync3; + elsif vs_cnt = 4 and top_frame = '0' then video_csync <= hsync1; + elsif vs_cnt = 5 then video_csync <= hsync2; + elsif vs_cnt = 6 then video_csync <= hsync2; + elsif vs_cnt = 7 and top_frame = '1' then video_csync <= hsync4; + elsif vs_cnt = 7 and top_frame = '0' then video_csync <= hsync2; + elsif vs_cnt = 8 then video_csync <= hsync1; + elsif vs_cnt = 9 then video_csync <= hsync1; + elsif vs_cnt = 10 then video_csync <= hsync1; + elsif vs_cnt = 11 then video_csync <= hsync0; + else video_csync <= hsync0; + end if; + + end if; + end if; + end if; +end process; + +--------------------------------- +-- players/dip switches inputs -- +--------------------------------- +p1_input <= "000" & fire & down & up & left & right ; +p2_input <= "000" & fire_c & down_c & up_c & left_c & right_c; +gen_input <= service & coin2_mem & coin1_mem & '0' & start2 & start1 & "00"; + +------------------------------------------ +-- cpu data input with address decoding -- +------------------------------------------ +cpu_di <= cpu_rom_do when cpu_mreq_n = '0' and cpu_addr(15 downto 12) < X"8" else -- 0000-7FFF + wram_do_to_cpu when cpu_mreq_n = '0' and cpu_addr(15 downto 12) = x"8" else -- 8000-8FFF + ch_ram_do_to_cpu when cpu_mreq_n = '0' and (cpu_addr and x"E000") = x"A000" else -- video/color ram A000-A7FF + mirroring 1800 + p1_input when cpu_mreq_n = '0' and (cpu_addr and x"E03B") = x"C000" else -- player 1 C000 + mirroring 1FC4 + p2_input when cpu_mreq_n = '0' and (cpu_addr and x"E03B") = x"C001" else -- player 2 C001 + mirroring 1FC4 + sw1_input when cpu_mreq_n = '0' and (cpu_addr and x"E03B") = x"C002" else -- switch 1 C002 + mirroring 1FC4 + sw2_input when cpu_mreq_n = '0' and (cpu_addr and x"E03B") = x"C003" else -- switch 2 C003 + mirroring 1FC4 + gen_input when cpu_mreq_n = '0' and (cpu_addr and x"E038") = x"C008" else -- general C008 + mirroring 1FC7 + X"FF"; + +------------------------------------------------------------------------ +-- Coin registers +------------------------------------------------------------------------ +process (clock_vid, coin1_ena, coin2_ena) +begin + if coin1_ena = '0' then + coin1_mem <= '0'; + else + if rising_edge(clock_vid) then + coin1_r <= coin1; + if coin1 = '1' and coin1_r = '0' then coin1_mem <= coin1_ena; end if; + end if; + end if; + if coin2_ena = '0' then + coin2_mem <= '0'; + else + if rising_edge(clock_vid) then + coin2_r <= coin2; + if coin2 = '1' and coin2_r = '0' then coin2_mem <= coin2_ena; end if; + end if; + end if; +end process; + +------------------------------------------------------------------------ +-- Misc registers - interrupt set/enable +------------------------------------------------------------------------ +vblkn <= '0' when vcnt < 256 else '1'; + +process (clock_vid) +begin + if rising_edge(clock_vid) then + + vblkn_r <= vblkn; + + if cpu_mreq_n = '0' and cpu_wr_n = '0' then + -- U55/U52 + if (cpu_addr and x"E03F") = x"C018" then coin1_ena <= cpu_do(0); end if; -- C018 + mirroring 1FC0 + if (cpu_addr and x"E03F") = x"C019" then coin2_ena <= cpu_do(0); end if; -- C019 + mirroring 1FC0 + if (cpu_addr and x"E03F") = x"C01D" then bg_enable <= cpu_do(0); end if; -- C01D + mirroring 1FC0 + if (cpu_addr and x"E03F") = x"C01E" then flip_cpu <= cpu_do(0); end if; -- C01E + mirroring 1FC0 + if (cpu_addr and x"E03F") = x"C01F" then int_on <= cpu_do(0); end if; -- C01F + mirroring 1FC0 + -- U55/U53 + if (cpu_addr and x"E03F") = x"C021" then ch_color_ref <= cpu_do(0); end if; -- C021 + mirroring 1FC0 + if (cpu_addr and x"E03F") = x"C023" then bg_color_ref <= cpu_do(0); end if; -- C023 + mirroring 1FC0 +-- if (cpu_addr and x"E03F") = x"C026" then ch_bank <= cpu_do(0); end if; -- C026 + mirroring 1FC0 N.U. rom5 dump is 4ko only +-- if (cpu_addr and x"E03F") = x"C027" then palette_bank <= cpu_do(0); end if; -- C027 + mirroring 1FC0 N.U. depend on J1 setting + + -- U55/U39 U27,28,30,29 + if (cpu_addr and x"E03B") = x"C028" then bg_position( 7 downto 0) <= not cpu_do ; end if; -- C028 + mirroring 1FC4 + if (cpu_addr and x"E03B") = x"C029" then bg_position(10 downto 8) <= not cpu_do(2 downto 0); end if; -- C029 + mirroring 1FC4 + -- U55 + if (cpu_addr and x"E038") = x"C038" then sound_cmd <= cpu_do; end if; -- C038 + mirroring 1FC0 + end if; + + -- U41 + if int_on = '0' then + cpu_irq_n <= '1'; + else + if vblkn_r = '1' and vblkn = '0' then cpu_irq_n <= '0'; end if; + end if; + + end if; +end process; + +------------------------------------------ +-- write enable / ram access from CPU -- +-- mux ch_ram and sp ram addresses -- +-- dmux ch_ram and sp_ram data out -- +------------------------------------------ +wram_we <= '1' when cpu_mreq_n = '0' and cpu_wr_n = '0' and cpu_addr(15 downto 12 ) = x"8" and hcnt(0) = '1' else '0'; -- 8000-8FFF +ch_ram_we <= '1' when cpu_mreq_n = '0' and cpu_wr_n = '0' and (cpu_addr and x"FC00") = x"A000" and hcnt(0) = '1' else '0'; -- A000-A3FF +color_ram_we <= '1' when cpu_mreq_n = '0' and cpu_wr_n = '0' and (cpu_addr and x"FC00") = x"A400" and hcnt(0) = '1' else '0'; -- A400-A7FF + +flip <= flip_cpu xor flip_screen; +hflip <= hcnt when flip = '0' else not hcnt; +vflip <= vcnt when flip = '0' else not vcnt; + +wram_addr <= cpu_addr(11 downto 0) when hcnt(0) = '1' else dma_src_addr; +ch_ram_addr <= cpu_addr(9 downto 0) when hcnt(0) = '1' else vflip(7 downto 3) & hflip(7 downto 3); +sp_ram_addr <= dma_dst_addr when hcnt(0) = '1' else '0'& hcnt(7 downto 1); + +process (clock_vid) +begin + if rising_edge(clock_vid) then + if hcnt(0) = '1' then + if cpu_addr(10) = '0' then + ch_ram_do_to_cpu <= ch_ram_do; + else + ch_ram_do_to_cpu <= color_ram_do; + end if; + wram_do_to_cpu <= wram_do; + else + sp_ram_do_to_sp_machine <= sp_ram_do; + end if; + end if; +end process; + +---------------------- +--- sprite machine --- +---------------------- +-- +------ DMA : transfert sprite data from wram to sp_ram +-- +sp_ram_we <= '1' when dma_started = '1' and dma_step > x"1" and hcnt(0) = '1' and pix_ena = '1' else '0'; + +process (clock_vid) +begin + if rising_edge(clock_vid) then + + if cpu_mreq_n = '0' and cpu_wr_n = '0' and cpu_ena = '1' then + -- U59 (DMA) + if (cpu_addr and x"E03B") = x"C030" then dma_src_addr( 7 downto 0) <= cpu_do; end if; -- C030 + mirroring 1FC4 + if (cpu_addr and x"E03B") = x"C031" then dma_src_addr(11 downto 8) <= cpu_do(3 downto 0); end if; -- C031 + mirroring 1FC4 + if (cpu_addr and x"E03B") = x"C032" then dma_cnt <= cpu_do; end if; -- C032 + mirroring 1FC4 + if (cpu_addr and x"E03B") = x"C033" and cpu_do = x"01" then -- C033 + mirroring 1FC4 + dma_started <= '1'; + dma_step <= x"0"; + end if; + end if; + + if dma_started = '1' and pix_ena = '1' then + + if hcnt(0) ='0' then + + dma_do <= wram_do; + + if dma_step = x"1" then + dma_dst_addr <= dma_do(5 downto 0) & "00"; + else + dma_dst_addr <= dma_dst_addr + 1; + end if; + + if dma_step = x"5" then + dma_step <= x"1"; + if dma_cnt = 0 then + dma_started <= '0'; + else + dma_cnt <= dma_cnt - 1; + end if; + else + dma_step <= dma_step + 1; + end if; + + dma_src_addr <= dma_src_addr + 1; + if dma_step = x"4" then + dma_src_addr <= dma_src_addr + 28; + end if; + end if; + + end if; + + end if; +end process; + +-- +-- transfert sprites data from sp_ram to sp_online_ram +-- + +sp_vcnt <= sp_ram_do_to_sp_machine + ("111" & not(flip) & flip & flip & flip & '1') + vflip(7 downto 0) + 1; + +sp_online_ram_we <= '1' when hcnt(8) = '1' and sp_on_line = '1' and hcnt(0) ='0' and sp_online_ram_addr < "11111" else + '1' when hcnt(8) = '0' and hcnt(3) = '1' else '0'; + +sp_online_ram_di <= '1' & sp_ram_do_to_sp_machine when hcnt(8) = '1' else '0'&x"00"; + +process (clock_vid) +begin + if rising_edge(clock_vid) then + + if hcnt(8) = '1' then + if hcnt(2 downto 0) = "000" then + if sp_vcnt(7 downto 5) = "111" then + sp_on_line <= '1'; + else + sp_on_line <= '0'; + end if; + end if; + else + sp_on_line <= '0'; + end if; + + if hcnt(8) = '1' then + + -- during line display seek for sprite on line and transfert them to sp_online_ram + if hcnt = 256 then sp_online_ram_addr <= (others => '0'); end if; + + if pix_ena = '1' and sp_on_line = '1' and hcnt(0) = '0' and sp_online_ram_addr < "11111" then + + sp_online_ram_addr <= sp_online_ram_addr + 1; + + end if; + + -- during line fly back read sp_online_ram + else + sp_online_ram_addr <= hcnt(6 downto 4) & hcnt(2 downto 1); + end if; + + end if; +end process; + +-- +-- read sprite data from sp_online_ram and feed sprite line buffer with sprite graphics data +-- + +sp_online_vcnt <= sp_online_ram_do(7 downto 0) + ("111" & not(flip) & flip & flip & flip & '1') + vflip_r(7 downto 0) + 1; + +sp_code_line <= (sp_code(6 downto 0)) & + (sp_line(4 downto 3) xor (sp_code(7) & sp_code(7))) & + ("00" xor (sp_color(7) & sp_color(7))) & + (sp_line(2 downto 0) xor (sp_code(7) & sp_code(7) & sp_code(7))); + +sp_buffer_ram_addr <= sp_bit_hpos when flip = '1' and hcnt(8) = '1' else not sp_bit_hpos; + +sp_buffer_ram_di <= x"00" when hcnt(8) = '1' else + sp_color_r & sp_graphics3_do(sp_bit_nb) & + sp_graphics2_do(sp_bit_nb) & sp_graphics1_do(sp_bit_nb); + +sp_buffer_ram_we <= pix_ena when hcnt(8) = '1' else + sp_ok and clock_cnt(0) when sp_buffer_ram_do(2 downto 0) = "000" else '0'; + +process (clock_vid) +begin + if rising_edge(clock_vid) then + + if pix_ena = '0' then + sp_vid <= sp_buffer_ram_do; + end if; + + if hcnt = 128 then vflip_r <= vflip; end if; + + if hcnt(8)='0' then + + if clock_cnt(0) = '1' then + if sp_hflip = '1' then sp_bit_nb <= sp_bit_nb + 1; end if; + if sp_hflip = '0' then sp_bit_nb <= sp_bit_nb - 1; end if; + + sp_bit_hpos <= sp_bit_hpos + 1; + end if; + + if pix_ena = '1' then + + if hcnt(3 downto 0) = "0000" then sp_line <= sp_online_vcnt; end if; + if hcnt(3 downto 0) = "0010" then sp_code <= sp_online_ram_do(7 downto 0); end if; + if hcnt(3 downto 0) = "0100" then sp_color <= sp_online_ram_do(7 downto 0); end if; + if hcnt(3 downto 0) = "0110" then sp_bit_hpos <= sp_online_ram_do(7 downto 0) + ("111" & not(flip) & flip & flip & flip & '1') +1; end if; + + if hcnt(3 downto 0) = "0110" then + sp_graphics_addr <= sp_code_line; + sp_ok <= sp_online_ram_do(8); + sp_hflip <= sp_color(7); + sp_vflip <= sp_code(7); + if sp_color(7) = '1' then sp_bit_nb <= 0; else sp_bit_nb <= 7; end if; + sp_color_r <= sp_color(4 downto 0); + end if; + if hcnt(3 downto 0) = "1010" then + sp_graphics_addr(4 downto 3) <= "01" xor (sp_hflip & sp_hflip); + end if; + if hcnt(3 downto 0) = "1110" then + sp_graphics_addr(4 downto 3) <= "10" xor (sp_hflip & sp_hflip); + end if; + if hcnt(3 downto 0) = "0010" then + sp_graphics_addr(4 downto 3) <= "11" xor (sp_hflip & sp_hflip); + end if; + + end if; + + else + + if flip = '1' then + sp_bit_hpos <= hcnt(7 downto 0) - 5; -- tune sprite position w.r.t. background + else + sp_bit_hpos <= hcnt(7 downto 0) - 2; -- tune sprite position w.r.t. background + end if; + + end if; + + end if; +end process; + +-------------------- +--- char machine --- +-------------------- +ch_code_line_1 <= '0' & ch_code & vflip(2 downto 0); +ch_code_line_2 <= '1' & ch_code & vflip(2 downto 0); + +process (clock_vid) +begin + if rising_edge(clock_vid) then + + if pix_ena = '1' then + + if hcnt(2 downto 0) = "010" then + ch_code <= ch_ram_do; + ch_color <= color_ram_do(3 downto 0); + + if flip = '1' then ch_bit_nb <= 0; else ch_bit_nb <= 7; end if; + else + + if flip = '1' then + ch_bit_nb <= ch_bit_nb + 1; + else + ch_bit_nb <= ch_bit_nb - 1; + end if; + + end if; + + end if; + + end if; +end process; + +ch_vid <= ch_graphx2_do(ch_bit_nb) & ch_graphx1_do(ch_bit_nb); + +-------------------------- +--- background machine --- +-------------------------- +map_offset_h <= (bg_position & '1') + (x"0" & vflip(7 downto 0)) + 1; + +-- count from "00"->"FF" and then continue with "00"->"7F" instead of "80"->"FF" +hflip2 <= hflip xor (not(hcnt(8)) & "0000000") when flip = '1' else hflip; + +map_offset_l1 <= not('0' & vflip(7 downto 1)) + (hflip2(7 downto 3) & "111") + 1; +map_offset_l2 <= map_offset_l1 + ('0' & not(flip) & flip & flip & flip & "000"); + +map_addr <= map_offset_h(10 downto 3) & map_offset_l2(7 downto 3); + +bg_graphics_addr(2 downto 0) <= map_offset_h(2 downto 0); + +process (clock_vid) +begin + if rising_edge(clock_vid) then + + if pix_ena = '1' then + + if hcnt(2 downto 0) = "011" then -- 4H^ + bg_code_line(9 downto 0) <= map2_do(1 downto 0) & map1_do; + bg_color_a <= map2_do(7 downto 4); + end if; + + if (not(vflip(3 downto 1)) + hflip(2 downto 0)) = "011" then + bg_graphics_addr(12 downto 3) <= bg_code_line; + bg_color <= bg_color_a; + + if flip = '1' then bg_bit_nb <= 0; else bg_bit_nb <= 7; end if; + else + if flip = '1' then + bg_bit_nb <= bg_bit_nb + 1; + else + bg_bit_nb <= bg_bit_nb - 1; + end if; + end if; + + end if; + + end if; +end process; + +bg_vid <= bg_graphics3_do(bg_bit_nb) & bg_graphics2_do(bg_bit_nb) & bg_graphics1_do(bg_bit_nb) + when bg_enable = '1' else "000"; + +-------------------------------------- +-- mux char/background/sprite video -- +-------------------------------------- +process (clock_vid) +begin + if rising_edge(clock_vid) then + + if pix_ena = '1' then + + palette_addr <= bg_color_ref & bg_color & bg_vid; + + if sp_vid(2 downto 0) /= "000" then + palette_addr <= sp_vid; + end if; + + if ch_vid /= "00" then + palette_addr <= ch_color_ref & ch_color & '0' & ch_vid; + end if; + + video_r <= palette_do(2 downto 0); + video_g <= palette_do(5 downto 3); + video_b <= palette_do(7 downto 6); + + end if; + + end if; +end process; + +----------- +-- Audio -- +----------- + +audio_out_r <= audio_out; +audio_out_l <= audio_out; + +------------------------------ +-- components & sound board -- +------------------------------ + +-- microprocessor Z80 +cpu : entity work.T80se +generic map(Mode => 0, T2Write => 1, IOWait => 1) +port map( + RESET_n => reset_n, + CLK_n => clock_vid, + CLKEN => cpu_ena, + WAIT_n => not pause, + INT_n => cpu_irq_n, + NMI_n => '1', --cpu_nmi_n, + BUSRQ_n => '1', + M1_n => cpu_m1_n, + MREQ_n => cpu_mreq_n, + IORQ_n => open, + RD_n => open, + WR_n => cpu_wr_n, + RFSH_n => open, + HALT_n => open, + BUSAK_n => open, + A => cpu_addr, + DI => cpu_di, + DO => cpu_do +); + + +-- cpu program ROM 0x0000-0x7FFF +--rom_cpu : entity work.congo_cpu +--port map( +-- clk => clock_vidn, +-- addr => cpu_addr(14 downto 0), +-- data => cpu_rom_do +--); + +cpu_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 15) = "000" else '0'; -- 00000-07FFF +rom_cpu : entity work.dpram +generic map( dWidth => 8, aWidth => 15) +port map( + clk_a => clock_vidn, + addr_a => cpu_addr(14 downto 0), + q_a => cpu_rom_do, + clk_b => clock_vid, + addr_b => dl_addr(14 downto 0), + we_b => cpu_rom_we, + d_b => dl_data +); + +-- working RAM 0x8000-0x8FFF +wram : entity work.gen_ram +generic map( dWidth => 8, aWidth => 12) +port map( + clk => clock_vidn, + we => wram_we, + addr => wram_addr, --cpu_addr(11 downto 0), + d => cpu_do, + q => wram_do +); + +-- video RAM 0xA000-0xA3FF + mirroring adresses +-- U59 low part +video_ram : entity work.gen_ram +generic map( dWidth => 8, aWidth => 10) +port map( + clk => clock_vidn, + we => ch_ram_we, + addr => ch_ram_addr, + d => cpu_do, + q => ch_ram_do +); + +-- color RAM 0xA400-0xA7FF + mirroring adresses +-- U59 high part +color_ram : entity work.gen_ram +generic map( dWidth => 8, aWidth => 10) +port map( + clk => clock_vidn, + we => color_ram_we, + addr => ch_ram_addr, -- video RAM / color RAM same low bits address + d => cpu_do, + q => color_ram_do +); + +-- sprite RAM - DMA access +-- U12 +sprite_ram : entity work.gen_ram +generic map( dWidth => 8, aWidth => 8) +port map( + clk => clock_vidn, + we => sp_ram_we, + addr => sp_ram_addr, + d => dma_do, + q => sp_ram_do +); + +-- sprite online RAM +sprites_online_ram : entity work.gen_ram +generic map( dWidth => 9, aWidth => 5) +port map( + clk => clock_vidn, + we => sp_online_ram_we, + addr => sp_online_ram_addr, + d => sp_online_ram_di, + q => sp_online_ram_do +); + +-- sprite line buffer +sprlinebuf : entity work.gen_ram +generic map( dWidth => 8, aWidth => 8) +port map( + clk => clock_vidn, + we => sp_buffer_ram_we, + addr => sp_buffer_ram_addr, + d => sp_buffer_ram_di, + q => sp_buffer_ram_do +); + +-- char graphics ROM 1 +--ch_graphics_1 : entity work.congo_char_bits +--port map( +-- clk => clock_vidn, +-- addr => ch_code_line_1, +-- data => ch_graphx1_do +--); + +ch_1_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 12) = "001000" else '0'; -- 08000-08FFF +ch_graphics_1 : entity work.dpram +generic map( dWidth => 8, aWidth => 12) +port map( + clk_a => clock_vidn, + addr_a => ch_code_line_1, + q_a => ch_graphx1_do, + clk_b => clock_vid, + addr_b => dl_addr(11 downto 0), + we_b => ch_1_rom_we, + d_b => dl_data +); + +-- char graphics ROM 2 +--ch_graphics_2 : entity work.congo_char_bits +--port map( +-- clk => clock_vidn, +-- addr => ch_code_line_2, +-- data => ch_graphx2_do +--); +ch_2_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 12) = "001001" else '0'; -- 09000-09FFF +ch_graphics_2 : entity work.dpram +generic map( dWidth => 8, aWidth => 12) +port map( + clk_a => clock_vidn, + addr_a => ch_code_line_2, + q_a => ch_graphx2_do, + clk_b => clock_vid, + addr_b => dl_addr(11 downto 0), + we_b => ch_2_rom_we, + d_b => dl_data +); + +-- map tile ROM 1 +--map_tile_1 : entity work.congo_map_1 +--port map( +-- clk => clock_vidn, +-- addr => map_addr, +-- data => map1_do +--); + +map_1_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 13) = "00101" else '0'; -- 0A000-0BFFF +map_tile_1 : entity work.dpram +generic map( dWidth => 8, aWidth => 13) +port map( + clk_a => clock_vidn, + addr_a => map_addr, + q_a => map1_do, + clk_b => clock_vid, + addr_b => dl_addr(12 downto 0), + we_b => map_1_rom_we, + d_b => dl_data +); + +-- map tile ROM 2 +--map_tile_2 : entity work.congo_map_2 +--port map( +-- clk => clock_vidn, +-- addr => map_addr, +-- data => map2_do +--); +map_2_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 13) = "00110" else '0'; -- 0C000-0DFFF +map_tile_2 : entity work.dpram +generic map( dWidth => 8, aWidth => 13) +port map( + clk_a => clock_vidn, + addr_a => map_addr, + q_a => map2_do, + clk_b => clock_vid, + addr_b => dl_addr(12 downto 0), + we_b => map_2_rom_we, + d_b => dl_data +); + +-- background graphics ROM 1 +--bg_graphics_bits_1 : entity work.congo_bg_bits_1 +--port map( +-- clk => clock_vidn, +-- addr => bg_graphics_addr, +-- data => bg_graphics1_do +--); +bg_1_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 13) = "00111" else '0'; -- 0E000-0FFFF +bg_graphics_bits_1 : entity work.dpram +generic map( dWidth => 8, aWidth => 13) +port map( + clk_a => clock_vidn, + addr_a => bg_graphics_addr, + q_a => bg_graphics1_do, + clk_b => clock_vid, + addr_b => dl_addr(12 downto 0), + we_b => bg_1_rom_we, + d_b => dl_data +); + +-- background graphics ROM 2 +--bg_graphics_bits_2 : entity work.congo_bg_bits_2 +--port map( +-- clk => clock_vidn, +-- addr => bg_graphics_addr, +-- data => bg_graphics2_do +--); +bg_2_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 13) = "01000" else '0'; -- 10000-11FFF +bg_graphics_bits_2 : entity work.dpram +generic map( dWidth => 8, aWidth => 13) +port map( + clk_a => clock_vidn, + addr_a => bg_graphics_addr, + q_a => bg_graphics2_do, + clk_b => clock_vid, + addr_b => dl_addr(12 downto 0), + we_b => bg_2_rom_we, + d_b => dl_data +); + +-- background graphics ROM 3 +--bg_graphics_bits_3 : entity work.congo_bg_bits_3 +--port map( +-- clk => clock_vidn, +-- addr => bg_graphics_addr, +-- data => bg_graphics3_do +--); + +bg_3_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 13) = "01001" else '0'; -- 12000-13FFF +bg_graphics_bits_3 : entity work.dpram +generic map( dWidth => 8, aWidth => 13) +port map( + clk_a => clock_vidn, + addr_a => bg_graphics_addr, + q_a => bg_graphics3_do, + clk_b => clock_vid, + addr_b => dl_addr(12 downto 0), + we_b => bg_3_rom_we, + d_b => dl_data +); + +-- sprite graphics ROM 1 +--sp_graphics_bits_1 : entity work.congo_sp_bits_1 +--port map( +-- clk => clock_vidn, +-- addr => sp_graphics_addr, +-- data => sp_graphics1_do +--); + +sp_1_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 14) = "0110" else '0'; -- 18000-1BFFF +sp_graphics_bits_1 : entity work.dpram +generic map( dWidth => 8, aWidth => 14) +port map( + clk_a => clock_vidn, + addr_a => sp_graphics_addr, + q_a => sp_graphics1_do, + clk_b => clock_vid, + addr_b => dl_addr(13 downto 0), + we_b => sp_1_rom_we, + d_b => dl_data +); + +-- sprite graphics ROM 2 +--sp_graphics_bits_2 : entity work.congo_sp_bits_2 +--port map( +-- clk => clock_vidn, +-- addr => sp_graphics_addr, +-- data => sp_graphics2_do +--); + +sp_2_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 14) = "0101" else '0'; -- 14000-17FFF +sp_graphics_bits_2 : entity work.dpram +generic map( dWidth => 8, aWidth => 14) +port map( + clk_a => clock_vidn, + addr_a => sp_graphics_addr, + q_a => sp_graphics2_do, + clk_b => clock_vid, + addr_b => dl_addr(13 downto 0), + we_b => sp_2_rom_we, + d_b => dl_data +); + +-- sprite graphics ROM 3 +--sp_graphics_bits_3 : entity work.congo_sp_bits_3 +--port map( +-- clk => clock_vidn, +-- addr => sp_graphics_addr, +-- data => sp_graphics3_do +--); + +sp_3_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 14) = "0111" else '0'; -- 1C000-1FFFF +sp_graphics_bits_3 : entity work.dpram +generic map( dWidth => 8, aWidth => 14) +port map( + clk_a => clock_vidn, + addr_a => sp_graphics_addr, + q_a => sp_graphics3_do, + clk_b => clock_vid, + addr_b => dl_addr(13 downto 0), + we_b => sp_3_rom_we, + d_b => dl_data +); + +--congo_sound_board +sound_board : entity work.congo_sound_board +port map( + clock_24 => clock_24, + reset => reset, + sound_cmd => sound_cmd, + audio_out => audio_out, + + dl_addr => dl_addr, + dl_wr => dl_wr, + dl_data => dl_data, + + dbg_out => dbg_cpu_addr +); + +-- palette +--palette : entity work.congo_palette +--port map( +-- clk => clock_vidn, +-- addr => palette_addr, +-- data => palette_do +--); + +palette_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 8) = "1000100000" else '0'; -- 22000-220FF +palette : entity work.dpram +generic map( dWidth => 8, aWidth => 8) +port map( + clk_a => clock_vidn, + addr_a => palette_addr, + q_a => palette_do, + clk_b => clock_vid, + addr_b => dl_addr(7 downto 0), + we_b => palette_rom_we, + d_b => dl_data +); + + +end struct; \ No newline at end of file diff --git a/rtl/congo_samples.bin b/rtl/congo_samples.bin new file mode 100644 index 0000000..80d5f57 Binary files /dev/null and b/rtl/congo_samples.bin differ diff --git a/rtl/congo_samples.vhd b/rtl/congo_samples.vhd new file mode 100644 index 0000000..2783390 --- /dev/null +++ b/rtl/congo_samples.vhd @@ -0,0 +1,751 @@ +library ieee; +use ieee.std_logic_1164.all, ieee.numeric_std.all; + +-- bass.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 2005 start: 44(x 2C) stop: 2050(x 802) +-- congal.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 2003 start: 2094(x 82E) stop: 4098(x 1002) +-- congah.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 1970 start: 4142(x 102E) stop: 6112(x 17E0) +-- rim.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 373 start: 6156(x 180C) stop: 6530(x 1982) +-- gorilla.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 4991 start: 6574(x 19AE) stop: 11566(x 2D2E) + +entity congo_samples is + port ( + clk : in std_logic; + addr : in std_logic_vector(13 downto 0); + data : out std_logic_vector(7 downto 0) + ); +end entity; + +architecture prom of congo_samples is + type rom is array(0 to 11565) of std_logic_vector(7 downto 0); + signal rom_data : rom := ( + X"52", X"49", X"46", X"46", X"FA", X"07", X"00", X"00", X"57", X"41", X"56", X"45", X"66", X"6D", X"74", X"20", + X"10", X"00", X"00", X"00", X"01", X"00", X"01", X"00", X"11", X"2B", X"00", X"00", X"11", X"2B", X"00", X"00", + X"01", X"00", X"08", X"00", X"64", X"61", X"74", X"61", X"D5", X"07", X"00", X"00", X"80", X"7E", X"80", X"7F", + X"81", X"7F", X"7F", X"80", X"81", X"7E", X"81", X"7F", X"7E", X"7F", X"81", X"80", X"7D", X"7F", X"7D", X"80", + X"79", X"85", X"36", X"00", X"10", X"0A", X"10", X"0E", X"15", X"12", X"15", X"19", X"1D", X"20", X"1F", X"22", + X"23", X"25", X"28", X"27", X"2C", X"2D", X"30", X"31", X"32", X"36", X"37", X"3A", X"3B", X"43", X"4B", X"50", + X"56", X"5C", X"64", X"6C", X"73", X"7B", X"82", X"8B", X"92", X"9A", X"A3", X"AA", X"B2", X"B9", X"C0", X"C7", + X"CE", X"D5", X"DB", X"E1", X"E7", X"EB", X"F1", X"F0", X"ED", X"EC", X"E9", X"E7", X"E5", X"E3", X"E1", X"DF", + X"DC", X"DA", X"D9", X"D6", X"D4", X"D3", X"D1", X"CF", X"CE", X"CC", X"CB", X"C9", X"C7", X"C6", X"C4", X"C3", + X"C1", X"C0", X"BE", X"BD", X"BB", X"BA", X"B8", X"B8", X"B6", X"B5", X"B4", X"B3", X"B2", X"B0", X"B0", X"AE", + X"AD", X"AC", X"AB", X"AA", X"A9", X"A8", X"A7", X"A6", X"A5", X"A4", X"A4", X"A3", X"A2", X"A1", X"A0", X"9F", + X"9F", X"9E", X"9D", X"9C", X"9B", X"9A", X"98", X"97", X"95", X"94", X"92", X"90", X"8F", X"8D", X"8B", X"89", + X"87", X"85", X"83", X"80", X"7E", X"7C", X"7A", X"77", X"75", X"73", X"70", X"6E", X"6C", X"69", X"67", X"65", + X"62", X"60", X"5E", X"5C", X"59", X"57", X"55", X"53", X"51", X"50", X"4E", X"4C", X"4A", X"49", X"47", X"46", + X"44", X"43", X"42", X"41", X"40", X"3F", X"3E", X"3E", X"3D", X"3C", X"3C", X"3B", X"3B", X"3B", X"3B", X"3B", + X"3B", X"3C", X"3C", X"3D", X"3D", X"3E", X"3F", X"40", X"41", X"42", X"43", X"44", X"45", X"47", X"49", X"4A", + X"4C", X"4E", X"4F", X"51", X"53", X"55", X"57", X"59", X"5B", X"5E", X"60", X"62", X"64", X"67", X"69", X"6C", + X"6E", X"70", X"73", X"75", X"78", X"7A", X"7C", X"7F", X"81", X"83", X"85", X"88", X"8A", X"8C", X"8E", X"90", + X"92", X"94", X"96", X"98", X"9A", X"9C", X"9E", X"9F", X"A1", X"A2", X"A3", X"A5", X"A6", X"A7", X"A8", X"A9", + X"AA", X"AB", X"AC", X"AC", X"AD", X"AD", X"AE", X"AE", X"AE", X"AE", X"AE", X"AE", X"AE", X"AE", X"AD", X"AD", + X"AC", X"AC", X"AB", X"AB", X"AA", X"A9", X"A8", X"A7", X"A6", X"A4", X"A3", X"A2", X"A1", X"9F", X"9E", X"9C", + X"9B", X"99", X"98", X"96", X"94", X"92", X"90", X"8F", X"8D", X"8B", X"89", X"87", X"85", X"83", X"81", X"7F", + X"7D", X"7B", X"7A", X"78", X"76", X"74", X"72", X"70", X"6F", X"6D", X"6B", X"6A", X"68", X"66", X"65", X"63", + X"62", X"61", X"5F", X"5E", X"5D", X"5C", X"5B", X"5A", X"59", X"58", X"57", X"57", X"56", X"55", X"55", X"55", + X"54", X"54", X"54", X"54", X"54", X"54", X"54", X"54", X"54", X"55", X"55", X"56", X"56", X"57", X"57", X"58", + X"59", X"5A", X"5B", X"5C", X"5D", X"5E", X"5F", X"61", X"62", X"63", X"65", X"66", X"67", X"69", X"6B", X"6C", + X"6E", X"6F", X"71", X"72", X"74", X"76", X"77", X"79", X"7B", X"7D", X"7E", X"80", X"82", X"83", X"85", X"87", + X"88", X"8A", X"8B", X"8D", X"8E", X"90", X"91", X"93", X"94", X"95", X"97", X"98", X"99", X"9A", X"9B", X"9C", + X"9D", X"9E", X"9F", X"A0", X"A1", X"A1", X"A2", X"A2", X"A3", X"A3", X"A4", X"A4", X"A4", X"A4", X"A4", X"A4", + X"A4", X"A4", X"A4", X"A3", X"A3", X"A3", X"A2", X"A2", X"A1", X"A1", X"A0", X"9F", X"9E", X"9D", X"9C", X"9B", + X"9A", X"99", X"98", X"97", X"96", X"95", X"93", X"92", X"91", X"90", X"8E", X"8D", X"8B", X"8A", X"89", X"87", + X"85", X"84", X"83", X"81", X"80", X"7E", X"7D", X"7B", X"7A", X"78", X"77", X"76", X"74", X"73", X"72", X"70", + X"6F", X"6E", X"6D", X"6C", X"6A", X"6A", X"69", X"68", X"67", X"66", X"65", X"64", X"64", X"63", X"62", X"62", + X"61", X"61", X"60", X"60", X"60", X"60", X"5F", X"5F", X"5F", X"5F", X"5F", X"5F", X"60", X"60", X"60", X"61", + X"61", X"61", X"62", X"62", X"63", X"64", X"64", X"65", X"66", X"67", X"68", X"69", X"69", X"6A", X"6B", X"6C", + X"6E", X"6F", X"70", X"71", X"72", X"73", X"74", X"76", X"77", X"78", X"79", X"7A", X"7C", X"7D", X"7E", X"7F", + X"81", X"82", X"83", X"84", X"85", X"87", X"88", X"89", X"8A", X"8B", X"8C", X"8D", X"8E", X"8F", X"90", X"91", + X"92", X"93", X"93", X"94", X"95", X"96", X"96", X"97", X"97", X"98", X"98", X"99", X"99", X"99", X"9A", X"9A", + X"9A", X"9B", X"9B", X"9A", X"9B", X"9A", X"9A", X"9A", X"9A", X"9A", X"99", X"99", X"99", X"98", X"98", X"97", + X"97", X"96", X"95", X"95", X"94", X"93", X"93", X"92", X"91", X"90", X"8F", X"8E", X"8D", X"8D", X"8B", X"8A", + X"8A", X"88", X"87", X"86", X"85", X"84", X"83", X"82", X"81", X"80", X"7F", X"7E", X"7D", X"7C", X"7B", X"7A", + X"79", X"78", X"77", X"76", X"75", X"74", X"73", X"72", X"71", X"70", X"6F", X"6F", X"6E", X"6D", X"6D", X"6C", + X"6B", X"6B", X"6A", X"6A", X"69", X"69", X"69", X"68", X"68", X"68", X"68", X"68", X"67", X"68", X"67", X"68", + X"68", X"68", X"68", X"68", X"68", X"68", X"69", X"69", X"69", X"6A", X"6B", X"6B", X"6C", X"6C", X"6D", X"6D", + X"6E", X"6F", X"6F", X"70", X"71", X"72", X"72", X"73", X"74", X"75", X"76", X"77", X"78", X"79", X"7A", X"7B", + X"7C", X"7D", X"7D", X"7E", X"7F", X"80", X"81", X"82", X"83", X"84", X"85", X"86", X"87", X"87", X"88", X"89", + X"8A", X"8B", X"8B", X"8C", X"8D", X"8D", X"8E", X"8F", X"8F", X"90", X"90", X"91", X"91", X"92", X"92", X"92", + X"92", X"93", X"93", X"93", X"93", X"93", X"94", X"94", X"94", X"94", X"94", X"93", X"93", X"93", X"93", X"93", + X"92", X"92", X"92", X"91", X"91", X"91", X"90", X"90", X"8F", X"8F", X"8E", X"8D", X"8D", X"8C", X"8B", X"8B", + X"8A", X"89", X"89", X"88", X"87", X"86", X"86", X"85", X"84", X"83", X"82", X"82", X"81", X"80", X"7F", X"7E", + X"7E", X"7D", X"7C", X"7B", X"7B", X"7A", X"79", X"78", X"78", X"77", X"76", X"76", X"75", X"75", X"74", X"74", + X"73", X"73", X"72", X"72", X"71", X"71", X"70", X"70", X"70", X"70", X"6F", X"6F", X"6F", X"6F", X"6E", X"6E", + X"6E", X"6E", X"6E", X"6E", X"6E", X"6E", X"6E", X"6F", X"6F", X"6F", X"6F", X"6F", X"70", X"70", X"70", X"70", + X"71", X"71", X"72", X"72", X"73", X"73", X"74", X"74", X"75", X"75", X"76", X"76", X"77", X"78", X"78", X"79", + X"79", X"7A", X"7B", X"7B", X"7C", X"7D", X"7D", X"7E", X"7F", X"7F", X"80", X"81", X"81", X"82", X"83", X"83", + X"84", X"84", X"85", X"86", X"86", X"87", X"87", X"88", X"88", X"89", X"89", X"8A", X"8A", X"8B", X"8B", X"8C", + X"8C", X"8C", X"8D", X"8D", X"8D", X"8E", X"8E", X"8E", X"8E", X"8E", X"8E", X"8E", X"8F", X"8F", X"8F", X"8E", + X"8E", X"8E", X"8E", X"8E", X"8E", X"8E", X"8E", X"8D", X"8D", X"8D", X"8D", X"8C", X"8C", X"8C", X"8B", X"8B", + X"8A", X"8A", X"89", X"89", X"88", X"88", X"87", X"87", X"86", X"85", X"85", X"84", X"84", X"83", X"83", X"82", + X"81", X"81", X"80", X"80", X"7F", X"7E", X"7E", X"7D", X"7D", X"7C", X"7C", X"7B", X"7A", X"7A", X"79", X"79", + X"78", X"78", X"77", X"77", X"76", X"76", X"76", X"75", X"75", X"75", X"74", X"74", X"74", X"73", X"73", X"73", + X"73", X"72", X"72", X"72", X"72", X"72", X"72", X"72", X"72", X"72", X"72", X"72", X"73", X"73", X"73", X"73", + X"73", X"73", X"74", X"74", X"74", X"75", X"75", X"75", X"76", X"76", X"76", X"77", X"77", X"78", X"78", X"78", + X"79", X"79", X"7A", X"7A", X"7B", X"7B", X"7C", X"7C", X"7D", X"7D", X"7E", X"7E", X"7F", X"7F", X"80", X"80", + X"81", X"81", X"82", X"82", X"83", X"83", X"84", X"84", X"84", X"85", X"85", X"86", X"86", X"86", X"87", X"87", + X"87", X"88", X"88", X"88", X"88", X"89", X"89", X"89", X"89", X"89", X"8A", X"8A", X"8A", X"8A", X"8A", X"8A", + X"8A", X"8A", X"8A", X"8A", X"8A", X"8A", X"8A", X"8A", X"8A", X"8A", X"8A", X"89", X"89", X"89", X"89", X"88", + X"88", X"88", X"88", X"87", X"87", X"87", X"87", X"86", X"86", X"86", X"85", X"85", X"84", X"84", X"84", X"83", + X"83", X"82", X"82", X"82", X"81", X"81", X"80", X"80", X"80", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", X"7D", + X"7C", X"7C", X"7C", X"7B", X"7B", X"7A", X"7A", X"7A", X"79", X"79", X"79", X"78", X"78", X"78", X"78", X"77", + X"77", X"77", X"77", X"76", X"76", X"76", X"76", X"76", X"76", X"76", X"75", X"75", X"75", X"75", X"75", X"76", + X"75", X"76", X"76", X"76", X"76", X"76", X"76", X"76", X"76", X"77", X"77", X"77", X"77", X"78", X"78", X"78", + X"79", X"79", X"79", X"7A", X"7A", X"7A", X"7A", X"7B", X"7B", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", X"7E", + X"7E", X"7F", X"7F", X"80", X"80", X"80", X"81", X"81", X"82", X"82", X"82", X"83", X"83", X"83", X"84", X"84", + X"84", X"85", X"85", X"85", X"85", X"86", X"86", X"86", X"87", X"87", X"87", X"87", X"87", X"87", X"87", X"88", + X"88", X"88", X"88", X"88", X"88", X"88", X"88", X"88", X"88", X"88", X"88", X"88", X"87", X"87", X"87", X"87", + X"87", X"87", X"87", X"86", X"86", X"86", X"86", X"86", X"85", X"85", X"85", X"85", X"84", X"84", X"84", X"83", + X"83", X"83", X"82", X"82", X"82", X"82", X"81", X"81", X"81", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7E", + X"7E", X"7E", X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7A", X"7A", + X"7A", X"7A", X"7A", X"7A", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", + X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"79", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", + X"7A", X"7A", X"7A", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", X"7D", + X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"81", X"81", X"81", X"81", + X"81", X"82", X"82", X"82", X"82", X"83", X"83", X"83", X"83", X"83", X"83", X"84", X"84", X"84", X"84", X"84", + X"84", X"84", X"84", X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"85", + X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"85", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"84", + X"83", X"83", X"83", X"83", X"83", X"83", X"82", X"82", X"82", X"82", X"81", X"81", X"81", X"81", X"80", X"80", + X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7D", X"7C", + X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7A", + X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", + X"7A", X"7A", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", + X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", + X"80", X"81", X"81", X"81", X"81", X"81", X"81", X"82", X"82", X"82", X"82", X"82", X"82", X"83", X"83", X"83", + X"83", X"83", X"83", X"83", X"83", X"83", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"84", + X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"83", X"83", X"83", X"83", X"83", X"83", + X"83", X"83", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"81", X"81", X"81", X"81", X"81", X"81", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", + X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", + X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", + X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"81", X"81", X"81", X"81", + X"81", X"81", X"81", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"83", X"83", X"83", + X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"83", + X"83", X"83", X"83", X"83", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"81", X"81", X"81", + X"81", X"81", X"81", X"81", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", + X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", + X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", + X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"82", X"81", X"81", X"81", X"81", X"81", X"81", + X"82", X"81", X"81", X"82", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", + X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"80", X"80", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7D", X"7E", X"7E", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7E", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", + X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", + X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"80", X"7F", X"80", X"7F", X"80", X"7F", X"7F", X"7F", X"80", X"7F", + X"80", X"00", X"52", X"49", X"46", X"46", X"F8", X"07", X"00", X"00", X"57", X"41", X"56", X"45", X"66", X"6D", + X"74", X"20", X"10", X"00", X"00", X"00", X"01", X"00", X"01", X"00", X"11", X"2B", X"00", X"00", X"11", X"2B", + X"00", X"00", X"01", X"00", X"08", X"00", X"64", X"61", X"74", X"61", X"D3", X"07", X"00", X"00", X"80", X"80", + X"80", X"80", X"81", X"80", X"81", X"80", X"81", X"80", X"81", X"7F", X"81", X"7F", X"81", X"7F", X"81", X"7F", + X"81", X"7F", X"81", X"7E", X"81", X"7B", X"23", X"13", X"1B", X"18", X"1E", X"1B", X"21", X"1E", X"23", X"22", + X"26", X"26", X"29", X"29", X"2D", X"3C", X"57", X"79", X"A1", X"CE", X"DB", X"D7", X"D7", X"D4", X"D3", X"D1", + X"D0", X"CE", X"CD", X"CB", X"C9", X"C8", X"C7", X"C5", X"C4", X"C3", X"C1", X"C0", X"BF", X"BD", X"BC", X"BB", + X"BA", X"B9", X"B8", X"B7", X"B6", X"B4", X"B3", X"B2", X"B1", X"B0", X"AF", X"AE", X"AD", X"AC", X"AC", X"AB", + X"AA", X"A9", X"A8", X"A7", X"A6", X"A6", X"A4", X"A1", X"9C", X"96", X"8E", X"85", X"7B", X"70", X"65", X"5A", + X"4F", X"45", X"3A", X"31", X"29", X"22", X"1D", X"19", X"17", X"16", X"17", X"1A", X"1E", X"25", X"2C", X"35", + X"3F", X"4A", X"55", X"61", X"6D", X"79", X"85", X"90", X"9B", X"A4", X"AC", X"B3", X"B9", X"BC", X"BC", X"BA", + X"B9", X"B7", X"B4", X"AF", X"A9", X"A1", X"99", X"90", X"87", X"7D", X"73", X"6A", X"60", X"58", X"50", X"49", + X"43", X"3E", X"3B", X"38", X"38", X"38", X"3A", X"3E", X"43", X"49", X"50", X"58", X"61", X"6A", X"74", X"7E", + X"87", X"91", X"99", X"A2", X"A9", X"AF", X"B4", X"B8", X"BB", X"BD", X"BD", X"BB", X"B9", X"B5", X"B0", X"AA", + X"A3", X"9B", X"93", X"8A", X"81", X"78", X"70", X"67", X"5F", X"58", X"52", X"4D", X"49", X"46", X"44", X"44", + X"45", X"47", X"4A", X"4F", X"54", X"5B", X"62", X"6A", X"72", X"7A", X"83", X"8B", X"93", X"9B", X"A2", X"A8", + X"AE", X"B2", X"B5", X"B7", X"B8", X"B7", X"B6", X"B3", X"AF", X"AB", X"A5", X"9E", X"97", X"90", X"88", X"80", + X"78", X"70", X"69", X"62", X"5C", X"57", X"52", X"4F", X"4D", X"4B", X"4B", X"4C", X"4F", X"52", X"56", X"5B", + X"61", X"68", X"6F", X"76", X"7E", X"86", X"8D", X"94", X"9B", X"A1", X"A6", X"AB", X"AE", X"B1", X"B2", X"B2", + X"B2", X"B0", X"AD", X"AA", X"A5", X"A0", X"9A", X"93", X"8C", X"85", X"7E", X"77", X"70", X"6A", X"64", X"5E", + X"5A", X"56", X"53", X"52", X"51", X"51", X"52", X"54", X"57", X"5C", X"60", X"66", X"6C", X"72", X"79", X"80", + X"86", X"8D", X"93", X"99", X"9E", X"A3", X"A7", X"A9", X"AB", X"AC", X"AC", X"AB", X"A9", X"A7", X"A3", X"9F", + X"9A", X"95", X"8F", X"88", X"82", X"7C", X"75", X"6F", X"6A", X"64", X"60", X"5C", X"59", X"57", X"56", X"55", + X"56", X"57", X"59", X"5C", X"60", X"65", X"6A", X"6F", X"75", X"7B", X"81", X"87", X"8D", X"93", X"98", X"9C", + X"A0", X"A3", X"A6", X"A8", X"A8", X"A8", X"A7", X"A5", X"A3", X"9F", X"9B", X"96", X"91", X"8C", X"86", X"81", + X"7B", X"75", X"70", X"6B", X"66", X"62", X"5F", X"5D", X"5B", X"5A", X"5A", X"5A", X"5C", X"5E", X"61", X"65", + X"69", X"6E", X"73", X"78", X"7D", X"83", X"88", X"8D", X"92", X"96", X"9A", X"9D", X"A0", X"A2", X"A3", X"A4", + X"A3", X"A2", X"A0", X"9E", X"9B", X"97", X"92", X"8E", X"89", X"84", X"7E", X"79", X"74", X"6F", X"6B", X"67", + X"64", X"61", X"5F", X"5E", X"5D", X"5D", X"5E", X"5F", X"62", X"65", X"68", X"6C", X"70", X"75", X"7A", X"7F", + X"84", X"88", X"8D", X"91", X"95", X"99", X"9B", X"9D", X"9F", X"A0", X"A0", X"9F", X"9E", X"9D", X"9A", X"97", + X"94", X"90", X"8C", X"87", X"82", X"7E", X"79", X"75", X"70", X"6D", X"69", X"66", X"64", X"62", X"61", X"61", + X"61", X"62", X"63", X"66", X"68", X"6B", X"6F", X"73", X"77", X"7C", X"80", X"85", X"89", X"8D", X"90", X"94", + X"97", X"99", X"9B", X"9C", X"9C", X"9C", X"9C", X"9A", X"99", X"96", X"94", X"91", X"8D", X"89", X"85", X"80", + X"7C", X"78", X"74", X"70", X"6D", X"6A", X"68", X"66", X"64", X"63", X"63", X"63", X"64", X"66", X"68", X"6B", + X"6E", X"71", X"75", X"79", X"7D", X"81", X"85", X"89", X"8C", X"90", X"93", X"95", X"97", X"98", X"99", X"9A", + X"9A", X"99", X"98", X"96", X"94", X"91", X"8E", X"8B", X"87", X"84", X"80", X"7C", X"78", X"75", X"71", X"6F", + X"6C", X"6A", X"68", X"67", X"67", X"66", X"67", X"68", X"69", X"6C", X"6E", X"71", X"74", X"77", X"7B", X"7E", + X"82", X"86", X"89", X"8C", X"8F", X"92", X"94", X"95", X"97", X"97", X"98", X"97", X"96", X"95", X"93", X"91", + X"8F", X"8C", X"89", X"85", X"82", X"7F", X"7B", X"78", X"75", X"72", X"6F", X"6D", X"6B", X"6A", X"69", X"68", + X"68", X"69", X"6A", X"6B", X"6D", X"70", X"72", X"75", X"78", X"7C", X"7F", X"82", X"86", X"89", X"8B", X"8E", + X"90", X"92", X"93", X"95", X"95", X"95", X"95", X"94", X"93", X"91", X"8F", X"8D", X"8A", X"87", X"84", X"81", + X"7E", X"7B", X"78", X"75", X"73", X"70", X"6F", X"6D", X"6C", X"6B", X"6A", X"6B", X"6B", X"6D", X"6E", X"70", + X"72", X"75", X"78", X"7A", X"7D", X"80", X"83", X"86", X"89", X"8B", X"8E", X"90", X"91", X"92", X"93", X"93", + X"93", X"93", X"92", X"91", X"8F", X"8D", X"8B", X"88", X"86", X"83", X"80", X"7D", X"7A", X"78", X"75", X"73", + X"71", X"6F", X"6E", X"6D", X"6C", X"6C", X"6C", X"6D", X"6E", X"70", X"71", X"73", X"76", X"78", X"7B", X"7E", + X"80", X"83", X"86", X"88", X"8B", X"8C", X"8E", X"8F", X"90", X"91", X"91", X"91", X"91", X"90", X"8E", X"8D", + X"8B", X"89", X"87", X"84", X"82", X"7F", X"7D", X"7A", X"78", X"76", X"74", X"72", X"71", X"70", X"6F", X"6E", + X"6E", X"6F", X"6F", X"70", X"72", X"74", X"76", X"78", X"7A", X"7D", X"7F", X"82", X"84", X"86", X"89", X"8B", + X"8C", X"8E", X"8F", X"90", X"90", X"90", X"90", X"8F", X"8E", X"8D", X"8C", X"8A", X"88", X"86", X"84", X"81", + X"7F", X"7C", X"7A", X"78", X"76", X"74", X"73", X"71", X"70", X"70", X"70", X"70", X"70", X"71", X"72", X"73", + X"75", X"77", X"79", X"7B", X"7D", X"7F", X"82", X"84", X"86", X"88", X"8A", X"8B", X"8C", X"8D", X"8E", X"8E", + X"8E", X"8E", X"8D", X"8C", X"8B", X"8A", X"88", X"87", X"85", X"83", X"80", X"7E", X"7C", X"7A", X"78", X"76", + X"75", X"73", X"72", X"71", X"71", X"71", X"71", X"72", X"72", X"74", X"75", X"76", X"78", X"7A", X"7C", X"7E", + X"80", X"82", X"85", X"86", X"88", X"8A", X"8B", X"8C", X"8D", X"8D", X"8E", X"8D", X"8D", X"8D", X"8C", X"8A", + X"89", X"87", X"86", X"84", X"82", X"80", X"7E", X"7C", X"7A", X"78", X"77", X"75", X"74", X"73", X"72", X"72", + X"72", X"72", X"73", X"73", X"75", X"76", X"77", X"79", X"7B", X"7D", X"7E", X"80", X"82", X"84", X"86", X"87", + X"89", X"8A", X"8B", X"8B", X"8C", X"8C", X"8C", X"8B", X"8B", X"8A", X"89", X"87", X"86", X"84", X"83", X"81", + X"7F", X"7D", X"7C", X"7A", X"78", X"77", X"76", X"74", X"74", X"73", X"73", X"73", X"73", X"74", X"75", X"76", + X"77", X"79", X"7A", X"7C", X"7E", X"7F", X"81", X"83", X"84", X"86", X"88", X"89", X"8A", X"8B", X"8B", X"8B", + X"8B", X"8B", X"8B", X"8A", X"89", X"88", X"87", X"86", X"84", X"82", X"81", X"7F", X"7E", X"7C", X"7A", X"79", + X"78", X"76", X"75", X"75", X"74", X"74", X"74", X"75", X"75", X"76", X"77", X"78", X"79", X"7B", X"7D", X"7E", + X"80", X"81", X"83", X"84", X"86", X"87", X"88", X"89", X"89", X"8A", X"8A", X"8A", X"8A", X"89", X"89", X"88", + X"87", X"86", X"84", X"83", X"81", X"80", X"7E", X"7D", X"7B", X"7A", X"79", X"78", X"77", X"76", X"75", X"75", + X"75", X"75", X"76", X"76", X"77", X"78", X"79", X"7A", X"7C", X"7D", X"7F", X"80", X"82", X"83", X"85", X"86", + X"87", X"88", X"88", X"89", X"89", X"89", X"89", X"89", X"89", X"88", X"87", X"86", X"85", X"84", X"82", X"81", + X"80", X"7E", X"7D", X"7C", X"7A", X"79", X"78", X"78", X"77", X"77", X"76", X"76", X"77", X"77", X"78", X"78", + X"79", X"7A", X"7B", X"7D", X"7E", X"7F", X"80", X"82", X"83", X"84", X"85", X"86", X"87", X"87", X"88", X"88", + X"88", X"88", X"87", X"87", X"86", X"86", X"84", X"84", X"82", X"81", X"80", X"7F", X"7E", X"7C", X"7B", X"7A", + X"79", X"78", X"78", X"77", X"77", X"77", X"77", X"77", X"78", X"78", X"79", X"7A", X"7B", X"7C", X"7D", X"7E", + X"7F", X"80", X"82", X"83", X"84", X"85", X"86", X"86", X"87", X"87", X"87", X"87", X"87", X"87", X"86", X"86", + X"85", X"84", X"83", X"82", X"81", X"80", X"7F", X"7E", X"7D", X"7C", X"7B", X"7A", X"7A", X"79", X"79", X"78", + X"78", X"79", X"79", X"79", X"7A", X"7A", X"7B", X"7C", X"7D", X"7E", X"7F", X"80", X"81", X"82", X"83", X"84", + X"84", X"85", X"86", X"86", X"86", X"86", X"86", X"86", X"86", X"85", X"85", X"84", X"83", X"82", X"82", X"80", + X"7F", X"7E", X"7D", X"7D", X"7C", X"7B", X"7A", X"7A", X"79", X"79", X"79", X"79", X"79", X"79", X"7A", X"7A", + X"7B", X"7B", X"7C", X"7D", X"7E", X"7F", X"80", X"81", X"82", X"82", X"83", X"84", X"84", X"85", X"85", X"86", + X"86", X"86", X"85", X"85", X"85", X"84", X"84", X"83", X"82", X"81", X"80", X"80", X"7F", X"7E", X"7D", X"7C", + X"7C", X"7B", X"7B", X"7A", X"7A", X"7A", X"7A", X"7A", X"7B", X"7B", X"7B", X"7C", X"7D", X"7D", X"7E", X"7F", + X"80", X"80", X"81", X"82", X"82", X"83", X"84", X"84", X"84", X"85", X"85", X"85", X"85", X"85", X"84", X"84", + X"83", X"83", X"82", X"81", X"80", X"80", X"7F", X"7E", X"7D", X"7D", X"7C", X"7C", X"7B", X"7B", X"7A", X"7A", + X"7A", X"7A", X"7A", X"7B", X"7B", X"7B", X"7C", X"7D", X"7D", X"7E", X"7F", X"7F", X"80", X"81", X"81", X"82", + X"82", X"83", X"83", X"84", X"84", X"84", X"84", X"84", X"84", X"84", X"83", X"83", X"82", X"82", X"81", X"80", + X"80", X"7F", X"7E", X"7E", X"7D", X"7D", X"7C", X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7C", + X"7D", X"7D", X"7E", X"7E", X"7F", X"7F", X"80", X"81", X"81", X"82", X"82", X"83", X"83", X"83", X"84", X"84", + X"84", X"84", X"84", X"83", X"83", X"83", X"82", X"82", X"81", X"81", X"80", X"80", X"7F", X"7E", X"7E", X"7D", + X"7D", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7E", X"7E", X"7F", + X"7F", X"80", X"80", X"81", X"81", X"82", X"82", X"82", X"83", X"83", X"83", X"83", X"83", X"83", X"83", X"82", + X"82", X"82", X"81", X"81", X"80", X"80", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7C", X"7C", + X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"80", X"80", X"81", X"81", X"82", + X"82", X"82", X"82", X"83", X"83", X"83", X"83", X"83", X"83", X"82", X"82", X"82", X"81", X"81", X"81", X"80", + X"80", X"7F", X"7F", X"7F", X"7E", X"7E", X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", + X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"80", X"80", X"81", X"81", X"81", X"81", X"82", X"82", X"82", + X"82", X"82", X"82", X"82", X"82", X"81", X"81", X"81", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7E", X"7E", + X"7E", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", + X"7F", X"80", X"80", X"81", X"81", X"81", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", X"82", + X"82", X"81", X"81", X"81", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7D", X"7E", X"7E", X"7D", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"81", + X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"80", X"80", X"80", X"80", + X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7D", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"81", X"81", X"81", X"81", X"81", X"81", X"82", + X"82", X"82", X"82", X"81", X"81", X"81", X"81", X"81", X"81", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"80", X"80", X"80", X"80", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", + X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", + X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"80", X"80", X"80", + X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"81", X"81", X"81", X"81", + X"81", X"81", X"81", X"81", X"81", X"81", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", + X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"81", X"81", X"81", X"81", X"81", X"81", X"81", X"81", + X"81", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"81", X"81", X"81", X"81", X"81", X"81", X"80", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"00", X"52", X"49", X"46", X"46", X"D6", X"07", X"00", X"00", X"57", X"41", X"56", X"45", X"66", X"6D", + X"74", X"20", X"10", X"00", X"00", X"00", X"01", X"00", X"01", X"00", X"11", X"2B", X"00", X"00", X"11", X"2B", + X"00", X"00", X"01", X"00", X"08", X"00", X"64", X"61", X"74", X"61", X"B2", X"07", X"00", X"00", X"81", X"83", + X"80", X"80", X"7E", X"7F", X"80", X"7F", X"81", X"81", X"81", X"82", X"83", X"7F", X"83", X"7D", X"84", X"7B", + X"8B", X"44", X"01", X"12", X"09", X"13", X"0F", X"14", X"10", X"12", X"16", X"18", X"1B", X"21", X"22", X"24", + X"2B", X"4D", X"7A", X"B7", X"E9", X"E5", X"E6", X"E2", X"E1", X"DE", X"DB", X"DB", X"D8", X"D4", X"D4", X"D2", + X"D4", X"CE", X"C9", X"CC", X"C9", X"C6", X"C9", X"C9", X"C1", X"C0", X"C0", X"BF", X"BE", X"BB", X"B9", X"B9", + X"B9", X"B8", X"B4", X"B3", X"B4", X"B3", X"B1", X"B1", X"B0", X"AE", X"AD", X"AC", X"AC", X"AB", X"AA", X"A9", + X"A8", X"A6", X"A4", X"A1", X"99", X"8F", X"84", X"76", X"68", X"59", X"4A", X"3A", X"2C", X"20", X"15", X"0D", + X"07", X"04", X"03", X"05", X"09", X"11", X"1B", X"28", X"36", X"46", X"56", X"67", X"78", X"88", X"97", X"A5", + X"B0", X"BA", X"C0", X"C0", X"BE", X"BC", X"B9", X"B4", X"AC", X"A2", X"96", X"89", X"7C", X"6E", X"61", X"54", + X"48", X"3E", X"35", X"2F", X"2A", X"28", X"28", X"2B", X"30", X"37", X"41", X"4C", X"58", X"65", X"73", X"81", + X"8E", X"9A", X"A6", X"B0", X"B8", X"BF", X"C3", X"C5", X"C4", X"C2", X"BD", X"B6", X"AD", X"A3", X"98", X"8B", + X"7F", X"73", X"67", X"5B", X"51", X"49", X"41", X"3C", X"39", X"38", X"39", X"3D", X"42", X"49", X"52", X"5D", + X"68", X"74", X"80", X"8C", X"98", X"A2", X"AC", X"B4", X"BB", X"BF", X"C2", X"C2", X"C0", X"BD", X"B8", X"B0", + X"A7", X"9D", X"92", X"86", X"7B", X"6F", X"64", X"5B", X"52", X"4A", X"45", X"41", X"3F", X"3F", X"41", X"45", + X"4B", X"53", X"5C", X"66", X"71", X"7C", X"88", X"93", X"9D", X"A6", X"AE", X"B4", X"B9", X"BC", X"BD", X"BC", + X"B9", X"B5", X"AF", X"A7", X"9E", X"94", X"8A", X"7F", X"74", X"6A", X"60", X"58", X"51", X"4B", X"47", X"45", + X"44", X"46", X"49", X"4E", X"55", X"5D", X"66", X"70", X"7A", X"84", X"8F", X"98", X"A1", X"A9", X"AF", X"B4", + X"B8", X"B9", X"B9", X"B7", X"B3", X"AE", X"A7", X"A0", X"97", X"8D", X"83", X"79", X"70", X"67", X"5F", X"58", + X"52", X"4E", X"4B", X"4A", X"4A", X"4C", X"50", X"56", X"5C", X"64", X"6D", X"76", X"7F", X"89", X"92", X"9A", + X"A2", X"A8", X"AD", X"B1", X"B3", X"B3", X"B2", X"AF", X"AB", X"A6", X"9F", X"97", X"8E", X"85", X"7C", X"73", + X"6B", X"63", X"5C", X"56", X"51", X"4E", X"4D", X"4D", X"4E", X"51", X"56", X"5B", X"62", X"6A", X"73", X"7B", + X"84", X"8C", X"94", X"9C", X"A2", X"A7", X"AB", X"AD", X"AF", X"AE", X"AC", X"AA", X"A5", X"A0", X"99", X"91", + X"89", X"81", X"79", X"71", X"69", X"62", X"5C", X"57", X"54", X"52", X"51", X"51", X"54", X"57", X"5C", X"62", + X"69", X"70", X"78", X"80", X"89", X"90", X"97", X"9E", X"A3", X"A7", X"AA", X"AC", X"AC", X"AA", X"A8", X"A5", + X"A0", X"99", X"93", X"8B", X"84", X"7C", X"74", X"6D", X"66", X"60", X"5C", X"58", X"56", X"54", X"54", X"56", + X"59", X"5D", X"62", X"68", X"6F", X"76", X"7D", X"85", X"8C", X"93", X"98", X"9E", X"A2", X"A5", X"A7", X"A8", + X"A7", X"A5", X"A2", X"9E", X"99", X"93", X"8C", X"85", X"7E", X"77", X"70", X"6A", X"65", X"60", X"5C", X"59", + X"58", X"57", X"58", X"5B", X"5E", X"62", X"68", X"6E", X"74", X"7B", X"82", X"89", X"90", X"95", X"9B", X"9F", + X"A2", X"A4", X"A6", X"A6", X"A4", X"A2", X"9F", X"9B", X"95", X"90", X"89", X"83", X"7C", X"75", X"6F", X"6A", + X"65", X"61", X"5E", X"5C", X"5B", X"5B", X"5D", X"5F", X"63", X"68", X"6D", X"73", X"79", X"7F", X"85", X"8C", + X"91", X"96", X"9B", X"9E", X"A0", X"A2", X"A2", X"A2", X"A0", X"9D", X"9A", X"95", X"90", X"8A", X"84", X"7E", + X"78", X"72", X"6C", X"68", X"64", X"61", X"5F", X"5D", X"5D", X"5E", X"60", X"62", X"66", X"6B", X"70", X"76", + X"7C", X"82", X"88", X"8D", X"92", X"96", X"9A", X"9D", X"9E", X"A0", X"9F", X"9E", X"9C", X"99", X"96", X"91", + X"8C", X"86", X"81", X"7B", X"75", X"70", X"6C", X"67", X"64", X"62", X"60", X"5F", X"60", X"61", X"63", X"67", + X"6B", X"70", X"75", X"7A", X"80", X"85", X"8B", X"90", X"94", X"98", X"9B", X"9D", X"9E", X"9E", X"9D", X"9C", + X"9A", X"96", X"92", X"8D", X"88", X"83", X"7E", X"78", X"73", X"6F", X"6A", X"67", X"65", X"63", X"62", X"62", + X"62", X"65", X"68", X"6B", X"6F", X"74", X"79", X"7E", X"83", X"88", X"8D", X"91", X"94", X"97", X"99", X"9B", + X"9B", X"9A", X"99", X"97", X"95", X"91", X"8D", X"88", X"83", X"7E", X"79", X"74", X"70", X"6C", X"69", X"66", + X"64", X"63", X"63", X"64", X"65", X"68", X"6B", X"6F", X"73", X"78", X"7D", X"82", X"87", X"8B", X"90", X"93", + X"97", X"98", X"9A", X"9B", X"9A", X"9A", X"98", X"96", X"93", X"8F", X"8B", X"86", X"81", X"7C", X"78", X"74", + X"70", X"6C", X"6A", X"68", X"66", X"65", X"66", X"67", X"69", X"6C", X"6F", X"73", X"77", X"7C", X"81", X"85", + X"89", X"8E", X"91", X"94", X"97", X"98", X"99", X"99", X"99", X"97", X"95", X"93", X"90", X"8B", X"87", X"83", + X"7E", X"79", X"75", X"71", X"6D", X"6B", X"69", X"67", X"66", X"66", X"67", X"68", X"6B", X"6E", X"71", X"75", + X"79", X"7E", X"82", X"86", X"8A", X"8E", X"91", X"94", X"96", X"96", X"97", X"97", X"96", X"94", X"92", X"8F", + X"8B", X"88", X"83", X"7F", X"7B", X"77", X"73", X"70", X"6D", X"6B", X"69", X"68", X"67", X"68", X"69", X"6B", + X"6E", X"71", X"74", X"78", X"7D", X"81", X"85", X"89", X"8C", X"90", X"92", X"95", X"96", X"97", X"97", X"96", + X"95", X"92", X"90", X"8D", X"8A", X"86", X"82", X"7E", X"7A", X"76", X"73", X"70", X"6D", X"6B", X"6A", X"69", + X"69", X"6A", X"6B", X"6D", X"70", X"73", X"77", X"7B", X"7F", X"83", X"86", X"8A", X"8D", X"90", X"92", X"94", + X"95", X"95", X"94", X"93", X"92", X"90", X"8D", X"8A", X"87", X"83", X"7F", X"7B", X"77", X"74", X"71", X"6E", + X"6C", X"6B", X"6A", X"69", X"6A", X"6B", X"6D", X"6F", X"72", X"75", X"79", X"7D", X"81", X"84", X"88", X"8B", + X"8E", X"90", X"92", X"94", X"94", X"94", X"93", X"92", X"90", X"8E", X"8C", X"88", X"85", X"82", X"7E", X"7A", + X"77", X"74", X"72", X"6F", X"6E", X"6D", X"6C", X"6C", X"6D", X"6F", X"70", X"73", X"76", X"79", X"7D", X"80", + X"84", X"87", X"8A", X"8D", X"8F", X"91", X"93", X"93", X"93", X"93", X"92", X"90", X"8E", X"8C", X"89", X"86", + X"82", X"7F", X"7C", X"78", X"75", X"73", X"70", X"6E", X"6D", X"6C", X"6C", X"6D", X"6E", X"70", X"72", X"75", + X"78", X"7B", X"7E", X"81", X"84", X"88", X"8A", X"8D", X"8E", X"90", X"91", X"91", X"91", X"90", X"8F", X"8D", + X"8B", X"89", X"86", X"83", X"80", X"7C", X"79", X"76", X"74", X"72", X"70", X"6E", X"6E", X"6D", X"6D", X"6E", + X"70", X"72", X"74", X"77", X"7A", X"7D", X"80", X"83", X"86", X"89", X"8C", X"8E", X"8F", X"91", X"91", X"91", + X"91", X"90", X"8E", X"8D", X"8A", X"88", X"85", X"82", X"7F", X"7C", X"79", X"76", X"74", X"72", X"70", X"6F", + X"6E", X"6E", X"6F", X"70", X"71", X"74", X"76", X"79", X"7C", X"7F", X"82", X"85", X"88", X"8A", X"8C", X"8E", + X"8F", X"90", X"90", X"90", X"8F", X"8E", X"8C", X"8A", X"88", X"86", X"83", X"80", X"7D", X"7A", X"77", X"75", + X"73", X"71", X"70", X"6F", X"6E", X"6F", X"6F", X"71", X"73", X"74", X"77", X"7A", X"7D", X"7F", X"82", X"85", + X"88", X"8A", X"8C", X"8D", X"8E", X"8F", X"8F", X"8E", X"8D", X"8C", X"8B", X"89", X"87", X"84", X"81", X"7F", + X"7C", X"79", X"77", X"75", X"74", X"72", X"71", X"70", X"71", X"71", X"73", X"74", X"76", X"78", X"7B", X"7D", + X"80", X"83", X"85", X"88", X"8A", X"8C", X"8D", X"8E", X"8F", X"8F", X"8F", X"8E", X"8D", X"8B", X"8A", X"88", + X"85", X"83", X"80", X"7D", X"7B", X"78", X"76", X"74", X"73", X"72", X"71", X"70", X"71", X"71", X"73", X"74", + X"76", X"79", X"7B", X"7E", X"80", X"83", X"86", X"88", X"8A", X"8C", X"8D", X"8E", X"8E", X"8E", X"8D", X"8C", + X"8B", X"89", X"87", X"85", X"82", X"80", X"7D", X"7B", X"78", X"76", X"74", X"72", X"71", X"70", X"70", X"70", + X"71", X"72", X"73", X"75", X"77", X"7A", X"7D", X"7F", X"82", X"84", X"87", X"89", X"8B", X"8C", X"8E", X"8E", + X"8E", X"8E", X"8D", X"8C", X"8B", X"89", X"87", X"85", X"82", X"80", X"7D", X"7A", X"78", X"76", X"74", X"73", + X"71", X"71", X"71", X"71", X"72", X"73", X"75", X"77", X"79", X"7C", X"7E", X"81", X"84", X"86", X"89", X"8A", + X"8C", X"8D", X"8E", X"8E", X"8E", X"8E", X"8C", X"8B", X"89", X"88", X"85", X"83", X"80", X"7E", X"7B", X"79", + X"76", X"75", X"73", X"71", X"70", X"70", X"70", X"71", X"72", X"74", X"76", X"78", X"7A", X"7D", X"7F", X"82", + X"84", X"86", X"88", X"8A", X"8B", X"8C", X"8D", X"8D", X"8D", X"8C", X"8B", X"8A", X"88", X"86", X"84", X"82", + X"7F", X"7D", X"7A", X"78", X"76", X"75", X"73", X"72", X"72", X"72", X"72", X"73", X"74", X"76", X"78", X"7A", + X"7D", X"7F", X"81", X"84", X"86", X"88", X"8A", X"8B", X"8D", X"8D", X"8E", X"8E", X"8D", X"8C", X"8B", X"89", + X"88", X"86", X"84", X"82", X"7F", X"7D", X"7A", X"78", X"77", X"75", X"74", X"73", X"73", X"73", X"73", X"74", + X"75", X"77", X"79", X"7B", X"7D", X"80", X"82", X"84", X"86", X"88", X"89", X"8A", X"8B", X"8C", X"8C", X"8C", + X"8B", X"8A", X"88", X"87", X"85", X"83", X"81", X"7F", X"7D", X"7A", X"78", X"76", X"75", X"73", X"72", X"72", + X"72", X"72", X"73", X"74", X"76", X"78", X"7A", X"7C", X"7E", X"81", X"83", X"85", X"87", X"89", X"8A", X"8B", + X"8C", X"8C", X"8C", X"8B", X"8B", X"89", X"88", X"86", X"84", X"82", X"80", X"7E", X"7C", X"7A", X"78", X"76", + X"75", X"74", X"73", X"73", X"73", X"74", X"75", X"76", X"78", X"7A", X"7C", X"7E", X"80", X"83", X"85", X"87", + X"88", X"8A", X"8B", X"8C", X"8C", X"8C", X"8C", X"8B", X"8A", X"88", X"86", X"85", X"83", X"81", X"7E", X"7C", + X"7A", X"78", X"77", X"75", X"74", X"73", X"73", X"73", X"73", X"74", X"75", X"77", X"79", X"7B", X"7D", X"7F", + X"81", X"83", X"85", X"87", X"88", X"89", X"8A", X"8B", X"8B", X"8A", X"8A", X"89", X"88", X"86", X"85", X"83", + X"81", X"80", X"7D", X"7C", X"7A", X"78", X"77", X"75", X"74", X"74", X"74", X"74", X"75", X"76", X"77", X"79", + X"7B", X"7D", X"7F", X"81", X"83", X"85", X"87", X"88", X"8A", X"8B", X"8B", X"8B", X"8B", X"8B", X"8A", X"89", + X"88", X"87", X"85", X"83", X"81", X"80", X"7E", X"7C", X"7A", X"78", X"77", X"76", X"75", X"75", X"75", X"75", + X"76", X"77", X"78", X"7A", X"7C", X"7E", X"80", X"82", X"84", X"85", X"87", X"88", X"89", X"8A", X"8B", X"8B", + X"8B", X"8A", X"89", X"88", X"86", X"85", X"83", X"81", X"7F", X"7D", X"7B", X"7A", X"78", X"77", X"75", X"74", + X"74", X"74", X"74", X"75", X"76", X"77", X"78", X"7A", X"7C", X"7E", X"80", X"82", X"84", X"85", X"86", X"88", + X"89", X"89", X"8A", X"8A", X"89", X"89", X"88", X"86", X"85", X"84", X"82", X"80", X"7E", X"7D", X"7B", X"79", + X"78", X"77", X"76", X"75", X"75", X"75", X"76", X"77", X"78", X"79", X"7B", X"7C", X"7E", X"80", X"82", X"83", + X"85", X"87", X"88", X"89", X"89", X"8A", X"8A", X"8A", X"89", X"89", X"87", X"86", X"85", X"83", X"81", X"7F", + X"7E", X"7C", X"7B", X"79", X"78", X"76", X"76", X"75", X"76", X"76", X"76", X"77", X"78", X"7A", X"7B", X"7D", + X"7E", X"80", X"82", X"83", X"85", X"86", X"87", X"88", X"88", X"89", X"88", X"88", X"87", X"86", X"85", X"84", + X"83", X"81", X"7F", X"7E", X"7C", X"7B", X"7A", X"78", X"77", X"77", X"77", X"76", X"76", X"77", X"77", X"79", + X"7A", X"7B", X"7D", X"7E", X"80", X"82", X"83", X"85", X"86", X"87", X"88", X"88", X"89", X"89", X"88", X"88", + X"87", X"86", X"85", X"84", X"82", X"81", X"80", X"7E", X"7D", X"7B", X"7A", X"79", X"79", X"78", X"78", X"78", + X"78", X"79", X"7A", X"7B", X"7C", X"7D", X"7F", X"80", X"81", X"83", X"84", X"85", X"86", X"87", X"87", X"88", + X"88", X"87", X"87", X"86", X"85", X"84", X"83", X"82", X"81", X"7F", X"7E", X"7D", X"7B", X"7A", X"79", X"79", + X"78", X"78", X"78", X"78", X"79", X"79", X"7A", X"7B", X"7C", X"7D", X"7E", X"7F", X"81", X"82", X"83", X"84", + X"85", X"86", X"86", X"86", X"86", X"86", X"85", X"85", X"84", X"83", X"82", X"81", X"80", X"7E", X"7D", X"7C", + X"7B", X"7A", X"7A", X"79", X"79", X"79", X"79", X"79", X"7A", X"7A", X"7B", X"7C", X"7E", X"7F", X"80", X"81", + X"82", X"83", X"84", X"85", X"86", X"86", X"87", X"87", X"86", X"86", X"85", X"85", X"84", X"83", X"82", X"81", + X"80", X"7F", X"7D", X"7C", X"7B", X"7A", X"7A", X"7A", X"79", X"79", X"7A", X"7A", X"7B", X"7B", X"7C", X"7D", + X"7E", X"7F", X"80", X"81", X"82", X"83", X"84", X"84", X"85", X"85", X"85", X"85", X"85", X"84", X"84", X"83", + X"82", X"81", X"80", X"7F", X"7E", X"7D", X"7C", X"7B", X"7B", X"7A", X"7A", X"7A", X"7A", X"7A", X"7A", X"7B", + X"7B", X"7C", X"7D", X"7E", X"7F", X"80", X"81", X"82", X"82", X"83", X"84", X"84", X"85", X"85", X"85", X"85", + X"85", X"84", X"84", X"83", X"82", X"81", X"80", X"7F", X"7F", X"7E", X"7D", X"7C", X"7C", X"7B", X"7B", X"7B", + X"7B", X"7B", X"7C", X"7C", X"7D", X"7E", X"7F", X"80", X"80", X"81", X"82", X"83", X"83", X"84", X"84", X"85", + X"85", X"85", X"85", X"85", X"84", X"83", X"83", X"82", X"81", X"80", X"80", X"7F", X"7E", X"7D", X"7C", X"7C", + X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7E", X"7F", X"7F", X"80", X"81", X"82", + X"82", X"83", X"83", X"83", X"84", X"83", X"83", X"83", X"83", X"82", X"81", X"81", X"80", X"7F", X"7E", X"7E", + X"7D", X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7D", X"7E", X"7F", X"80", + X"81", X"81", X"82", X"82", X"83", X"83", X"84", X"84", X"84", X"84", X"83", X"83", X"83", X"82", X"81", X"81", + X"80", X"80", X"7F", X"7E", X"7E", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7E", + X"7E", X"7F", X"80", X"80", X"81", X"81", X"82", X"82", X"83", X"83", X"83", X"83", X"83", X"83", X"82", X"82", + X"82", X"81", X"80", X"7F", X"7F", X"7E", X"7E", X"7D", X"7D", X"7C", X"7C", X"7C", X"7B", X"7C", X"7C", X"7C", + X"7C", X"7D", X"7D", X"7E", X"7E", X"7F", X"7F", X"80", X"81", X"81", X"82", X"82", X"82", X"82", X"83", X"82", + X"82", X"82", X"82", X"82", X"81", X"81", X"80", X"80", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", + X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"80", X"80", X"81", X"82", X"82", X"82", X"83", X"83", + X"83", X"83", X"83", X"83", X"83", X"82", X"82", X"82", X"81", X"81", X"80", X"7F", X"7F", X"7F", X"7E", X"7E", + X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"80", X"80", X"81", + X"81", X"81", X"81", X"82", X"81", X"80", X"80", X"80", X"80", X"80", X"7F", X"80", X"7F", X"7F", X"7F", X"7F", + X"52", X"49", X"46", X"46", X"9A", X"01", X"00", X"00", X"57", X"41", X"56", X"45", X"66", X"6D", X"74", X"20", + X"10", X"00", X"00", X"00", X"01", X"00", X"01", X"00", X"11", X"2B", X"00", X"00", X"11", X"2B", X"00", X"00", + X"01", X"00", X"08", X"00", X"64", X"61", X"74", X"61", X"75", X"01", X"00", X"00", X"7F", X"80", X"82", X"69", + X"00", X"4B", X"F9", X"F6", X"F7", X"F3", X"E8", X"AB", X"59", X"12", X"07", X"06", X"25", X"78", X"C7", X"F6", + X"F3", X"E0", X"A7", X"66", X"2D", X"12", X"17", X"42", X"7D", X"B8", X"DE", X"E4", X"CB", X"98", X"5F", X"31", + X"1E", X"28", X"52", X"87", X"B9", X"D5", X"D6", X"BB", X"8C", X"5A", X"36", X"28", X"38", X"5F", X"8F", X"B8", + X"CD", X"C9", X"AE", X"83", X"57", X"3A", X"32", X"44", X"6A", X"94", X"B6", X"C5", X"BE", X"A3", X"7B", X"56", + X"3F", X"3B", X"4F", X"72", X"98", X"B4", X"BE", X"B4", X"99", X"75", X"56", X"43", X"44", X"59", X"79", X"9B", + X"B2", X"B7", X"AC", X"92", X"71", X"56", X"48", X"4B", X"61", X"80", X"9D", X"B0", X"B2", X"A5", X"8C", X"6E", + X"58", X"4C", X"52", X"68", X"84", X"9E", X"AD", X"AC", X"9F", X"87", X"6C", X"59", X"51", X"59", X"6E", X"88", + X"9F", X"AA", X"A8", X"9A", X"83", X"6B", X"5A", X"54", X"5F", X"73", X"8B", X"9F", X"A8", X"A3", X"95", X"80", + X"6A", X"5C", X"58", X"63", X"77", X"8E", X"9E", X"A5", X"A0", X"91", X"7D", X"69", X"5D", X"5B", X"68", X"7B", + X"8F", X"9E", X"A2", X"9B", X"8D", X"7A", X"69", X"5E", X"5E", X"6B", X"7E", X"91", X"9D", X"A0", X"98", X"8A", + X"78", X"68", X"5F", X"61", X"6E", X"80", X"91", X"9C", X"9D", X"94", X"87", X"76", X"68", X"60", X"64", X"71", + X"82", X"92", X"9B", X"9B", X"92", X"85", X"75", X"68", X"62", X"68", X"75", X"85", X"92", X"9A", X"98", X"8F", + X"82", X"75", X"69", X"64", X"6B", X"77", X"86", X"93", X"99", X"96", X"8D", X"80", X"74", X"69", X"67", X"6E", + X"7A", X"88", X"93", X"97", X"94", X"8A", X"7E", X"72", X"6A", X"6A", X"72", X"7D", X"89", X"92", X"94", X"90", + X"87", X"7C", X"72", X"6D", X"6E", X"75", X"7F", X"8A", X"90", X"91", X"8D", X"84", X"7A", X"72", X"6F", X"71", + X"78", X"81", X"89", X"8E", X"8E", X"89", X"82", X"79", X"73", X"71", X"74", X"7A", X"82", X"88", X"8C", X"8B", + X"86", X"80", X"79", X"74", X"74", X"77", X"7C", X"83", X"88", X"8A", X"88", X"84", X"7E", X"79", X"76", X"76", + X"79", X"7E", X"84", X"87", X"89", X"87", X"82", X"7D", X"79", X"77", X"78", X"7B", X"7F", X"84", X"86", X"87", + X"85", X"81", X"7D", X"7A", X"79", X"7A", X"7D", X"80", X"84", X"86", X"86", X"84", X"81", X"7D", X"7B", X"7A", + X"7B", X"7E", X"81", X"84", X"85", X"85", X"83", X"80", X"7D", X"7B", X"7B", X"7C", X"7F", X"81", X"83", X"84", + X"83", X"82", X"7F", X"7D", X"7B", X"7B", X"7D", X"7F", X"81", X"83", X"83", X"82", X"81", X"7E", X"7D", X"7C", + X"7C", X"7D", X"7F", X"81", X"82", X"82", X"81", X"80", X"7E", X"7D", X"7C", X"7D", X"7E", X"7F", X"81", X"82", + X"82", X"81", X"7F", X"7E", X"7D", X"7C", X"7D", X"7E", X"80", X"81", X"82", X"81", X"81", X"7F", X"7E", X"7D", + X"7E", X"00", X"52", X"49", X"46", X"46", X"A4", X"13", X"00", X"00", X"57", X"41", X"56", X"45", X"66", X"6D", + X"74", X"20", X"10", X"00", X"00", X"00", X"01", X"00", X"01", X"00", X"11", X"2B", X"00", X"00", X"11", X"2B", + X"00", X"00", X"01", X"00", X"08", X"00", X"64", X"61", X"74", X"61", X"7F", X"13", X"00", X"00", X"80", X"80", + X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"80", X"82", X"84", X"88", X"8F", X"98", X"A3", + X"B0", X"BB", X"C1", X"C3", X"BE", X"B4", X"A5", X"94", X"80", X"6C", X"57", X"43", X"31", X"22", X"1E", X"23", + X"2E", X"3F", X"53", X"6A", X"80", X"98", X"AD", X"C0", X"CB", X"CA", X"C4", X"B8", X"A8", X"95", X"81", X"6F", + X"67", X"67", X"6C", X"76", X"83", X"92", X"A1", X"AE", X"B1", X"AD", X"A3", X"95", X"85", X"73", X"61", X"51", + X"4A", X"4C", X"54", X"61", X"70", X"82", X"95", X"A6", X"B4", X"B7", X"B2", X"A9", X"9A", X"89", X"77", X"64", + X"52", X"46", X"43", X"49", X"54", X"63", X"74", X"87", X"99", X"A8", X"AC", X"A9", X"A1", X"94", X"84", X"73", + X"61", X"51", X"49", X"4B", X"53", X"60", X"70", X"82", X"94", X"A6", X"B7", X"C1", X"C1", X"B9", X"AD", X"9C", + X"89", X"76", X"62", X"4F", X"3C", X"2B", X"1C", X"13", X"15", X"20", X"31", X"45", X"5C", X"75", X"8D", X"A5", + X"BB", X"D0", X"E2", X"F2", X"FC", X"FD", X"FC", X"F0", X"DD", X"C6", X"AC", X"91", X"77", X"5D", X"46", X"30", + X"1D", X"0C", X"02", X"03", X"02", X"0C", X"21", X"39", X"53", X"6E", X"88", X"A1", X"B8", X"CD", X"E0", X"EF", + X"FB", X"FB", X"F3", X"E3", X"D0", X"B8", X"9F", X"85", X"6B", X"54", X"3D", X"28", X"17", X"0E", X"11", X"1C", + X"2D", X"41", X"58", X"71", X"89", X"A0", X"B6", X"C8", X"D2", X"D1", X"C9", X"BC", X"AA", X"96", X"81", X"72", + X"6C", X"6D", X"73", X"7D", X"89", X"98", X"A7", X"B4", X"BC", X"B9", X"B1", X"A4", X"93", X"7F", X"6C", X"58", + X"45", X"3A", X"3A", X"41", X"4D", X"5D", X"6F", X"81", X"92", X"99", X"98", X"93", X"88", X"7B", X"6C", X"5B", + X"4C", X"46", X"49", X"52", X"5F", X"6F", X"82", X"94", X"A6", X"B1", X"B1", X"AB", X"A0", X"91", X"80", X"6E", + X"5B", X"4C", X"46", X"49", X"52", X"60", X"71", X"83", X"95", X"A5", X"AB", X"A8", X"A1", X"94", X"85", X"74", + X"62", X"52", X"41", X"31", X"22", X"19", X"1A", X"24", X"35", X"49", X"60", X"79", X"91", X"A9", X"BF", X"D2", + X"DF", X"E1", X"DA", X"CD", X"BC", X"A6", X"90", X"7A", X"64", X"4F", X"3C", X"2C", X"24", X"28", X"32", X"42", + X"56", X"6D", X"84", X"9B", X"B2", X"C6", X"D9", X"E9", X"F8", X"FE", X"FD", X"FE", X"F7", X"E4", X"CC", X"B2", + X"97", X"7C", X"62", X"4B", X"34", X"21", X"0F", X"04", X"03", X"0B", X"1B", X"2F", X"47", X"61", X"7A", X"93", + X"AC", X"C2", X"D6", X"E6", X"F4", X"F8", X"F0", X"E2", X"CF", X"B8", X"9F", X"86", X"6D", X"56", X"49", X"46", + X"4A", X"55", X"63", X"73", X"84", X"95", X"A0", X"A0", X"9C", X"92", X"83", X"73", X"62", X"50", X"3E", X"2E", + X"20", X"14", X"12", X"1A", X"28", X"3B", X"52", X"69", X"81", X"99", X"AF", X"C3", X"D2", X"D5", X"D0", X"C5", + X"B6", X"A1", X"8C", X"76", X"60", X"4C", X"39", X"29", X"23", X"27", X"32", X"43", X"57", X"6D", X"85", X"9B", + X"B2", X"C6", X"D9", X"E8", X"F5", X"FA", X"F3", X"E6", X"D2", X"BD", X"A4", X"8B", X"71", X"5C", X"51", X"4F", + X"54", X"5E", X"6C", X"7A", X"89", X"8F", X"8E", X"88", X"7D", X"70", X"61", X"52", X"4A", X"4B", X"52", X"5E", + X"6E", X"7F", X"92", X"A4", X"B4", X"C0", X"C1", X"BA", X"AF", X"9E", X"8B", X"76", X"62", X"4F", X"45", X"44", + X"4B", X"56", X"65", X"76", X"89", X"9C", X"AC", X"B6", X"B5", X"AE", X"A2", X"92", X"7F", X"6B", X"58", X"46", + X"34", X"24", X"15", X"09", X"04", X"0A", X"18", X"2B", X"43", X"5D", X"77", X"90", X"A8", X"BF", X"D4", X"E6", + X"F6", X"FC", X"FC", X"FC", X"F2", X"DD", X"C6", X"AC", X"92", X"78", X"5E", X"47", X"31", X"1E", X"12", X"11", + X"19", X"27", X"3A", X"51", X"69", X"81", X"99", X"AF", X"C5", X"D6", X"E5", X"EF", X"EC", X"E0", X"D0", X"BC", + X"A4", X"8D", X"74", X"5D", X"47", X"32", X"1F", X"0F", X"06", X"08", X"14", X"24", X"3A", X"52", X"6C", X"85", + X"9E", X"B5", X"CA", X"DC", X"ED", X"FA", X"FD", X"FC", X"FD", X"F8", X"E5", X"CD", X"B2", X"96", X"7B", X"60", + X"48", X"31", X"1C", X"0A", X"02", X"03", X"02", X"08", X"1B", X"32", X"4C", X"66", X"80", X"9A", X"B1", X"C7", + X"DA", X"EA", X"F6", X"F6", X"ED", X"DE", X"CA", X"B2", X"98", X"7F", X"65", X"4E", X"38", X"24", X"12", X"05", + X"03", X"03", X"08", X"1B", X"31", X"4A", X"64", X"7F", X"97", X"AF", X"C4", X"D6", X"E2", X"E1", X"D9", X"CB", + X"B9", X"A3", X"8D", X"76", X"5F", X"4A", X"35", X"26", X"22", X"27", X"33", X"45", X"59", X"6F", X"86", X"9D", + X"B2", X"C7", X"D9", X"E8", X"F3", X"F6", X"ED", X"DE", X"CA", X"B3", X"99", X"81", X"68", X"50", X"3A", X"26", + X"14", X"05", X"02", X"03", X"0B", X"1E", X"34", X"4D", X"67", X"81", X"9A", X"B3", X"CA", X"DD", X"EF", X"FC", + X"FE", X"FD", X"FE", X"F6", X"E2", X"C9", X"AE", X"93", X"78", X"5F", X"4D", X"46", X"47", X"4E", X"5A", X"69", + X"7B", X"8B", X"98", X"9B", X"97", X"8F", X"82", X"73", X"63", X"52", X"42", X"39", X"39", X"41", X"4E", X"5E", + X"70", X"82", X"93", X"9C", X"9B", X"96", X"8B", X"7E", X"6E", X"5E", X"4D", X"3D", X"2E", X"20", X"17", X"1A", + X"24", X"34", X"49", X"60", X"78", X"90", X"A8", X"BE", X"D2", X"E4", X"F4", X"FD", X"FD", X"FD", X"F8", X"E6", + X"CF", X"B5", X"9A", X"7F", X"65", X"4D", X"36", X"22", X"14", X"11", X"17", X"25", X"37", X"4C", X"64", X"7C", + X"93", X"A8", X"B8", X"BC", X"B8", X"B0", X"A2", X"91", X"7F", X"6C", X"5C", X"56", X"58", X"60", X"6C", X"7B", + X"8C", X"9D", X"AE", X"BE", X"CB", X"CE", X"C7", X"BC", X"AC", X"98", X"83", X"6E", X"59", X"4E", X"4B", X"50", + X"5B", X"69", X"79", X"8C", X"9D", X"AD", X"B7", X"B5", X"AE", X"A2", X"92", X"80", X"6D", X"5A", X"48", X"40", + X"40", X"47", X"54", X"65", X"77", X"8A", X"9C", X"AC", X"B2", X"AF", X"A7", X"99", X"89", X"77", X"64", X"52", + X"40", X"2F", X"1F", X"12", X"07", X"05", X"0D", X"1D", X"31", X"49", X"63", X"7E", X"98", X"B0", X"C7", X"DB", + X"ED", X"FA", X"FD", X"FC", X"FC", X"F3", X"DE", X"C7", X"AC", X"92", X"77", X"5E", X"47", X"32", X"1F", X"10", + X"0D", X"14", X"21", X"34", X"4A", X"62", X"7B", X"94", X"AC", X"C1", X"D5", X"E5", X"F2", X"F8", X"F2", X"E5", + X"D1", X"BB", X"A1", X"88", X"6F", X"57", X"41", X"2C", X"1A", X"09", X"02", X"02", X"06", X"18", X"2D", X"46", + X"61", X"7C", X"96", X"AE", X"C4", X"D8", X"E9", X"F8", X"FE", X"FC", X"FD", X"F2", X"DE", X"C6", X"AB", X"8F", + X"75", X"5B", X"43", X"2D", X"1A", X"09", X"02", X"02", X"05", X"14", X"29", X"41", X"5B", X"75", X"8F", X"A7", + X"BE", X"D3", X"E4", X"F4", X"FD", X"FC", X"FB", X"EF", X"DB", X"C3", X"A9", X"8E", X"74", X"5A", X"42", X"2B", + X"18", X"08", X"02", X"03", X"0E", X"20", X"36", X"4E", X"68", X"82", X"9B", X"B3", X"C8", X"DB", X"E9", X"F6", + X"F9", X"F1", X"E2", X"CE", X"B8", X"9D", X"84", X"6B", X"53", X"3C", X"27", X"15", X"06", X"01", X"04", X"10", + X"23", X"39", X"52", X"6C", X"86", X"A0", X"B7", X"CD", X"E0", X"EF", X"FB", X"FD", X"F4", X"E4", X"D0", X"B8", + X"9E", X"83", X"69", X"51", X"3A", X"26", X"13", X"05", X"02", X"02", X"0A", X"1D", X"33", X"4C", X"65", X"80", + X"9A", X"B2", X"C8", X"DC", X"ED", X"FA", X"FE", X"FC", X"FC", X"F4", X"DF", X"C7", X"AD", X"91", X"77", X"5D", + X"45", X"37", X"34", X"38", X"43", X"52", X"64", X"77", X"8A", X"99", X"9F", X"9D", X"95", X"89", X"7A", X"69", + X"57", X"45", X"35", X"25", X"17", X"0A", X"04", X"08", X"15", X"28", X"3E", X"57", X"71", X"8B", X"A4", X"BB", + X"D1", X"E3", X"F3", X"FD", X"FD", X"FD", X"FD", X"F0", X"DA", X"C1", X"A5", X"8A", X"6E", X"55", X"3D", X"28", + X"15", X"08", X"06", X"0F", X"1E", X"32", X"49", X"61", X"7B", X"94", X"AB", X"C1", X"D5", X"E4", X"F1", X"F6", + X"EF", X"E1", X"CE", X"B7", X"9E", X"85", X"6B", X"53", X"3C", X"28", X"16", X"0A", X"0A", X"13", X"22", X"35", + X"4C", X"64", X"7D", X"96", X"AE", X"C3", X"D7", X"E6", X"F2", X"F6", X"EF", X"E0", X"CC", X"B6", X"9C", X"83", + X"6A", X"52", X"40", X"38", X"39", X"42", X"4F", X"60", X"72", X"83", X"91", X"95", X"93", X"8B", X"7E", X"70", + X"60", X"50", X"46", X"45", X"4C", X"58", X"67", X"79", X"8D", X"A0", X"B1", X"C0", X"C6", X"C2", X"B8", X"AA", + X"98", X"84", X"70", X"5C", X"4B", X"43", X"45", X"4C", X"59", X"69", X"7B", X"8E", X"9F", X"AD", X"B0", X"AB", + X"A2", X"93", X"83", X"71", X"5E", X"4C", X"42", X"42", X"48", X"55", X"66", X"77", X"8B", X"9D", X"AD", X"B3", + X"B1", X"A9", X"9C", X"8B", X"7A", X"67", X"56", X"4E", X"4F", X"57", X"63", X"72", X"84", X"96", X"A8", X"BA", + X"CA", X"DA", X"E8", X"F5", X"FD", X"FE", X"FE", X"FE", X"FD", X"FD", X"FC", X"FC", X"F8", X"E3", X"C8", X"AA", + X"8B", X"6D", X"51", X"36", X"1E", X"09", X"03", X"04", X"03", X"03", X"0F", X"25", X"3C", X"56", X"6F", X"88", + X"9F", X"B4", X"C6", X"D6", X"E4", X"F0", X"F9", X"FE", X"FD", X"FE", X"FE", X"FD", X"EE", X"D5", X"BB", X"9C", + X"7D", X"60", X"43", X"28", X"10", X"02", X"03", X"02", X"02", X"01", X"01", X"01", X"01", X"01", X"03", X"01", + X"09", X"28", X"48", X"68", X"86", X"A3", X"BD", X"D3", X"E6", X"F7", X"FE", X"FD", X"FE", X"FD", X"FE", X"FD", + X"FD", X"FC", X"FD", X"FA", X"E4", X"C6", X"A6", X"86", X"68", X"4A", X"30", X"17", X"05", X"02", X"03", X"02", + X"02", X"01", X"01", X"00", X"01", X"00", X"06", X"22", X"42", X"62", X"82", X"9F", X"BA", X"D1", X"E6", X"F8", + X"FE", X"FE", X"FE", X"FE", X"FE", X"FE", X"FE", X"FD", X"FE", X"F8", X"E0", X"C0", X"A0", X"81", X"63", X"47", + X"2E", X"16", X"05", X"02", X"02", X"01", X"02", X"01", X"02", X"01", X"03", X"02", X"08", X"23", X"44", X"63", + X"83", X"A0", X"BC", X"D4", X"EB", X"FB", X"FE", X"FE", X"FE", X"FE", X"FE", X"FD", X"FE", X"FD", X"FD", X"F9", + X"E0", X"BF", X"A0", X"81", X"65", X"4A", X"31", X"1B", X"08", X"02", X"03", X"03", X"03", X"02", X"02", X"03", + X"02", X"10", X"2E", X"4C", X"6B", X"89", X"A6", X"C1", X"D9", X"EF", X"FD", X"FD", X"FD", X"FD", X"FE", X"FD", + X"FD", X"FD", X"FD", X"FC", X"FD", X"ED", X"CE", X"AE", X"8F", X"70", X"54", X"3B", X"24", X"0F", X"03", X"03", + X"03", X"03", X"03", X"03", X"03", X"03", X"02", X"0F", X"2D", X"4B", X"6B", X"8A", X"A8", X"C3", X"DB", X"F1", + X"FD", X"FC", X"FD", X"FD", X"FD", X"FC", X"FC", X"FB", X"E7", X"CA", X"AD", X"90", X"73", X"58", X"41", X"2B", + X"17", X"07", X"02", X"02", X"03", X"02", X"03", X"02", X"08", X"22", X"3E", X"5D", X"7C", X"99", X"B5", X"CF", + X"E6", X"F9", X"FD", X"FC", X"FC", X"FB", X"FC", X"FB", X"FC", X"FC", X"FD", X"FC", X"FD", X"EE", X"CE", X"AE", + X"8F", X"71", X"55", X"3B", X"24", X"10", X"03", X"02", X"02", X"02", X"03", X"03", X"04", X"02", X"07", X"21", + X"40", X"5F", X"7F", X"9C", X"B9", X"D2", X"EA", X"FB", X"FF", X"FE", X"FF", X"FE", X"FE", X"FD", X"FD", X"FD", + X"FD", X"FC", X"FD", X"F8", X"DC", X"BB", X"9C", X"7D", X"5F", X"44", X"2D", X"17", X"06", X"03", X"02", X"02", + X"02", X"02", X"02", X"02", X"01", X"05", X"1E", X"3E", X"5E", X"7E", X"9C", X"B8", X"D1", X"E8", X"F9", X"FD", + X"FC", X"FC", X"FC", X"FC", X"FD", X"F5", X"DB", X"BF", X"A2", X"86", X"6B", X"52", X"3C", X"27", X"15", X"06", + X"01", X"01", X"01", X"01", X"02", X"02", X"05", X"1B", X"39", X"57", X"76", X"94", X"B1", X"CC", X"E4", X"F9", + X"FE", X"FD", X"FF", X"FE", X"FF", X"FE", X"FE", X"FE", X"FE", X"FD", X"FD", X"FC", X"FC", X"EB", X"C8", X"A8", + X"88", X"6A", X"4E", X"36", X"20", X"0C", X"02", X"02", X"01", X"02", X"01", X"02", X"01", X"0F", X"2C", X"49", + X"68", X"86", X"A2", X"BC", X"D4", X"EA", X"FA", X"FD", X"FD", X"FE", X"FD", X"FF", X"F9", X"E2", X"C6", X"AA", + X"8E", X"72", X"58", X"40", X"2A", X"18", X"07", X"01", X"01", X"01", X"02", X"02", X"08", X"1E", X"3A", X"57", + X"76", X"93", X"B0", X"C9", X"E0", X"F5", X"FE", X"FD", X"FD", X"FD", X"FD", X"FC", X"FD", X"F8", X"E0", X"C3", + X"A5", X"88", X"6E", X"54", X"3D", X"28", X"16", X"07", X"02", X"03", X"03", X"03", X"02", X"02", X"02", X"07", + X"20", X"3F", X"5E", X"7D", X"9B", X"B9", X"D3", X"EB", X"FB", X"FD", X"FC", X"FD", X"FC", X"FD", X"FC", X"FC", + X"FC", X"FC", X"FC", X"FD", X"F5", X"D6", X"B5", X"95", X"76", X"5A", X"40", X"2A", X"16", X"06", X"01", X"03", + X"02", X"03", X"02", X"03", X"02", X"06", X"20", X"3F", X"5E", X"7E", X"9B", X"B7", X"D0", X"E7", X"F9", X"FC", + X"FC", X"FB", X"FB", X"FC", X"FD", X"F6", X"DE", X"C1", X"A4", X"89", X"6E", X"55", X"3E", X"29", X"18", X"08", + X"02", X"02", X"02", X"02", X"02", X"02", X"03", X"14", X"31", X"4F", X"6E", X"8D", X"AA", X"C6", X"DF", X"F5", + X"FE", X"FD", X"FD", X"FC", X"FD", X"FD", X"FD", X"FC", X"FD", X"FC", X"FE", X"FD", X"FD", X"EE", X"CC", X"AC", + X"8C", X"6D", X"51", X"38", X"22", X"0E", X"02", X"02", X"02", X"02", X"02", X"02", X"01", X"02", X"01", X"11", + X"31", X"50", X"6F", X"8D", X"AB", X"C6", X"DE", X"F3", X"FD", X"FB", X"FC", X"FD", X"FD", X"FD", X"FC", X"FC", + X"FC", X"FB", X"FD", X"EE", X"CD", X"AD", X"8E", X"70", X"54", X"3A", X"23", X"0F", X"03", X"02", X"02", X"03", + X"02", X"03", X"02", X"03", X"02", X"0F", X"2E", X"4D", X"6C", X"8B", X"A9", X"C4", X"DC", X"F2", X"FE", X"FE", + X"FE", X"FE", X"FE", X"FE", X"FF", X"F5", X"D9", X"BB", X"9E", X"82", X"67", X"4F", X"37", X"24", X"12", X"04", + X"01", X"02", X"02", X"03", X"02", X"09", X"21", X"3D", X"5B", X"79", X"97", X"B3", X"CC", X"E2", X"F6", X"FE", + X"FD", X"FF", X"FE", X"FF", X"FE", X"FE", X"FE", X"FE", X"FD", X"FE", X"ED", X"CC", X"AD", X"8E", X"6F", X"53", + X"3A", X"23", X"0F", X"02", X"02", X"01", X"02", X"02", X"03", X"02", X"03", X"02", X"0D", X"2B", X"49", X"69", + X"88", X"A6", X"C1", X"D9", X"F0", X"FD", X"FE", X"FD", X"FC", X"FD", X"FD", X"FE", X"FD", X"FD", X"FC", X"FC", + X"FA", X"E3", X"C1", X"A2", X"83", X"65", X"4A", X"31", X"1B", X"08", X"01", X"01", X"01", X"03", X"02", X"03", + X"02", X"04", X"03", X"09", X"23", X"41", X"61", X"81", X"9F", X"BB", X"D4", X"EB", X"FB", X"FD", X"FD", X"FD", + X"FD", X"FC", X"FC", X"FA", X"E5", X"C8", X"AB", X"8E", X"73", X"59", X"43", X"2D", X"1B", X"0B", X"03", X"03", + X"02", X"03", X"04", X"15", X"2F", X"4A", X"67", X"84", X"A1", X"BB", X"D3", X"E9", X"FA", X"FE", X"FE", X"FD", + X"FE", X"FD", X"FC", X"FC", X"EC", X"CE", X"B2", X"95", X"7A", X"5F", X"48", X"32", X"20", X"0E", X"03", X"02", + X"02", X"02", X"01", X"02", X"03", X"16", X"33", X"50", X"6F", X"8D", X"A9", X"C3", X"DC", X"F2", X"FD", X"FC", + X"FE", X"FE", X"FF", X"FE", X"FE", X"FD", X"FD", X"FC", X"FC", X"EE", X"CE", X"AF", X"90", X"73", X"58", X"3F", + X"29", X"15", X"05", X"02", X"02", X"01", X"01", X"00", X"01", X"02", X"02", X"14", X"33", X"51", X"71", X"8F", + X"AC", X"C6", X"DE", X"F4", X"FE", X"FD", X"FE", X"FE", X"FE", X"FE", X"FE", X"FA", X"E3", X"C5", X"A8", X"8B", + X"6F", X"55", X"3E", X"29", X"17", X"07", X"01", X"03", X"02", X"02", X"01", X"0A", X"23", X"3E", X"5C", X"79", + X"96", X"B1", X"CB", X"E2", X"F6", X"FD", X"FC", X"FC", X"FD", X"FD", X"FD", X"FA", X"E6", X"CA", X"AE", X"92", + X"77", X"5C", X"44", X"2F", X"1D", X"0D", X"03", X"02", X"02", X"02", X"02", X"05", X"19", X"34", X"50", X"6E", + X"8C", X"A8", X"C2", X"D9", X"EF", X"FC", X"FC", X"FC", X"FC", X"FC", X"FC", X"FD", X"FD", X"FD", X"FD", X"FE", + X"F5", X"D7", X"B7", X"98", X"79", X"5C", X"43", X"2C", X"18", X"06", X"02", X"03", X"02", X"02", X"02", X"01", + X"02", X"01", X"06", X"20", X"3E", X"5D", X"7C", X"9A", X"B6", X"CF", X"E5", X"F8", X"FE", X"FD", X"FE", X"FD", + X"FD", X"FD", X"FC", X"FC", X"FC", X"FC", X"F5", X"DB", X"BB", X"9D", X"7E", X"61", X"47", X"2F", X"1A", X"07", + X"01", X"02", X"01", X"02", X"01", X"00", X"00", X"00", X"01", X"14", X"34", X"53", X"73", X"91", X"AD", X"C6", + X"DD", X"F2", X"FD", X"FD", X"FD", X"FD", X"FE", X"FE", X"FE", X"FE", X"FD", X"FD", X"F9", X"E0", X"BF", X"A0", + X"81", X"63", X"48", X"31", X"1C", X"08", X"01", X"02", X"02", X"03", X"03", X"03", X"02", X"03", X"17", X"35", + X"53", X"72", X"8F", X"AB", X"C5", X"DB", X"EF", X"FC", X"FD", X"FC", X"FC", X"FB", X"FC", X"F2", X"D9", X"BF", + X"A3", X"87", X"6D", X"54", X"3D", X"28", X"16", X"07", X"00", X"02", X"02", X"02", X"02", X"0B", X"23", X"3E", + X"5B", X"77", X"94", X"AE", X"C7", X"DC", X"F0", X"FC", X"FD", X"FE", X"FE", X"FE", X"FE", X"FD", X"FD", X"FD", + X"FC", X"E8", X"C9", X"AB", X"8D", X"70", X"54", X"3B", X"25", X"11", X"02", X"01", X"01", X"01", X"02", X"02", + X"02", X"02", X"02", X"03", X"18", X"36", X"55", X"74", X"92", X"AE", X"C9", X"E0", X"F4", X"FE", X"FD", X"FE", + X"FD", X"FD", X"FD", X"FD", X"FE", X"FD", X"FE", X"F2", X"D4", X"B5", X"96", X"79", X"5D", X"44", X"2D", X"19", + X"07", X"01", X"02", X"02", X"03", X"02", X"03", X"01", X"0C", X"28", X"45", X"62", X"7F", X"9B", X"B5", X"CD", + X"E2", X"F5", X"FD", X"FC", X"FC", X"FC", X"FC", X"FC", X"F1", X"D7", X"BC", X"A0", X"85", X"6B", X"53", X"3D", + X"29", X"1B", X"18", X"1D", X"2A", X"3C", X"51", X"68", X"80", X"97", X"AE", X"C2", X"D5", X"E5", X"F1", X"F9", + X"F6", X"EB", X"D9", X"C5", X"AD", X"95", X"7D", X"65", X"4F", X"3A", X"27", X"16", X"08", X"02", X"05", X"0F", + X"20", X"36", X"4F", X"68", X"81", X"99", X"B1", X"C6", X"D9", X"EA", X"F8", X"FD", X"FC", X"FC", X"F7", X"E4", + X"CE", X"B4", X"9A", X"80", X"67", X"50", X"3A", X"26", X"15", X"06", X"01", X"02", X"02", X"02", X"01", X"02", + X"01", X"10", X"2B", X"47", X"65", X"82", X"9E", X"B8", X"D1", X"E5", X"F8", X"FE", X"FE", X"FE", X"FE", X"FE", + X"FD", X"FB", X"E7", X"CB", X"B0", X"93", X"78", X"5F", X"47", X"32", X"20", X"10", X"04", X"01", X"02", X"02", + X"02", X"02", X"0D", X"27", X"41", X"5E", X"7A", X"95", X"AE", X"C7", X"DC", X"F0", X"FC", X"FD", X"FD", X"FD", + X"FE", X"FD", X"FE", X"F6", X"DD", X"C2", X"A5", X"8A", X"70", X"58", X"42", X"2D", X"1B", X"0C", X"02", X"02", + X"02", X"02", X"0A", X"1F", X"37", X"52", X"6E", X"88", X"A2", X"BA", X"D0", X"E3", X"F4", X"FD", X"FD", X"FD", + X"FC", X"FD", X"F4", X"DC", X"C3", X"A8", X"8F", X"74", X"5D", X"46", X"32", X"20", X"14", X"11", X"18", X"25", + X"37", X"4D", X"64", X"7C", X"93", X"A9", X"BD", X"D0", X"DF", X"EC", X"ED", X"E5", X"D7", X"C6", X"B1", X"9A", + X"84", X"6D", X"57", X"43", X"31", X"21", X"1A", X"1D", X"28", X"37", X"4B", X"61", X"77", X"8E", X"A3", X"B8", + X"CB", X"DC", X"E9", X"F4", X"FB", X"F6", X"EA", X"D9", X"C4", X"AC", X"94", X"7B", X"64", X"4E", X"3B", X"29", + X"19", X"0C", X"04", X"04", X"04", X"04", X"03", X"08", X"1D", X"35", X"4F", X"6A", X"85", X"9F", X"B7", X"CE", + X"E0", X"F2", X"FC", X"FC", X"FD", X"FD", X"FD", X"F1", X"DA", X"C2", X"A8", X"8F", X"75", X"5E", X"48", X"34", + X"24", X"1B", X"1D", X"26", X"35", X"48", X"5D", X"73", X"89", X"9E", X"B3", X"C5", X"D7", X"E4", X"EF", X"F3", + X"EC", X"DD", X"CC", X"B7", X"A0", X"89", X"71", X"5C", X"47", X"34", X"23", X"15", X"09", X"02", X"02", X"02", + X"03", X"03", X"02", X"09", X"1E", X"37", X"52", X"6D", X"88", X"A2", X"B9", X"D0", X"E2", X"F4", X"FD", X"FD", + X"FE", X"FD", X"FD", X"FD", X"FD", X"FD", X"FD", X"F8", X"E3", X"C6", X"AA", X"8D", X"72", X"59", X"42", X"2D", + X"1C", X"0C", X"02", X"02", X"01", X"02", X"02", X"03", X"03", X"07", X"1B", X"35", X"50", X"6B", X"86", X"A0", + X"B7", X"CD", X"DF", X"EF", X"FA", X"FD", X"FD", X"FE", X"FD", X"FE", X"FD", X"FE", X"F9", X"E3", X"C9", X"AC", + X"91", X"77", X"5E", X"47", X"32", X"1F", X"0F", X"03", X"01", X"01", X"08", X"19", X"2D", X"45", X"5C", X"75", + X"8C", X"A2", X"B6", X"C8", X"D7", X"E2", X"E5", X"DF", X"D2", X"C2", X"AE", X"98", X"83", X"6D", X"59", X"46", + X"35", X"25", X"18", X"0D", X"09", X"0F", X"1B", X"2D", X"41", X"57", X"6E", X"84", X"9B", X"B0", X"C3", X"D4", + X"E3", X"EE", X"F8", X"FC", X"F6", X"EA", X"D7", X"C3", X"AC", X"94", X"7C", X"65", X"50", X"3D", X"2D", X"1E", + X"12", X"0D", X"11", X"1C", X"2C", X"40", X"55", X"6B", X"82", X"97", X"AA", X"BA", X"BF", X"BC", X"B5", X"AA", + X"9A", X"8A", X"79", X"68", X"57", X"48", X"3A", X"31", X"30", X"36", X"42", X"53", X"65", X"78", X"8C", X"A0", + X"B3", X"C4", X"D3", X"E1", X"EB", X"F3", X"F6", X"F0", X"E3", X"D1", X"BD", X"A6", X"90", X"79", X"63", X"4F", + X"3E", X"2D", X"20", X"14", X"0A", X"03", X"01", X"01", X"01", X"02", X"0C", X"1F", X"35", X"4E", X"67", X"80", + X"98", X"AE", X"C3", X"D5", X"E5", X"F2", X"FC", X"FD", X"FD", X"FD", X"FE", X"F8", X"E4", X"CF", X"B7", X"9E", + X"86", X"6F", X"5A", X"47", X"36", X"27", X"1E", X"1F", X"27", X"34", X"45", X"58", X"6D", X"81", X"95", X"A8", + X"BA", X"C9", X"D7", X"E2", X"EA", X"EC", X"E4", X"D7", X"C6", X"B3", X"9D", X"88", X"73", X"5F", X"4D", X"3C", + X"2E", X"22", X"1E", X"22", X"2C", X"3A", X"4C", X"5E", X"72", X"85", X"99", X"AB", X"BB", X"CA", X"D6", X"DF", + X"DF", X"D7", X"CA", X"BA", X"A7", X"93", X"7F", X"6C", X"59", X"48", X"38", X"2B", X"21", X"1F", X"25", X"31", + X"40", X"52", X"65", X"79", X"8C", X"9E", X"AF", X"BF", X"CD", X"D8", X"DF", X"DD", X"D4", X"C6", X"B5", X"A2", + X"8E", X"7A", X"67", X"55", X"45", X"36", X"29", X"1E", X"19", X"1D", X"27", X"35", X"47", X"5A", X"6E", X"81", + X"95", X"A6", X"B5", X"BE", X"BF", X"BA", X"B0", X"A3", X"94", X"85", X"74", X"65", X"56", X"48", X"3F", X"3D", + X"41", X"4A", X"57", X"67", X"77", X"88", X"99", X"A9", X"B7", X"C5", X"D1", X"DA", X"DF", X"DB", X"D1", X"C3", + X"B2", X"9F", X"8C", X"79", X"67", X"56", X"46", X"39", X"2D", X"23", X"1F", X"22", X"2C", X"39", X"4A", X"5C", + X"6F", X"82", X"94", X"A6", X"B6", X"C4", X"D0", X"DA", X"E1", X"E0", X"D8", X"CB", X"BB", X"A8", X"94", X"81", + X"6E", X"5D", X"4D", X"3F", X"32", X"29", X"28", X"2E", X"38", X"46", X"56", X"68", X"79", X"8A", X"9B", X"AB", + X"B9", X"C4", X"CD", X"CE", X"C8", X"BE", X"B0", X"A0", X"8F", X"7E", X"6D", X"5D", X"4E", X"41", X"35", X"2B", + X"29", X"2D", X"36", X"44", X"53", X"65", X"76", X"88", X"98", X"A8", X"B7", X"C4", X"CE", X"D6", X"D7", X"D0", + X"C4", X"B6", X"A6", X"94", X"82", X"71", X"61", X"51", X"44", X"38", X"2F", X"2E", X"34", X"3E", X"4B", X"5A", + X"6A", X"7B", X"8C", X"9B", X"AA", X"B7", X"C3", X"CC", X"D3", X"D2", X"CB", X"C0", X"B2", X"A1", X"90", X"7F", + X"6E", X"5E", X"50", X"43", X"37", X"2D", X"24", X"1E", X"18", X"14", X"13", X"18", X"23", X"32", X"43", X"56", + X"69", X"7C", X"8F", X"A1", X"B1", X"BF", X"CC", X"D6", X"DE", X"E6", X"EC", X"EF", X"F1", X"F1", X"EB", X"DE", + X"CD", X"BB", X"A7", X"93", X"7F", X"6C", X"5B", X"4C", X"3E", X"32", X"28", X"23", X"25", X"2C", X"38", X"46", + X"56", X"66", X"77", X"88", X"97", X"A5", X"B2", X"BC", X"C3", X"C1", X"BB", X"B1", X"A4", X"96", X"86", X"77", + X"68", X"5A", X"4D", X"42", X"38", X"30", X"29", X"23", X"1F", X"1C", X"1E", X"26", X"33", X"42", X"54", X"66", + X"78", X"89", X"9A", X"A9", X"B6", X"C3", X"CD", X"D5", X"DA", X"D9", X"D1", X"C6", X"B8", X"A9", X"98", X"88", + X"78", X"69", X"5B", X"4F", X"45", X"41", X"43", X"49", X"53", X"5F", X"6D", X"7A", X"88", X"96", X"A2", X"AE", + X"B8", X"C1", X"C7", X"CA", X"C5", X"BD", X"B1", X"A4", X"94", X"85", X"75", X"67", X"5A", X"4E", X"43", X"3A", + X"36", X"38", X"3F", X"49", X"56", X"63", X"72", X"80", X"8E", X"9B", X"A6", X"B2", X"BA", X"C2", X"C5", X"C1", + X"BA", X"AF", X"A2", X"94", X"85", X"77", X"69", X"5C", X"50", X"46", X"3D", X"36", X"34", X"38", X"3F", X"4A", + X"57", X"65", X"73", X"81", X"8F", X"9C", X"A8", X"B2", X"BB", X"C2", X"C6", X"C4", X"BC", X"B2", X"A6", X"98", + X"89", X"7B", X"6D", X"61", X"55", X"4B", X"42", X"3C", X"3D", X"42", X"4B", X"56", X"62", X"70", X"7D", X"8A", + X"96", X"A1", X"AC", X"B4", X"BA", X"BC", X"B8", X"B0", X"A6", X"9B", X"8D", X"80", X"73", X"67", X"5C", X"51", + X"48", X"41", X"3E", X"41", X"48", X"52", X"5D", X"6A", X"77", X"83", X"8F", X"9B", X"A5", X"AE", X"B5", X"BB", + X"BD", X"BA", X"B2", X"A8", X"9D", X"90", X"83", X"76", X"6A", X"5E", X"54", X"4B", X"43", X"3D", X"3C", X"41", + X"48", X"52", X"5E", X"6A", X"77", X"83", X"8F", X"99", X"A2", X"A5", X"A3", X"9E", X"97", X"8E", X"85", X"7B", + X"71", X"67", X"5E", X"56", X"4F", X"4D", X"4F", X"55", X"5D", X"67", X"72", X"7D", X"88", X"93", X"9D", X"A5", + X"AE", X"B4", X"BA", X"BB", X"B6", X"AF", X"A6", X"9B", X"8F", X"83", X"77", X"6C", X"61", X"58", X"4F", X"48", + X"45", X"46", X"4C", X"54", X"5E", X"69", X"74", X"80", X"8B", X"95", X"9F", X"A7", X"AF", X"B4", X"B9", X"B8", + X"B3", X"AB", X"A1", X"96", X"8A", X"7E", X"73", X"68", X"5E", X"56", X"4E", X"47", X"44", X"46", X"4B", X"53", + X"5C", X"67", X"72", X"7E", X"88", X"93", X"9C", X"A4", X"AB", X"B1", X"B4", X"B2", X"AD", X"A5", X"9C", X"91", + X"86", X"7B", X"70", X"66", X"5D", X"55", X"4E", X"48", X"45", X"46", X"4B", X"53", X"5D", X"67", X"72", X"7D", + X"88", X"92", X"9B", X"A3", X"AA", X"B0", X"B4", X"B7", X"B5", X"AF", X"A7", X"9E", X"93", X"87", X"7C", X"72", + X"68", X"5F", X"57", X"50", X"4A", X"45", X"43", X"45", X"4B", X"52", X"5C", X"66", X"71", X"7C", X"86", X"90", + X"99", X"A0", X"A7", X"AD", X"B1", X"B3", X"B0", X"AB", X"A3", X"9A", X"8F", X"85", X"7A", X"71", X"67", X"5F", + X"58", X"51", X"4E", X"4F", X"53", X"5A", X"62", X"6B", X"74", X"7E", X"87", X"8F", X"97", X"9E", X"A4", X"A9", + X"AC", X"AC", X"A8", X"A2", X"9A", X"91", X"87", X"7D", X"74", X"6B", X"63", X"5C", X"55", X"51", X"50", X"54", + X"59", X"60", X"69", X"71", X"7A", X"82", X"8A", X"8F", X"90", X"8E", X"8B", X"86", X"80", X"7A", X"73", X"6D", + X"67", X"61", X"5E", X"5F", X"62", X"67", X"6E", X"75", X"7C", X"84", X"8B", X"92", X"98", X"9E", X"A2", X"A6", + X"A7", X"A4", X"9E", X"98", X"90", X"87", X"7F", X"77", X"6F", X"68", X"61", X"5B", X"59", X"5A", X"5E", X"63", + X"6A", X"71", X"79", X"80", X"87", X"8E", X"92", X"92", X"90", X"8D", X"88", X"82", X"7C", X"76", X"70", X"6A", + X"64", X"5F", X"5C", X"5C", X"5F", X"64", X"6A", X"71", X"79", X"80", X"88", X"8F", X"95", X"9B", X"9F", X"A4", + X"A7", X"A9", X"A8", X"A4", X"9F", X"98", X"90", X"87", X"7F", X"77", X"6F", X"68", X"62", X"5C", X"58", X"54", + X"54", X"56", X"5B", X"62", X"69", X"71", X"79", X"81", X"88", X"8F", X"95", X"9A", X"9E", X"A1", X"A1", X"9E", + X"99", X"93", X"8C", X"85", X"7D", X"76", X"6F", X"69", X"63", X"5F", X"5C", X"5C", X"5F", X"64", X"6A", X"70", + X"77", X"7E", X"85", X"8B", X"91", X"96", X"9A", X"9D", X"A0", X"9F", X"9C", X"97", X"92", X"8B", X"84", X"7C", + X"75", X"6F", X"69", X"63", X"5F", X"5B", X"58", X"59", X"5B", X"60", X"66", X"6D", X"74", X"7B", X"82", X"88", + X"8E", X"93", X"98", X"9C", X"9F", X"A0", X"9F", X"9B", X"96", X"90", X"89", X"82", X"7B", X"74", X"6E", X"68", + X"63", X"5F", X"5D", X"5E", X"61", X"65", X"6B", X"71", X"77", X"7E", X"83", X"89", X"8C", X"8D", X"8C", X"89", + X"86", X"81", X"7D", X"78", X"73", X"6F", X"6A", X"66", X"63", X"62", X"64", X"67", X"6B", X"71", X"77", X"7C", + X"82", X"88", X"8D", X"92", X"96", X"99", X"9B", X"9D", X"9C", X"99", X"94", X"8F", X"89", X"83", X"7D", X"77", + X"71", X"6C", X"68", X"64", X"61", X"61", X"63", X"67", X"6C", X"71", X"77", X"7C", X"82", X"87", X"8C", X"91", + X"94", X"97", X"9A", X"9B", X"99", X"96", X"92", X"8D", X"87", X"81", X"7B", X"76", X"70", X"6B", X"67", X"63", + X"60", X"5E", X"5F", X"62", X"66", X"6C", X"71", X"77", X"7D", X"82", X"88", X"8C", X"90", X"94", X"97", X"98", + X"98", X"96", X"92", X"8E", X"89", X"84", X"7E", X"79", X"74", X"70", X"6B", X"68", X"64", X"62", X"61", X"62", + X"65", X"69", X"6E", X"74", X"79", X"7E", X"83", X"88", X"8C", X"90", X"93", X"96", X"98", X"98", X"95", X"92", + X"8E", X"89", X"84", X"7F", X"7A", X"75", X"71", X"6D", X"69", X"66", X"66", X"67", X"6A", X"6D", X"72", X"76", + X"7B", X"80", X"84", X"88", X"8C", X"8F", X"92", X"94", X"95", X"95", X"92", X"8F", X"8B", X"87", X"82", X"7D", + X"79", X"74", X"70", X"6C", X"69", X"66", X"65", X"66", X"69", X"6C", X"70", X"75", X"79", X"7E", X"82", X"86", + X"8A", X"8D", X"8F", X"91", X"93", X"92", X"8F", X"8C", X"89", X"84", X"80", X"7B", X"77", X"73", X"70", X"6C", + X"6A", X"67", X"66", X"67", X"69", X"6D", X"70", X"75", X"79", X"7D", X"82", X"86", X"89", X"8C", X"8E", X"90", + X"91", X"90", X"8D", X"8A", X"87", X"83", X"7F", X"7B", X"77", X"73", X"70", X"6D", X"6B", X"6B", X"6C", X"6E", + X"71", X"75", X"78", X"7C", X"80", X"84", X"87", X"8A", X"8C", X"8E", X"8F", X"8E", X"8C", X"89", X"86", X"82", + X"7F", X"7B", X"77", X"74", X"71", X"6E", X"6D", X"6E", X"70", X"72", X"75", X"78", X"7C", X"7F", X"82", X"84", + X"84", X"84", X"82", X"80", X"7E", X"7B", X"79", X"76", X"74", X"72", X"70", X"6E", X"6D", X"6D", X"6F", X"72", + X"75", X"78", X"7C", X"80", X"83", X"86", X"89", X"8C", X"8E", X"90", X"91", X"92", X"91", X"8F", X"8D", X"89", + X"86", X"82", X"7E", X"7B", X"78", X"74", X"72", X"6F", X"6E", X"6E", X"6F", X"71", X"74", X"77", X"7A", X"7E", + X"81", X"84", X"86", X"89", X"8B", X"8D", X"8D", X"8D", X"8B", X"89", X"86", X"83", X"80", X"7D", X"7A", X"77", + X"74", X"71", X"6F", X"6D", X"6D", X"6E", X"70", X"72", X"75", X"78", X"7C", X"7F", X"82", X"85", X"87", X"89", + X"8B", X"8C", X"8C", X"8B", X"89", X"87", X"84", X"81", X"7E", X"7B", X"78", X"76", X"73", X"71", X"70", X"70", + X"71", X"73", X"75", X"78", X"7B", X"7E", X"80", X"83", X"85", X"87", X"89", X"8A", X"8B", X"8A", X"89", X"87", + X"85", X"82", X"7F", X"7D", X"7A", X"77", X"75", X"72", X"71", X"6F", X"6E", X"6F", X"71", X"73", X"76", X"79", + X"7C", X"7E", X"81", X"84", X"86", X"88", X"8A", X"8B", X"8B", X"8B", X"89", X"87", X"85", X"82", X"80", X"7D", + X"7A", X"78", X"75", X"73", X"72", X"71", X"71", X"72", X"74", X"76", X"79", X"7B", X"7E", X"80", X"83", X"84", + X"85", X"84", X"83", X"82", X"80", X"7E", X"7C", X"7A", X"78", X"77", X"75", X"74", X"75", X"76", X"78", X"79", + X"7C", X"7E", X"80", X"82", X"84", X"85", X"87", X"88", X"89", X"89", X"89", X"88", X"86", X"84", X"82", X"7F", + X"7D", X"7B", X"78", X"76", X"75", X"73", X"72", X"72", X"73", X"74", X"76", X"78", X"7B", X"7D", X"7F", X"81", + X"83", X"85", X"86", X"87", X"88", X"88", X"87", X"86", X"84", X"82", X"80", X"7E", X"7C", X"7A", X"78", X"76", + X"75", X"74", X"73", X"74", X"75", X"77", X"79", X"7B", X"7D", X"7F", X"81", X"83", X"84", X"85", X"86", X"87", + X"86", X"85", X"83", X"81", X"7F", X"7D", X"7B", X"79", X"78", X"76", X"75", X"74", X"73", X"73", X"74", X"75", + X"77", X"79", X"7B", X"7D", X"7F", X"81", X"82", X"84", X"85", X"86", X"87", X"86", X"86", X"84", X"83", X"81", + X"7F", X"7D", X"7B", X"79", X"78", X"76", X"75", X"75", X"75", X"76", X"77", X"79", X"7B", X"7D", X"7E", X"80", + X"82", X"83", X"84", X"85", X"86", X"86", X"85", X"84", X"83", X"81", X"7F", X"7E", X"7C", X"7A", X"78", X"77", + X"76", X"75", X"74", X"74", X"74", X"75", X"77", X"79", X"7B", X"7C", X"7E", X"80", X"82", X"83", X"84", X"85", + X"86", X"86", X"85", X"84", X"83", X"81", X"80", X"7E", X"7C", X"7B", X"79", X"78", X"77", X"76", X"76", X"76", + X"77", X"79", X"7A", X"7C", X"7E", X"7F", X"81", X"82", X"83", X"84", X"85", X"84", X"84", X"83", X"82", X"80", + X"7F", X"7D", X"7C", X"7A", X"79", X"78", X"77", X"76", X"76", X"77", X"78", X"79", X"7A", X"7C", X"7E", X"7F", + X"80", X"82", X"83", X"84", X"84", X"85", X"85", X"85", X"84", X"83", X"82", X"80", X"7F", X"7D", X"7C", X"7A", + X"79", X"78", X"77", X"77", X"77", X"78", X"79", X"7A", X"7B", X"7D", X"7E", X"80", X"81", X"82", X"83", X"84", + X"84", X"84", X"84", X"83", X"82", X"81", X"7F", X"7E", X"7D", X"7B", X"7A", X"79", X"78", X"77", X"77", X"77", + X"78", X"79", X"7A", X"7C", X"7D", X"7E", X"7F", X"81", X"82", X"82", X"83", X"84", X"84", X"83", X"82", X"82", + X"80", X"7F", X"7E", X"7D", X"7B", X"7A", X"79", X"78", X"77", X"77", X"77", X"78", X"79", X"7A", X"7B", X"7C", + X"7D", X"7F", X"80", X"81", X"82", X"82", X"83", X"83", X"82", X"82", X"81", X"80", X"7E", X"7D", X"7C", X"7B", + X"7A", X"79", X"78", X"78", X"78", X"78", X"79", X"7A", X"7B", X"7D", X"7E", X"7F", X"80", X"81", X"82", X"82", + X"83", X"83", X"83", X"82", X"81", X"80", X"7F", X"7E", X"7D", X"7C", X"7B", X"7A", X"79", X"78", X"78", X"78", + X"78", X"79", X"7A", X"7B", X"7C", X"7D", X"7E", X"7F", X"80", X"81", X"82", X"82", X"83", X"83", X"82", X"82", + X"81", X"80", X"7F", X"7E", X"7D", X"7C", X"7B", X"7A", X"79", X"78", X"78", X"79", X"79", X"7A", X"7B", X"7C", + X"7D", X"7E", X"7F", X"80", X"80", X"80", X"80", X"7F", X"7E", X"7E", X"7D", X"7C", X"7B", X"7B", X"7A", X"79", + X"79", X"79", X"7A", X"7A", X"7B", X"7C", X"7D", X"7E", X"7F", X"80", X"80", X"81", X"82", X"82", X"82", X"83", + X"82", X"82", X"81", X"80", X"7F", X"7E", X"7D", X"7C", X"7B", X"7B", X"7A", X"79", X"79", X"79", X"79", X"7A", + X"7B", X"7C", X"7D", X"7E", X"7E", X"7F", X"80", X"81", X"81", X"81", X"80", X"80", X"7F", X"7E", X"7E", X"7D", + X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7E", X"7E", X"7F", X"80", X"80", X"80", X"80", + X"7F", X"7F", X"7E", X"7E", X"7D", X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7E", + X"7E", X"7F", X"80", X"80", X"81", X"81", X"80", X"80", X"7F", X"7E", X"7E", X"7D", X"7C", X"7C", X"7B", X"7A", + X"7A", X"7A", X"7A", X"7A", X"7B", X"7C", X"7C", X"7D", X"7E", X"7F", X"7F", X"80", X"80", X"81", X"81", X"81", + X"81", X"81", X"80", X"80", X"7F", X"7E", X"7E", X"7D", X"7C", X"7B", X"7B", X"7A", X"7A", X"7A", X"7A", X"7B", + X"7C", X"7C", X"7D", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7D", X"7D", X"7C", X"7C", + X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7D", X"7E", X"7E", X"7F", X"7F", X"80", X"80", X"81", X"81", + X"81", X"81", X"80", X"80", X"7F", X"7E", X"7E", X"7D", X"7C", X"7C", X"7B", X"7B", X"7A", X"7A", X"7A", X"7A", + X"7B", X"7C", X"7C", X"7D", X"7D", X"7E", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", + X"7E", X"7E", X"7D", X"7D", X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7D", X"7E", + X"7F", X"7F", X"7F", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7E", X"7E", X"7D", X"7D", X"7C", X"7C", X"7C", + X"7C", X"7C", X"7D", X"7D", X"7D", X"7E", X"7E", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"80", + X"80", X"7F", X"7F", X"7E", X"7D", X"7D", X"7C", X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", + X"7D", X"7D", X"7E", X"7E", X"7F", X"7F", X"7F", X"80", X"80", X"80", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", + X"7D", X"7C", X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7D", X"7E", X"7E", X"7F", + X"7F", X"7F", X"80", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7E", X"7E", X"7D", X"7D", X"7C", X"7C", + X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", + X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", + X"7F", X"7F", X"7F", X"80", X"80", X"80", X"80", X"7F", X"7F", X"7F", X"7E", X"7E", X"7D", X"7D", X"7C", X"7C", + X"7C", X"7B", X"7B", X"7B", X"7B", X"7B", X"7B", X"7C", X"7C", X"7D", X"7D", X"7E", X"7E", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7C", + X"7C", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", + X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7E", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", + X"7D", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", + X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", X"7E", X"7E", + X"7E", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7D", + X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", + X"7F", X"7F", X"7F", X"7F", X"7F", X"7F", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", + X"7C", X"7C", X"7D", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"7F", X"7F", X"7F", X"7E", + X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7C", X"7D", X"7D", X"7D", + X"7D", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", + X"7D", X"7D", X"7D", X"7D", X"7E", X"7E", X"7E", X"7E", X"7E", X"7F", X"7E", X"7E", X"7E", X"7E", X"7E", X"7E", + X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7D", X"7E", X"00"); +begin + process (clk) + begin + if rising_edge(clk) then + data <= rom_data(to_integer(unsigned(addr))); + end if; + end process; +end architecture; diff --git a/rtl/congo_sound_board.vhd b/rtl/congo_sound_board.vhd new file mode 100644 index 0000000..dbf3aa5 --- /dev/null +++ b/rtl/congo_sound_board.vhd @@ -0,0 +1,323 @@ +--------------------------------------------------------------------------------- +-- Congo_Bongo_sound_board by Dar (darfpga@aol.fr) (08/11/2022) +-- http://darfpga.blogspot.fr +--------------------------------------------------------------------------------- +-- gen_ram.vhd & io_ps2_keyboard +-------------------------------- +-- Copyright 2005-2008 by Peter Wendrich (pwsoft@syntiac.com) +-- http://www.syntiac.com/fpga64.html +--------------------------------------------------------------------------------- +-- T80/T80se - Version : 304 +----------------------------- +-- Z80 compatible microprocessor core +-- Copyright (c) 2001-2002 Daniel Wallner (jesus@opencores.org) +--------------------------------------------------------------------------------- +-- +--------------------------------------------------------------------------------- +-- Educational use only +-- Do not redistribute synthetized file with roms +-- Do not redistribute roms whatever the form +-- Use at your own risk +--------------------------------------------------------------------------------- +-- +-- SOUND : 1xZ80 @ 4.0MHz CPU accessing its program rom, working ram, 2xPSG SN76489 +-- 8Kx8bits program rom +-- 2Kx8bits working ram +-- +--------------------------------------------------------------------------------- +-- Schematics remarks : +-- +--------------------------------------------------------------------------------- + +library ieee; +use ieee.std_logic_1164.all; +use ieee.std_logic_unsigned.all; +use ieee.numeric_std.all; + +entity congo_sound_board is +port( + clock_24 : in std_logic; + reset : in std_logic; + + sound_cmd : in std_logic_vector(7 downto 0); + + audio_out : out std_logic_vector(15 downto 0); + + dl_addr : in std_logic_vector(17 downto 0); + dl_wr : in std_logic; + dl_data : in std_logic_vector( 7 downto 0); + + dbg_out : out std_logic_vector(15 downto 0) + + ); +end congo_sound_board; + +architecture struct of congo_sound_board is + + signal reset_n : std_logic; + signal clock_24n : std_logic; + + signal clock_cnt1 : std_logic_vector( 2 downto 0) := "000"; + signal clock_cnt2 : std_logic_vector( 3 downto 0) := x"0"; + signal clock_cnt3 : std_logic_vector(11 downto 0) := x"000"; + + signal ck1_ena : std_logic; + signal ck4_ena : std_logic; + + signal cpu_addr : std_logic_vector(15 downto 0); + signal cpu_di : std_logic_vector( 7 downto 0); + signal cpu_do : std_logic_vector( 7 downto 0); + signal cpu_wr_n : std_logic; + signal cpu_rd_n : std_logic; + signal cpu_mreq_n : std_logic; + signal cpu_ioreq_n : std_logic; + signal cpu_irq_n : std_logic; + signal cpu_m1_n : std_logic; + signal cpu_wait_n : std_logic; + + signal cpu_rom_do : std_logic_vector( 7 downto 0); + + signal wram_we : std_logic; + signal wram_do : std_logic_vector( 7 downto 0); + + signal ppi_port_b : std_logic_vector( 7 downto 0); + signal ppi_port_c : std_logic_vector( 7 downto 0); + + signal wave_addr : std_logic_vector(15 downto 0); + signal wave_data : std_logic_vector( 7 downto 0); + signal samples_audio : std_logic_vector(15 downto 0); + + signal psg1_ce_n : std_logic; + signal psg2_ce_n : std_logic; + signal psg1_rdy : std_logic; + signal psg2_rdy : std_logic; + signal psg1_audio : std_logic_vector( 7 downto 0); + signal psg2_audio : std_logic_vector( 7 downto 0); + + signal cpu_rom_we : std_logic; + + signal dbg_cpu_addr : std_logic_vector(15 downto 0); + signal dbg_cpu_do : std_logic_vector( 7 downto 0); + +begin + +clock_24n <= not clock_24; +reset_n <= not reset; + +-- debug +--process (reset, clock_24) +--begin +-- if rising_edge(clock_24) then +-- dbg_cpu_addr <= cpu_addr; +-- dbg_cpu_do <= cpu_do; +-- end if; +--end process; +-- +--dbg_out <= dbg_cpu_addr and x"FF"&dbg_cpu_do; + +-- make enables clocks + +process (clock_24, reset) +begin + if reset='1' then + clock_cnt1 <= (others=>'0'); + clock_cnt2 <= (others=>'0'); + else + if rising_edge(clock_24) then + ck1_ena <= '0'; + ck4_ena <= '0'; + + if clock_cnt1 = "101" then -- divide by 6 + ck4_ena <= '1'; + if clock_cnt2(1 downto 0) = "01" then ck1_ena <= '1'; end if; + + clock_cnt1 <= (others=>'0'); + if clock_cnt2 = x"F" then -- divide by 16 + clock_cnt2 <= (others=>'0'); + else + clock_cnt2 <= clock_cnt2 + 1; + end if; + else + clock_cnt1 <= clock_cnt1 + 1; + end if; + end if; + end if; +end process; + +process (clock_24, reset) +begin + if reset='1' or cpu_ioreq_n = '0' then -- reset on INT acknowledge + clock_cnt3 <= (others=>'0'); + else + if rising_edge(clock_24) then + if clock_cnt2 = x"F" and clock_cnt1 = "101" then + clock_cnt3 <= clock_cnt3 + 1; + end if; + end if; + end if; +end process; + +------------------------------------------ +-- cpu data input with address decoding -- +------------------------------------------ +cpu_di <= cpu_rom_do when cpu_mreq_n = '0' and cpu_addr(15 downto 13) = "000" else -- 0000-1FFF + wram_do when cpu_mreq_n = '0' and cpu_addr(15 downto 13) = "010" else -- 4000-47FF + mirror 1800 + sound_cmd when cpu_mreq_n = '0' and cpu_addr(15 downto 13) = "100" and cpu_addr(1 downto 0) = "00" else -- 8000 + ppi_port_b when cpu_mreq_n = '0' and cpu_addr(15 downto 13) = "100" and cpu_addr(1 downto 0) = "01" else -- 8001 + ppi_port_c when cpu_mreq_n = '0' and cpu_addr(15 downto 13) = "100" and cpu_addr(1 downto 0) = "10" else -- 8002 + X"FF"; + +------------------------------------------ +-- write enable to working ram from CPU -- +------------------------------------------ +wram_we <= '1' when cpu_mreq_n = '0' and cpu_wr_n = '0' and cpu_addr(15 downto 13) = "010" else '0'; -- 4000-47FF + mirror 1800 + +psg1_ce_n <= '0' when cpu_mreq_n = '0' and (cpu_rd_n = '0' or cpu_wr_n = '0') and cpu_addr(15 downto 13) = "011" else '1'; -- 6000-7FFF +psg2_ce_n <= '0' when cpu_mreq_n = '0' and (cpu_rd_n = '0' or cpu_wr_n = '0') and cpu_addr(15 downto 13) = "101" else '1'; -- A000-BFFF + +------------------------------------------------------------------------ +-- Misc registers, interrupt +------------------------------------------------------------------------ +cpu_irq_n <= not clock_cnt3(10); +cpu_wait_n <= '1' when psg1_rdy = '1' and psg2_rdy = '1' else '0'; + +process (clock_24, reset) +begin + if reset='1' then + ppi_port_b <= (others=>'0'); + ppi_port_c <= (others=>'0'); + else + if rising_edge(clock_24) then + if cpu_mreq_n = '0' and cpu_wr_n = '0' then + if cpu_addr(15 downto 13) = "100" and cpu_addr(1 downto 0) = "01" then ppi_port_b <= cpu_do; end if; -- 8001 + if cpu_addr(15 downto 13) = "100" and cpu_addr(1 downto 0) = "10" then ppi_port_c <= cpu_do; end if; -- 8002 + end if; + end if; + end if; +end process; + +------------------------------- +-- sound -- +------------------------------- + +audio_out <= (('0'&psg1_audio) + ('0'&psg2_audio)) & "0000000" + ("00"&samples_audio(15 downto 2)); + +---------------- +-- components -- +---------------- + +-- microprocessor Z80 +cpu : entity work.T80se +generic map(Mode => 0, T2Write => 1, IOWait => 1) +port map( + RESET_n => reset_n, + CLK_n => clock_24, + CLKEN => ck4_ena, + WAIT_n => cpu_wait_n, + INT_n => cpu_irq_n, + NMI_n => '1', + BUSRQ_n => '1', + M1_n => cpu_m1_n, + MREQ_n => cpu_mreq_n, + IORQ_n => cpu_ioreq_n, + RD_n => cpu_rd_n, + WR_n => cpu_wr_n, + RFSH_n => open, + HALT_n => open, + BUSAK_n => open, + A => cpu_addr, + DI => cpu_di, + DO => cpu_do +); + +-- cpu program ROM 0x0000-0x1FFF +--rom_cpu : entity work.congo_sound_cpu +--port map( +-- clk => clock_24n, +-- addr => cpu_addr(12 downto 0), +-- data => cpu_rom_do +--); + +cpu_rom_we <= '1' when dl_wr = '1' and dl_addr(17 downto 13) = "10000" else '0'; -- 20000-21FFF +rom_cpu : entity work.dpram +generic map( dWidth => 8, aWidth => 13) +port map( + clk_a => clock_24n, + addr_a => cpu_addr(12 downto 0), + q_a => cpu_rom_do, + clk_b => clock_24, + addr_b => dl_addr(12 downto 0), + we_b => cpu_rom_we, + d_b => dl_data +); + +-- working RAM 0x4000-0x47FF +wram : entity work.gen_ram +generic map( dWidth => 8, aWidth => 11) +port map( + clk => clock_24n, + we => wram_we, + addr => cpu_addr(10 downto 0), + d => cpu_do, + q => wram_do +); + +---- samples data -- +samples : entity work.congo_samples +port map( + clk => clock_24n, + addr => wave_addr(13 downto 0), + data => wave_data +); + +-- PSG1 +psg1 : entity work.sn76489_top +-- +-- generic ( +-- clock_div_16_g : integer := 1 +-- ); +port map( + clock_i => clock_24, + clock_en_i => ck4_ena, + res_n_i => reset_n, + ce_n_i => psg1_ce_n, + we_n_i => cpu_wr_n, + ready_o => psg1_rdy, + d_i => cpu_do, + aout_o => psg1_audio +); + +-- PSG2 +psg2 : entity work.sn76489_top +-- +-- generic ( +-- clock_div_16_g : integer := 1 +-- ); +port map( + clock_i => clock_24, + clock_en_i => ck1_ena, + res_n_i => reset_n, + ce_n_i => psg2_ce_n, + we_n_i => cpu_wr_n, + ready_o => psg2_rdy, + d_i => cpu_do, + aout_o => psg2_audio +); + + +samples_player : entity work.samples_player +port map( + clock_24 => clock_24, + reset => reset, + + port_b => ppi_port_b, + port_c => ppi_port_c, + + audio_out => samples_audio, + + wave_addr => wave_addr, + wave_rd => open, + wave_data => wave_data + ); + +end struct; \ No newline at end of file diff --git a/rtl/dpram.vhd b/rtl/dpram.vhd new file mode 100644 index 0000000..1495bb4 --- /dev/null +++ b/rtl/dpram.vhd @@ -0,0 +1,87 @@ +-- ----------------------------------------------------------------------- +-- +-- Syntiac's generic VHDL support files. +-- +-- ----------------------------------------------------------------------- +-- Copyright 2005-2008 by Peter Wendrich (pwsoft@syntiac.com) +-- http://www.syntiac.com/fpga64.html +-- +-- Modified April 2016 by Dar (darfpga@aol.fr) +-- http://darfpga.blogspot.fr +-- Remove address register when writing +-- +-- ----------------------------------------------------------------------- +-- +-- dpram.vhd +-- +-- ----------------------------------------------------------------------- +-- +-- generic ram. +-- +-- ----------------------------------------------------------------------- + +library IEEE; +use IEEE.STD_LOGIC_1164.ALL; +use IEEE.numeric_std.ALL; + +-- ----------------------------------------------------------------------- + +entity dpram is + generic ( + dWidth : integer := 8; + aWidth : integer := 10 + ); + port ( + clk_a : in std_logic; + we_a : in std_logic := '0'; + addr_a : in std_logic_vector((aWidth-1) downto 0); + d_a : in std_logic_vector((dWidth-1) downto 0) := (others => '0'); + q_a : out std_logic_vector((dWidth-1) downto 0); + + clk_b : in std_logic; + we_b : in std_logic := '0'; + addr_b : in std_logic_vector((aWidth-1) downto 0); + d_b : in std_logic_vector((dWidth-1) downto 0) := (others => '0'); + q_b : out std_logic_vector((dWidth-1) downto 0) + ); +end entity; + +-- ----------------------------------------------------------------------- + +architecture rtl of dpram is + subtype addressRange is integer range 0 to ((2**aWidth)-1); + type ramDef is array(addressRange) of std_logic_vector((dWidth-1) downto 0); + signal ram: ramDef; + ATTRIBUTE ramstyle : string; + ATTRIBUTE ramstyle OF ram : SIGNAL IS "no_rw_check"; + signal addr_a_reg: std_logic_vector((aWidth-1) downto 0); + signal addr_b_reg: std_logic_vector((aWidth-1) downto 0); +begin + +-- ----------------------------------------------------------------------- + process(clk_a) + begin + if rising_edge(clk_a) then + if we_a = '1' then + ram(to_integer(unsigned(addr_a))) <= d_a; + q_a <= d_a; + else + q_a <= ram(to_integer(unsigned(addr_a))); + end if; + end if; + end process; + + process(clk_b) + begin + if rising_edge(clk_b) then + if we_b = '1' then + ram(to_integer(unsigned(addr_b))) <= d_b; + q_b <= d_b; + else + q_b <= ram(to_integer(unsigned(addr_b))); + end if; + end if; + end process; + +end architecture; + diff --git a/rtl/gen_ram.vhd b/rtl/gen_ram.vhd new file mode 100644 index 0000000..7fbb0ad --- /dev/null +++ b/rtl/gen_ram.vhd @@ -0,0 +1,83 @@ +-- ----------------------------------------------------------------------- +-- +-- Syntiac's generic VHDL support files. +-- +-- ----------------------------------------------------------------------- +-- Copyright 2005-2008 by Peter Wendrich (pwsoft@syntiac.com) +-- http://www.syntiac.com/fpga64.html +-- +-- Modified April 2016 by Dar (darfpga@aol.fr) +-- http://darfpga.blogspot.fr +-- Remove address register when writing +-- +-- ----------------------------------------------------------------------- +-- +-- gen_rwram.vhd +-- +-- ----------------------------------------------------------------------- +-- +-- generic ram. +-- +-- ----------------------------------------------------------------------- + +library IEEE; +use IEEE.STD_LOGIC_1164.all; +use IEEE.numeric_std.all; + +-- ----------------------------------------------------------------------- + +entity gen_ram is + generic ( + dWidth : integer := 8; + aWidth : integer := 10 + ); + port ( + clk : in std_logic; + we : in std_logic; + addr : in std_logic_vector((aWidth - 1) downto 0); + d : in std_logic_vector((dWidth - 1) downto 0); + q : out std_logic_vector((dWidth - 1) downto 0) + ); +end entity; + +-- ----------------------------------------------------------------------- + +architecture rtl of gen_ram is + subtype addressRange is integer range 0 to ((2 ** aWidth) - 1); + type ramDef is array(addressRange) of std_logic_vector((dWidth - 1) downto 0); + signal ram : ramDef; + + signal rAddrReg : std_logic_vector((aWidth - 1) downto 0); + signal qReg : std_logic_vector((dWidth - 1) downto 0); +begin + -- ----------------------------------------------------------------------- + -- Signals to entity interface + -- ----------------------------------------------------------------------- + -- q <= qReg; + + -- ----------------------------------------------------------------------- + -- Memory write + -- ----------------------------------------------------------------------- + process (clk) + begin + if rising_edge(clk) then + if we = '1' then + ram(to_integer(unsigned(addr))) <= d; + end if; + end if; + end process; + + -- ----------------------------------------------------------------------- + -- Memory read + -- ----------------------------------------------------------------------- + process (clk) + begin + if rising_edge(clk) then + -- qReg <= ram(to_integer(unsigned(rAddrReg))); + -- rAddrReg <= addr; + ---- qReg <= ram(to_integer(unsigned(addr))); + q <= ram(to_integer(unsigned(addr))); + end if; + end process; + --q <= ram(to_integer(unsigned(addr))); +end architecture; diff --git a/rtl/samples_player.vhd b/rtl/samples_player.vhd new file mode 100644 index 0000000..af7d018 --- /dev/null +++ b/rtl/samples_player.vhd @@ -0,0 +1,193 @@ +---------------- +-- Wave player -- +----------------- + +-- Congo samples - start/stop addresses as stored in memory + +-- bass.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 2005 start: 44(x 2C) stop: 2050(x 802) +-- congal.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 2003 start: 2094(x 82E) stop: 4098(x 1002) +-- congah.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 1970 start: 4142(x 102E) stop: 6112(x 17E0) +-- rim.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 373 start: 6156(x 180C) stop: 6530(x 1982) +-- gorilla.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 4991 start: 6574(x 19AE) stop: 11566(x 2D2E) + +library ieee; +use ieee.std_logic_1164.all; +use ieee.std_logic_unsigned.all; +use ieee.numeric_std.all; + +entity samples_player is +port( + clock_24 : in std_logic; + reset : in std_logic; + + port_b : in std_logic_vector(7 downto 0); + port_c : in std_logic_vector(7 downto 0); + + audio_out : out std_logic_vector(15 downto 0); + + wave_addr : buffer std_logic_vector(15 downto 0); + wave_rd : out std_logic; + wave_data : in std_logic_vector(7 downto 0) + ); +end samples_player; + +architecture struct of samples_player is + + signal wav_clk_cnt : std_logic_vector(11 downto 0); -- 11kHz divider / sound# counter + + subtype snd_id_t is integer range 0 to 4; + signal snd_id : snd_id_t; + + type snd_addr_t is array(snd_id_t) of std_logic_vector(15 downto 0); + + -- wave current addresses in memory + signal snd_addrs : snd_addr_t; + +-- bass.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 2005 start: 44(x 2C) stop: 2050(x 802) +-- congal.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 2003 start: 2094(x 82E) stop: 4098(x 1002) +-- congah.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 1970 start: 4142(x 102E) stop: 6112(x 17E0) +-- rim.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 373 start: 6156(x 180C) stop: 6530(x 1982) +-- gorilla.wav e:RIFF n:1 sr:11025 br:11025 al:1 bps:8 lg: 4991 start: 6574(x 19AE) stop: 11566(x 2D2E) + + -- wave start addresses in memory + signal snd_starts : snd_addr_t := (x"002C",x"082E",x"102E",x"180C",x"19AE"); + + -- wave end addresses in memory + signal snd_stops : snd_addr_t := (x"0800",x"1000",x"17DE",x"1980",x"2D2C"); + + type snd_flag_t is array(snd_id_t) of std_logic; + + -- sound playing (once) + signal snd_starteds : snd_flag_t := ('0','0','0','0','0'); + -- sound to be restarted + signal snd_restarts : snd_flag_t := ('0','0','0','0','0'); + -- sound playing (loop) + signal snd_continus : snd_flag_t := ('0','0','0','0','0'); + + signal port_b_r : std_logic_vector(7 downto 0); + signal port_c_r : std_logic_vector(7 downto 0); + + -- sum all sound + signal audio_r, audio_sum : signed(18 downto 0); + signal audio_vol : signed(15 downto 0); + +-- signal wave_addr : std_logic_vector(15 downto 0); +-- signal wave_data : std_logic_vector( 7 downto 0); + +begin + +-- scan sound# from 0-4 +snd_id <= to_integer(unsigned(wav_clk_cnt(7 downto 5))) when wav_clk_cnt(11 downto 5) <= 4 else 0; + +audio_vol <= (signed('0'&wave_data)-to_signed(128,9))&"0000000"; -- congo samples memory is uint8 + +-- wave player +process (clock_24, reset) +begin + if reset='1' then + wav_clk_cnt <= (others=>'0'); + else + if rising_edge(clock_24) then + + port_b_r <= port_b; + port_c_r <= port_c; + + -- sound triggers + + -- snd_continus : play loop as long as set + -- snd_starteds : edge trigger start playing when currently stopped + -- snd_restarts : edge trigger restart from beginning + + snd_starteds( 0) <= snd_starteds( 0) or (not(port_c(0)) and port_c_r(0)); -- bass +-- snd_restarts( 0) <= snd_restarts( 0) or (not(port_c(0)) and port_c_r(0)); + + snd_starteds( 1) <= snd_starteds( 1) or (not(port_c(1)) and port_c_r(1)); -- congal + + snd_starteds( 2) <= snd_starteds( 2) or (not(port_c(2)) and port_c_r(2)); -- congah + + snd_starteds( 3) <= snd_starteds( 3) or (not(port_c(3)) and port_c_r(3)); -- rim + + snd_starteds( 4) <= snd_starteds( 4) or (not(port_b(1)) and port_b_r(1)); -- gorilla + + -- 11.025kHz base tempo / high bits for scanning sound# + if wav_clk_cnt = x"880" then -- divide 24MHz by 2176 => 11.025kHz + wav_clk_cnt <= (others=>'0'); + + -- latch final audio / reset sum + audio_r <= audio_sum; + audio_sum <= (others => '0'); + else + wav_clk_cnt <= wav_clk_cnt + 1; + end if; + + -- clip audio + if audio_r(18 downto 1) > 32767 then + audio_out <= x"7FFF"; + elsif audio_r(18 downto 1) < -32767 then + audio_out <= x"8001"; + else + audio_out <= std_logic_vector(audio_r(16 downto 1)+to_signed(32767,16)); + end if; + + -- sdram read trigger (and auto refresh period) + if wav_clk_cnt(4 downto 0) = "00000" then wave_rd <= '1';end if; + if wav_clk_cnt(4 downto 0) = "00010" then wave_rd <= '0';end if; + + -- select only useful cycles (0-4) + -- remaing cycles unsued + if wav_clk_cnt(11 downto 5) <= 4 then + + -- set sdram addr at begining of cycle + if wav_clk_cnt(4 downto 0) = "00000" then + wave_addr <= snd_addrs(snd_id); + end if; + + -- sound# currently playing + if (snd_starteds(snd_id) = '1' or snd_continus(snd_id) = '1' ) then + + -- get sound# sample and update next sound# address + -- (next / restart) + if wav_clk_cnt(4 downto 0) = "10000" then + + audio_sum <= audio_sum + audio_vol; + + if snd_restarts(snd_id) = '1' then + snd_addrs(snd_id) <= snd_starts(snd_id); + snd_restarts(snd_id) <= '0'; + else + snd_addrs(snd_id) <= snd_addrs(snd_id) + 1; + end if; + end if; + + -- update next sound# address + -- (stop / loop) + if snd_addrs(snd_id) >= snd_stops(snd_id) then + if snd_continus(snd_id) = '1' then + snd_addrs(snd_id) <= snd_starts(snd_id); + else + snd_starteds(snd_id) <= '0'; + end if; + end if; + + else + -- sound# stopped set begin address + snd_addrs(snd_id) <= snd_starts(snd_id); + end if; + + end if; + + end if; + end if; +end process; + + +-- samples data -- +--samples : entity work.congo_samples +--port map( +-- clk => clock_24, +-- addr => wave_addr(13 downto 0), +-- data => wave_data +--); + + +end struct; \ No newline at end of file diff --git a/target/pocket/core.qip b/target/pocket/core.qip new file mode 100644 index 0000000..aa1025d --- /dev/null +++ b/target/pocket/core.qip @@ -0,0 +1,5 @@ +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "core_top.v"] +set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "core_bridge_cmd.v"] +set_global_assignment -name SDC_FILE [file join $::quartus(qip_path) "core_constraints.sdc"] +set_global_assignment -name QIP_FILE [file join $::quartus(qip_path) "mf_pllbase.qip"] +set_global_assignment -name SIGNALTAP_FILE [file join $::quartus(qip_path) "stp1.stp"] diff --git a/target/pocket/core_bridge_cmd.v b/target/pocket/core_bridge_cmd.v new file mode 100644 index 0000000..7d891c8 --- /dev/null +++ b/target/pocket/core_bridge_cmd.v @@ -0,0 +1,542 @@ +// +// bridge host/target command handler +// 2022 Analogue +// + +// mapped to 0xF8xxxxxx on bridge +// the spec is loose enough to allow implementation with either +// block rams and a soft CPU, or simply hard logic with some case statements. +// +// the implementation spec is documented, and depending on your application you +// may want to completely replace this module. this is only one of many +// possible ways to accomplish the host/target command system and data table. +// +// this module should always be clocked by a direct clock input and never a PLL, +// because it should report PLL lock status +// + +module core_bridge_cmd ( + +input wire clk, +output reg reset_n, + +input wire bridge_endian_little, +input wire [31:0] bridge_addr, +input wire bridge_rd, +output reg [31:0] bridge_rd_data, +input wire bridge_wr, +input wire [31:0] bridge_wr_data, + +// all these signals should be synchronous to clk +// add synchronizers if these need to be used in other clock domains +input wire status_boot_done, // assert when PLLs lock and logic is ready +input wire status_setup_done, // assert when core is happy with what's been loaded into it +input wire status_running, // assert when pocket's taken core out of reset and is running + +output reg dataslot_requestread, +output reg [15:0] dataslot_requestread_id, +input wire dataslot_requestread_ack, +input wire dataslot_requestread_ok, + +output reg dataslot_requestwrite, +output reg [15:0] dataslot_requestwrite_id, +output reg [31:0] dataslot_requestwrite_size, +input wire dataslot_requestwrite_ack, +input wire dataslot_requestwrite_ok, + +output reg dataslot_update, +output reg [15:0] dataslot_update_id, +output reg [31:0] dataslot_update_size, + +output reg dataslot_allcomplete, + +output reg [31:0] rtc_epoch_seconds, +output reg [31:0] rtc_date_bcd, +output reg [31:0] rtc_time_bcd, +output reg rtc_valid, + +input wire savestate_supported, +input wire [31:0] savestate_addr, +input wire [31:0] savestate_size, +input wire [31:0] savestate_maxloadsize, + +output reg osnotify_inmenu, + +output reg savestate_start, // core should detect rising edge on this, +input wire savestate_start_ack, // and then assert ack for at least 1 cycle +input wire savestate_start_busy, // assert constantly while in progress after ack +input wire savestate_start_ok, // assert continuously when done, and clear when new process is started +input wire savestate_start_err, // assert continuously on error, and clear when new process is started + +output reg savestate_load, +input wire savestate_load_ack, +input wire savestate_load_busy, +input wire savestate_load_ok, +input wire savestate_load_err, + +input wire target_dataslot_read, // rising edge triggered +input wire target_dataslot_write, + +output reg target_dataslot_ack, // asserted upon command start until completion +output reg target_dataslot_done, // asserted upon command finish until next command is issued +output reg [2:0] target_dataslot_err, // contains result of command execution. zero is OK + +input wire [15:0] target_dataslot_id, // parameters for each of the read/reload/write commands +input wire [31:0] target_dataslot_slotoffset, +input wire [31:0] target_dataslot_bridgeaddr, +input wire [31:0] target_dataslot_length, + +input wire [9:0] datatable_addr, +input wire datatable_wren, +input wire [31:0] datatable_data, +output wire [31:0] datatable_q + +); + +// handle endianness + reg [31:0] bridge_wr_data_in; + reg [31:0] bridge_rd_data_out; + + wire endian_little_s; +synch_3 s01(bridge_endian_little, endian_little_s, clk); + +always @(*) begin + bridge_rd_data <= endian_little_s ? { + bridge_rd_data_out[7:0], + bridge_rd_data_out[15:8], + bridge_rd_data_out[23:16], + bridge_rd_data_out[31:24] + } : bridge_rd_data_out; + + bridge_wr_data_in <= endian_little_s ? { + bridge_wr_data[7:0], + bridge_wr_data[15:8], + bridge_wr_data[23:16], + bridge_wr_data[31:24] + } : bridge_wr_data; +end + + +// minimalistic approach here - +// keep the commonly used registers in logic, but data table in BRAM. +// implementation could be changed quite a bit for a more advanced use case + +// host + + reg [31:0] host_0; + reg [31:0] host_4 = 'h20; // host cmd parameter data at 0x20 + reg [31:0] host_8 = 'h40; // host cmd response data at 0x40 + + reg [31:0] host_20; // parameter data + reg [31:0] host_24; + reg [31:0] host_28; + reg [31:0] host_2C; + + reg [31:0] host_40; // response data + reg [31:0] host_44; + reg [31:0] host_48; + reg [31:0] host_4C; + + reg host_cmd_start; + reg [15:0] host_cmd_startval; + reg [15:0] host_cmd; + reg [15:0] host_resultcode; + +localparam [3:0] ST_IDLE = 'd0; +localparam [3:0] ST_PARSE = 'd1; +localparam [3:0] ST_WORK = 'd2; +localparam [3:0] ST_DONE_OK = 'd13; +localparam [3:0] ST_DONE_CODE = 'd14; +localparam [3:0] ST_DONE_ERR = 'd15; + reg [3:0] hstate; + +// target + + reg [31:0] target_0; + reg [31:0] target_4 = 'h20; + reg [31:0] target_8 = 'h40; + + reg [31:0] target_20; // parameter data + reg [31:0] target_24; + reg [31:0] target_28; + reg [31:0] target_2C; + + reg [31:0] target_40; // response data + reg [31:0] target_44; + reg [31:0] target_48; + reg [31:0] target_4C; + +localparam [3:0] TARG_ST_IDLE = 'd0; +localparam [3:0] TARG_ST_READYTORUN = 'd1; +localparam [3:0] TARG_ST_DATASLOTOP = 'd2; +localparam [3:0] TARG_ST_WAITRESULT_RTR = 'd14; +localparam [3:0] TARG_ST_WAITRESULT_DSO = 'd15; + reg [3:0] tstate; + + reg status_setup_done_1, status_setup_done_queue; + reg target_dataslot_read_1, target_dataslot_read_queue; + reg target_dataslot_write_1, target_dataslot_write_queue; + + +initial begin + reset_n <= 0; + dataslot_requestread <= 0; + dataslot_requestwrite <= 0; + dataslot_update <= 0; + dataslot_allcomplete <= 0; + rtc_valid <= 0; + savestate_start <= 0; + savestate_load <= 0; + osnotify_inmenu <= 0; + + status_setup_done_queue <= 0; + target_dataslot_read_queue <= 0; + target_dataslot_write_queue <= 0; + target_dataslot_ack <= 0; + target_dataslot_done <= 0; + target_dataslot_err <= 0; +end + +always @(posedge clk) begin + + // detect a rising edge on the input signal + // and flag a queue that will be cleared later + status_setup_done_1 <= status_setup_done; + target_dataslot_read_1 <= target_dataslot_read; + target_dataslot_write_1 <= target_dataslot_write; + + if(status_setup_done & ~status_setup_done_1) begin + status_setup_done_queue <= 1; + end + if(target_dataslot_read & ~target_dataslot_read_1) begin + target_dataslot_read_queue <= 1; + end + if(target_dataslot_write & ~target_dataslot_write_1) begin + target_dataslot_write_queue <= 1; + end + + + b_datatable_wren <= 0; + b_datatable_addr <= bridge_addr >> 2; + + if(bridge_wr) begin + casex(bridge_addr) + 32'hF8xx00xx: begin + case(bridge_addr[7:0]) + 8'h0: begin + host_0 <= bridge_wr_data_in; // command/status + // check for command + if(bridge_wr_data_in[31:16] == 16'h434D) begin + // host wants us to do a command + host_cmd_startval <= bridge_wr_data_in[15:0]; + host_cmd_start <= 1; + end + end + 8'h20: host_20 <= bridge_wr_data_in; // parameter data regs + 8'h24: host_24 <= bridge_wr_data_in; + 8'h28: host_28 <= bridge_wr_data_in; + 8'h2C: host_2C <= bridge_wr_data_in; + endcase + end + 32'hF8xx10xx: begin + case(bridge_addr[7:0]) + 8'h0: target_0 <= bridge_wr_data_in; // command/status + 8'h4: target_4 <= bridge_wr_data_in; // parameter data pointer + 8'h8: target_8 <= bridge_wr_data_in; // response data pointer + 8'h40: target_40 <= bridge_wr_data_in; // response data regs + 8'h44: target_44 <= bridge_wr_data_in; + 8'h48: target_48 <= bridge_wr_data_in; + 8'h4C: target_4C <= bridge_wr_data_in; + endcase + end + 32'hF8xx2xxx: begin + b_datatable_wren <= 1; + end + endcase + end + if(bridge_rd) begin + casex(bridge_addr) + 32'hF8xx00xx: begin + case(bridge_addr[7:0]) + 8'h0: bridge_rd_data_out <= host_0; // command/status + 8'h4: bridge_rd_data_out <= host_4; // parameter data pointer + 8'h8: bridge_rd_data_out <= host_8; // response data pointer + 8'h40: bridge_rd_data_out <= host_40; // response data regs + 8'h44: bridge_rd_data_out <= host_44; + 8'h48: bridge_rd_data_out <= host_48; + 8'h4C: bridge_rd_data_out <= host_4C; + endcase + end + 32'hF8xx10xx: begin + case(bridge_addr[7:0]) + 8'h0: bridge_rd_data_out <= target_0; + 8'h4: bridge_rd_data_out <= target_4; + 8'h8: bridge_rd_data_out <= target_8; + 8'h20: bridge_rd_data_out <= target_20; // parameter data regs + 8'h24: bridge_rd_data_out <= target_24; + 8'h28: bridge_rd_data_out <= target_28; + 8'h2C: bridge_rd_data_out <= target_2C; + endcase + end + 32'hF8xx2xxx: begin + bridge_rd_data_out <= b_datatable_q; + + end + endcase + end + + + + + + // host > target command executer + case(hstate) + ST_IDLE: begin + + dataslot_requestread <= 0; + dataslot_requestwrite <= 0; + dataslot_update <= 0; + savestate_start <= 0; + savestate_load <= 0; + + // there is no queueing. pocket will always make sure any outstanding host + // commands are finished before starting another + if(host_cmd_start) begin + host_cmd_start <= 0; + // save the command in case it gets clobbered later + host_cmd <= host_cmd_startval; + hstate <= ST_PARSE; + end + + end + ST_PARSE: begin + // overwrite command semaphore with busy flag + host_0 <= {16'h4255, host_cmd}; + + case(host_cmd) + 16'h0000: begin + // Request Status + host_resultcode <= 1; // default: booting + if(status_boot_done) begin + host_resultcode <= 2; // setup + if(status_setup_done) begin + host_resultcode <= 3; // idle + end else if(status_running) begin + host_resultcode <= 4; // running + end + end + hstate <= ST_DONE_CODE; + end + 16'h0010: begin + // Reset Enter + reset_n <= 0; + hstate <= ST_DONE_OK; + end + 16'h0011: begin + // Reset Exit + reset_n <= 1; + hstate <= ST_DONE_OK; + end + 16'h0080: begin + // Data slot request read + dataslot_allcomplete <= 0; + dataslot_requestread <= 1; + dataslot_requestread_id <= host_20[15:0]; + if(dataslot_requestread_ack) begin + host_resultcode <= 0; + if(!dataslot_requestread_ok) host_resultcode <= 2; + hstate <= ST_DONE_CODE; + end + end + 16'h0082: begin + // Data slot request write + dataslot_allcomplete <= 0; + dataslot_requestwrite <= 1; + dataslot_requestwrite_id <= host_20[15:0]; + dataslot_requestwrite_size <= host_24; + if(dataslot_requestwrite_ack) begin + host_resultcode <= 0; + if(!dataslot_requestwrite_ok) host_resultcode <= 2; + hstate <= ST_DONE_CODE; + end + end + 16'h008A: begin + // Data slot update (sent on deferload marked slots only) + dataslot_update <= 1; + dataslot_update_id <= host_20[15:0]; + dataslot_update_size <= host_24; + hstate <= ST_DONE_OK; + end + 16'h008F: begin + // Data slot access all complete + dataslot_allcomplete <= 1; + hstate <= ST_DONE_OK; + end + 16'h0090: begin + // Real-time Clock Data + // user logic should detect rising edge, it is not continuously updated + rtc_valid <= 1; + rtc_epoch_seconds <= host_20; + rtc_date_bcd <= host_24; + rtc_time_bcd <= host_28; + hstate <= ST_DONE_OK; + end + 16'h00A0: begin + // Savestate: Start/Query + host_40 <= savestate_supported; + host_44 <= savestate_addr; + host_48 <= savestate_size; + + host_resultcode <= 0; + if(savestate_start_busy) host_resultcode <= 1; + if(savestate_start_ok) host_resultcode <= 2; + if(savestate_start_err) host_resultcode <= 3; + + if(host_20[0]) begin + // Request Start! + savestate_start <= 1; + // stay in this state until ack'd + if(savestate_start_ack) begin + hstate <= ST_DONE_CODE; + end + end else begin + hstate <= ST_DONE_CODE; + end + end + 16'h00A4: begin + // Savestate: Load/Query + host_40 <= savestate_supported; + host_44 <= savestate_addr; + host_48 <= savestate_maxloadsize; + + host_resultcode <= 0; + if(savestate_load_busy) host_resultcode <= 1; + if(savestate_load_ok) host_resultcode <= 2; + if(savestate_load_err) host_resultcode <= 3; + + if(host_20[0]) begin + // Request Load! + savestate_load <= 1; + // stay in this state until ack'd + if(savestate_load_ack) begin + hstate <= ST_DONE_CODE; + end + end else begin + hstate <= ST_DONE_CODE; + end + end + 16'h00B0: begin + // OS Notify: Menu State + osnotify_inmenu <= host_20[0]; + hstate <= ST_DONE_OK; + end + default: begin + hstate <= ST_DONE_ERR; + end + endcase + end + ST_WORK: begin + hstate <= ST_IDLE; + end + ST_DONE_OK: begin + host_0 <= 32'h4F4B0000; // result code 0 + hstate <= ST_IDLE; + end + ST_DONE_CODE: begin + host_0 <= {16'h4F4B, host_resultcode}; + hstate <= ST_IDLE; + end + ST_DONE_ERR: begin + host_0 <= 32'h4F4BFFFF; // result code FFFF = unknown command + hstate <= ST_IDLE; + end + endcase + + + // target > host command executer + case(tstate) + TARG_ST_IDLE: begin + + target_dataslot_ack <= 0; + + if(status_setup_done_queue) begin + status_setup_done_queue <= 0; + tstate <= TARG_ST_READYTORUN; + + end else if(target_dataslot_read_queue) begin + target_dataslot_read_queue <= 0; + target_0[15:0] <= 16'h0180; + + target_20 <= target_dataslot_id; + target_24 <= target_dataslot_slotoffset; + target_28 <= target_dataslot_bridgeaddr; + target_2C <= target_dataslot_length; + + tstate <= TARG_ST_DATASLOTOP; + + end else if(target_dataslot_write_queue) begin + target_dataslot_write_queue <= 0; + target_0[15:0] <= 16'h0184; + + target_20 <= target_dataslot_id; + target_24 <= target_dataslot_slotoffset; + target_28 <= target_dataslot_bridgeaddr; + target_2C <= target_dataslot_length; + + tstate <= TARG_ST_DATASLOTOP; + end + end + TARG_ST_READYTORUN: begin + target_0 <= 32'h636D_0140; + tstate <= TARG_ST_WAITRESULT_RTR; + end + TARG_ST_DATASLOTOP: begin + target_0[31:16] <= 16'h636D; + + target_dataslot_done <= 0; + tstate <= TARG_ST_WAITRESULT_DSO; + end + TARG_ST_WAITRESULT_DSO: begin + if(target_0[31:16] == 16'h6275) begin + target_dataslot_ack <= 1; + end + if(target_0[31:16] == 16'h6F6B) begin + // done + // save result code + target_dataslot_err <= target_0[2:0]; + // assert done + target_dataslot_done <= 1; + tstate <= TARG_ST_IDLE; + end + end + TARG_ST_WAITRESULT_RTR: begin + if(target_0[31:16] == 16'h6F6B) begin + // done + tstate <= TARG_ST_IDLE; + end + + end + endcase + + +end + + wire [31:0] b_datatable_q; + reg [9:0] b_datatable_addr; + reg b_datatable_wren; + +mf_datatable idt ( + .address_a ( datatable_addr ), + .address_b ( b_datatable_addr ), + .clock_a ( clk ), + .clock_b ( clk ), + .data_a ( datatable_data ), + .data_b ( bridge_wr_data_in ), + .wren_a ( datatable_wren ), + .wren_b ( b_datatable_wren ), + .q_a ( datatable_q ), + .q_b ( b_datatable_q ) +); + + +endmodule diff --git a/target/pocket/core_constraints.sdc b/target/pocket/core_constraints.sdc new file mode 100644 index 0000000..198f17b --- /dev/null +++ b/target/pocket/core_constraints.sdc @@ -0,0 +1,14 @@ +# +# user core constraints +# +# put your clock groups in here as well as any net assignments +# + +set_clock_groups -asynchronous \ + -group { bridge_spiclk } \ + -group { clk_74a } \ + -group { clk_74b } \ + -group { ic|mp1|mf_pllbase_inst|altera_pll_i|general[0].gpll~PLL_OUTPUT_COUNTER|divclk } \ + -group { ic|mp1|mf_pllbase_inst|altera_pll_i|general[1].gpll~PLL_OUTPUT_COUNTER|divclk } \ + -group { ic|mp1|mf_pllbase_inst|altera_pll_i|general[2].gpll~PLL_OUTPUT_COUNTER|divclk } \ + -group { ic|mp1|mf_pllbase_inst|altera_pll_i|general[3].gpll~PLL_OUTPUT_COUNTER|divclk } diff --git a/target/pocket/core_top.v b/target/pocket/core_top.v new file mode 100644 index 0000000..38bda2c --- /dev/null +++ b/target/pocket/core_top.v @@ -0,0 +1,772 @@ +// +// User core top-level +// +// Instantiated by the real top-level: apf_top +// + +`default_nettype none + +module core_top ( + + // + // physical connections + // + + /////////////////////////////////////////////////// + // clock inputs 74.25mhz. not phase aligned, so treat these domains as asynchronous + + input wire clk_74a, // mainclk1 + input wire clk_74b, // mainclk1 + + /////////////////////////////////////////////////// + // cartridge interface + // switches between 3.3v and 5v mechanically + // output enable for multibit translators controlled by pic32 + + // GBA AD[15:8] + inout wire [7:0] cart_tran_bank2, + output wire cart_tran_bank2_dir, + + // GBA AD[7:0] + inout wire [7:0] cart_tran_bank3, + output wire cart_tran_bank3_dir, + + // GBA A[23:16] + inout wire [7:0] cart_tran_bank1, + output wire cart_tran_bank1_dir, + + // GBA [7] PHI# + // GBA [6] WR# + // GBA [5] RD# + // GBA [4] CS1#/CS# + // [3:0] unwired + inout wire [7:4] cart_tran_bank0, + output wire cart_tran_bank0_dir, + + // GBA CS2#/RES# + inout wire cart_tran_pin30, + output wire cart_tran_pin30_dir, + // when GBC cart is inserted, this signal when low or weak will pull GBC /RES low with a special circuit + // the goal is that when unconfigured, the FPGA weak pullups won't interfere. + // thus, if GBC cart is inserted, FPGA must drive this high in order to let the level translators + // and general IO drive this pin. + output wire cart_pin30_pwroff_reset, + + // GBA IRQ/DRQ + inout wire cart_tran_pin31, + output wire cart_tran_pin31_dir, + + // infrared + input wire port_ir_rx, + output wire port_ir_tx, + output wire port_ir_rx_disable, + + // GBA link port + inout wire port_tran_si, + output wire port_tran_si_dir, + inout wire port_tran_so, + output wire port_tran_so_dir, + inout wire port_tran_sck, + output wire port_tran_sck_dir, + inout wire port_tran_sd, + output wire port_tran_sd_dir, + + /////////////////////////////////////////////////// + // cellular psram 0 and 1, two chips (64mbit x2 dual die per chip) + + output wire [21:16] cram0_a, + inout wire [15:0] cram0_dq, + input wire cram0_wait, + output wire cram0_clk, + output wire cram0_adv_n, + output wire cram0_cre, + output wire cram0_ce0_n, + output wire cram0_ce1_n, + output wire cram0_oe_n, + output wire cram0_we_n, + output wire cram0_ub_n, + output wire cram0_lb_n, + + output wire [21:16] cram1_a, + inout wire [15:0] cram1_dq, + input wire cram1_wait, + output wire cram1_clk, + output wire cram1_adv_n, + output wire cram1_cre, + output wire cram1_ce0_n, + output wire cram1_ce1_n, + output wire cram1_oe_n, + output wire cram1_we_n, + output wire cram1_ub_n, + output wire cram1_lb_n, + + /////////////////////////////////////////////////// + // sdram, 512mbit 16bit + + output wire [12:0] dram_a, + output wire [1:0] dram_ba, + inout wire [15:0] dram_dq, + output wire [1:0] dram_dqm, + output wire dram_clk, + output wire dram_cke, + output wire dram_ras_n, + output wire dram_cas_n, + output wire dram_we_n, + + /////////////////////////////////////////////////// + // sram, 1mbit 16bit + + output wire [16:0] sram_a, + inout wire [15:0] sram_dq, + output wire sram_oe_n, + output wire sram_we_n, + output wire sram_ub_n, + output wire sram_lb_n, + + /////////////////////////////////////////////////// + // vblank driven by dock for sync in a certain mode + + input wire vblank, + + /////////////////////////////////////////////////// + // i/o to 6515D breakout usb uart + + output wire dbg_tx, + input wire dbg_rx, + + /////////////////////////////////////////////////// + // i/o pads near jtag connector user can solder to + + output wire user1, + input wire user2, + + /////////////////////////////////////////////////// + // RFU internal i2c bus + + inout wire aux_sda, + output wire aux_scl, + + /////////////////////////////////////////////////// + // RFU, do not use + output wire vpll_feed, + + + // + // logical connections + // + + /////////////////////////////////////////////////// + // video, audio output to scaler + output wire [23:0] video_rgb, + output wire video_rgb_clock, + output wire video_rgb_clock_90, + output wire video_de, + output wire video_skip, + output wire video_vs, + output wire video_hs, + + output wire audio_mclk, + input wire audio_adc, + output wire audio_dac, + output wire audio_lrck, + + /////////////////////////////////////////////////// + // bridge bus connection + // synchronous to clk_74a + output wire bridge_endian_little, + input wire [31:0] bridge_addr, + input wire bridge_rd, + output reg [31:0] bridge_rd_data, + input wire bridge_wr, + input wire [31:0] bridge_wr_data, + + /////////////////////////////////////////////////// + // controller data + // + // key bitmap: + // [0] dpad_up + // [1] dpad_down + // [2] dpad_left + // [3] dpad_right + // [4] face_a + // [5] face_b + // [6] face_x + // [7] face_y + // [8] trig_l1 + // [9] trig_r1 + // [10] trig_l2 + // [11] trig_r2 + // [12] trig_l3 + // [13] trig_r3 + // [14] face_select + // [15] face_start + // [28:16] + // [31:29] type + // joy values - unsigned + // [ 7: 0] lstick_x + // [15: 8] lstick_y + // [23:16] rstick_x + // [31:24] rstick_y + // trigger values - unsigned + // [ 7: 0] ltrig + // [15: 8] rtrig + // + input wire [31:0] cont1_key, + input wire [31:0] cont2_key, + input wire [31:0] cont3_key, + input wire [31:0] cont4_key, + input wire [31:0] cont1_joy, + input wire [31:0] cont2_joy, + input wire [31:0] cont3_joy, + input wire [31:0] cont4_joy, + input wire [15:0] cont1_trig, + input wire [15:0] cont2_trig, + input wire [15:0] cont3_trig, + input wire [15:0] cont4_trig + + ); + + // not using the IR port, so turn off both the LED, and + // disable the receive circuit to save power + assign port_ir_tx = 0; + assign port_ir_rx_disable = 1; + + // bridge endianness + assign bridge_endian_little = 0; + + // cart is unused, so set all level translators accordingly + // directions are 0:IN, 1:OUT + assign cart_tran_bank3 = 8'hzz; + assign cart_tran_bank3_dir = 1'b0; + assign cart_tran_bank2 = 8'hzz; + assign cart_tran_bank2_dir = 1'b0; + assign cart_tran_bank1 = 8'hzz; + assign cart_tran_bank1_dir = 1'b0; + assign cart_tran_bank0 = 4'hf; + assign cart_tran_bank0_dir = 1'b1; + assign cart_tran_pin30 = 1'b0; // reset or cs2, we let the hw control it by itself + assign cart_tran_pin30_dir = 1'bz; + assign cart_pin30_pwroff_reset = 1'b0; // hardware can control this + assign cart_tran_pin31 = 1'bz; // input + assign cart_tran_pin31_dir = 1'b0; // input + + // link port is input only + assign port_tran_so = 1'bz; + assign port_tran_so_dir = 1'b0; // SO is output only + assign port_tran_si = 1'bz; + assign port_tran_si_dir = 1'b0; // SI is input only + assign port_tran_sck = 1'bz; + assign port_tran_sck_dir = 1'b0; // clock direction can change + assign port_tran_sd = 1'bz; + assign port_tran_sd_dir = 1'b0; // SD is input and not used + + // tie off the rest of the pins we are not using + assign cram0_a = 'h0; + assign cram0_dq = {16{1'bZ}}; + assign cram0_clk = 0; + assign cram0_adv_n = 1; + assign cram0_cre = 0; + assign cram0_ce0_n = 1; + assign cram0_ce1_n = 1; + assign cram0_oe_n = 1; + assign cram0_we_n = 1; + assign cram0_ub_n = 1; + assign cram0_lb_n = 1; + + assign cram1_a = 'h0; + assign cram1_dq = {16{1'bZ}}; + assign cram1_clk = 0; + assign cram1_adv_n = 1; + assign cram1_cre = 0; + assign cram1_ce0_n = 1; + assign cram1_ce1_n = 1; + assign cram1_oe_n = 1; + assign cram1_we_n = 1; + assign cram1_ub_n = 1; + assign cram1_lb_n = 1; + + assign dram_a = 'h0; + assign dram_ba = 'h0; + assign dram_dq = {16{1'bZ}}; + assign dram_dqm = 'h0; + assign dram_clk = 'h0; + assign dram_cke = 'h0; + assign dram_ras_n = 'h1; + assign dram_cas_n = 'h1; + assign dram_we_n = 'h1; + + assign sram_a = 'h0; + assign sram_dq = {16{1'bZ}}; + assign sram_oe_n = 1; + assign sram_we_n = 1; + assign sram_ub_n = 1; + assign sram_lb_n = 1; + + assign dbg_tx = 1'bZ; + assign user1 = 1'bZ; + assign aux_scl = 1'bZ; + assign vpll_feed = 1'bZ; + + // + // host/target command handler + // + wire reset_n; // driven by host commands, can be used as core-wide reset + wire [31:0] cmd_bridge_rd_data; + + // bridge host commands + // synchronous to clk_74a + wire status_boot_done = pll_core_locked; + wire status_setup_done = pll_core_locked; // rising edge triggers a target command + wire status_running = reset_n; // we are running as soon as reset_n goes high + + wire dataslot_requestread; + wire [15:0] dataslot_requestread_id; + wire dataslot_requestread_ack = 1; + wire dataslot_requestread_ok = 1; + + wire dataslot_requestwrite; + wire [15:0] dataslot_requestwrite_id; + wire [31:0] dataslot_requestwrite_size; + wire dataslot_requestwrite_ack = 1; + wire dataslot_requestwrite_ok = 1; + + wire dataslot_update; + wire [15:0] dataslot_update_id; + wire [31:0] dataslot_update_size; + + wire dataslot_allcomplete; + + wire [31:0] rtc_epoch_seconds; + wire [31:0] rtc_date_bcd; + wire [31:0] rtc_time_bcd; + wire rtc_valid; + + wire savestate_supported; + wire [31:0] savestate_addr; + wire [31:0] savestate_size; + wire [31:0] savestate_maxloadsize; + + wire savestate_start; + wire savestate_start_ack; + wire savestate_start_busy; + wire savestate_start_ok; + wire savestate_start_err; + + wire savestate_load; + wire savestate_load_ack; + wire savestate_load_busy; + wire savestate_load_ok; + wire savestate_load_err; + + wire osnotify_inmenu; + + // bridge target commands + // synchronous to clk_74a + + reg target_dataslot_read; + reg target_dataslot_write; + + wire target_dataslot_ack; + wire target_dataslot_done; + wire [2:0] target_dataslot_err; + + reg [15:0] target_dataslot_id; + reg [31:0] target_dataslot_slotoffset; + reg [31:0] target_dataslot_bridgeaddr; + reg [31:0] target_dataslot_length; + + // bridge data slot access + // synchronous to clk_74a + + wire [9:0] datatable_addr; + wire datatable_wren; + wire [31:0] datatable_data; + wire [31:0] datatable_q; + + core_bridge_cmd icb ( + + .clk ( clk_74a ), + .reset_n ( reset_n ), + + .bridge_endian_little ( bridge_endian_little ), + .bridge_addr ( bridge_addr ), + .bridge_rd ( bridge_rd ), + .bridge_rd_data ( cmd_bridge_rd_data ), + .bridge_wr ( bridge_wr ), + .bridge_wr_data ( bridge_wr_data ), + + .status_boot_done ( status_boot_done ), + .status_setup_done ( status_setup_done ), + .status_running ( status_running ), + + .dataslot_requestread ( dataslot_requestread ), + .dataslot_requestread_id ( dataslot_requestread_id ), + .dataslot_requestread_ack ( dataslot_requestread_ack ), + .dataslot_requestread_ok ( dataslot_requestread_ok ), + + .dataslot_requestwrite ( dataslot_requestwrite ), + .dataslot_requestwrite_id ( dataslot_requestwrite_id ), + .dataslot_requestwrite_size ( dataslot_requestwrite_size ), + .dataslot_requestwrite_ack ( dataslot_requestwrite_ack ), + .dataslot_requestwrite_ok ( dataslot_requestwrite_ok ), + + .dataslot_update ( dataslot_update ), + .dataslot_update_id ( dataslot_update_id ), + .dataslot_update_size ( dataslot_update_size ), + + .dataslot_allcomplete ( dataslot_allcomplete ), + + .rtc_epoch_seconds ( rtc_epoch_seconds ), + .rtc_date_bcd ( rtc_date_bcd ), + .rtc_time_bcd ( rtc_time_bcd ), + .rtc_valid ( rtc_valid ), + + .savestate_supported ( savestate_supported ), + .savestate_addr ( savestate_addr ), + .savestate_size ( savestate_size ), + .savestate_maxloadsize ( savestate_maxloadsize ), + + .savestate_start ( savestate_start ), + .savestate_start_ack ( savestate_start_ack ), + .savestate_start_busy ( savestate_start_busy ), + .savestate_start_ok ( savestate_start_ok ), + .savestate_start_err ( savestate_start_err ), + + .savestate_load ( savestate_load ), + .savestate_load_ack ( savestate_load_ack ), + .savestate_load_busy ( savestate_load_busy ), + .savestate_load_ok ( savestate_load_ok ), + .savestate_load_err ( savestate_load_err ), + + .osnotify_inmenu ( osnotify_inmenu ), + + .target_dataslot_read ( target_dataslot_read ), + .target_dataslot_write ( target_dataslot_write ), + + .target_dataslot_ack ( target_dataslot_ack ), + .target_dataslot_done ( target_dataslot_done ), + .target_dataslot_err ( target_dataslot_err ), + + .target_dataslot_id ( target_dataslot_id ), + .target_dataslot_slotoffset ( target_dataslot_slotoffset ), + .target_dataslot_bridgeaddr ( target_dataslot_bridgeaddr ), + .target_dataslot_length ( target_dataslot_length ), + + .datatable_addr ( datatable_addr ), + .datatable_wren ( datatable_wren ), + .datatable_data ( datatable_data ), + .datatable_q ( datatable_q ) + + ); + + + //! ------------------------------------------------------------------------------------ + //! @IP Core + //! ------------------------------------------------------------------------------------ + //! + //! ------------------------------------------------------------------------------------ + //! Interactions and Dip Switches + //! ------------------------------------------------------------------------------------ + //! Pocket Bridge + always @(*) begin + casex(bridge_addr) + 32'hF0000000: begin bridge_rd_data <= bridge_read_buffer; end //! Reset + 32'hF1000000: begin bridge_rd_data <= bridge_read_buffer; end //! DIP + 32'hF2000000: begin bridge_rd_data <= bridge_read_buffer; end //! MOD + 32'hF3000000: begin bridge_rd_data <= bridge_read_buffer; end //! Scanlines + 32'hF8xxxxxx: begin bridge_rd_data <= cmd_bridge_rd_data; end //! Pocket Bridge + default: begin bridge_rd_data <= 0; end + endcase + end + //! ------------------------------------------------------------------------------------ + reg [31:0] bridge_read_buffer; + reg [31:0] reset_timer; + reg core_reset = 1; + reg core_reset_reg = 1; + wire core_reset_s; + reg temp_reset; + + reg [31:0] def_dsw = 0; + reg [31:0] def_mod = 0; + reg [31:0] def_scnl = 0; + + wire [31:0] def_dsw_s, def_mod_s, def_scnl_s; + + always @(posedge clk_74a) begin + temp_reset <= 0; //! Always default this to zero + if(bridge_wr && bridge_addr == 32'hF0000000) begin temp_reset <= 1; end //! Reset Core Command + if(bridge_wr && bridge_addr == 32'hF1000000) begin def_dsw <= bridge_wr_data; end //! DIP Switches + if(bridge_wr && bridge_addr == 32'hF2000000) begin def_mod <= bridge_wr_data; end //! Core Mode Selection + if(bridge_wr && bridge_addr == 32'hF3000000) begin def_scnl <= bridge_wr_data; end //! Scanlines + if(bridge_rd) begin + casex(bridge_addr) + 32'hF0000000: begin bridge_read_buffer <= core_reset_reg; end + 32'hF1000000: begin bridge_read_buffer <= def_dsw; end + 32'hF2000000: begin bridge_read_buffer <= def_mod; end + 32'hF3000000: begin bridge_read_buffer <= def_scnl; end + endcase + end + end + + always @(posedge clk_74a) begin + if(temp_reset) begin + reset_timer <= 32'd8000; + core_reset <= 0; + end + else begin + if (reset_timer == 32'h0) begin + core_reset <= 1; + end + else begin + reset_timer <= reset_timer - 1; + core_reset <= 0; + end + end + end + + synch_3 crst(core_reset, core_reset_s, clk_sys); + synch_3 #(.WIDTH(32)) sdsw(def_dsw, def_dsw_s, clk_sys); + synch_3 #(.WIDTH(32)) smod(def_mod, def_mod_s, clk_sys); + synch_3 #(.WIDTH(32)) sscl(def_scnl, def_scnl_s, clk_sys); + + wire [7:0] DSW0 = def_dsw_s[7:0]; + wire [7:0] DSW1 = def_dsw_s[15:8]; + wire [7:0] DSW2 = def_dsw_s[23:16]; + wire [7:0] MODE = def_mod_s[7:0]; + wire RESET = ~(reset_n && core_reset_s); + + //! ------------------------------------------------------------------------------------ + //! Data I/O + //! ------------------------------------------------------------------------------------ + wire ioctl_download; + wire [7:0] ioctl_index; + wire ioctl_wr; + wire [24:0] ioctl_addr; + wire [7:0] ioctl_dout; + + data_loader #(.ADDRESS_SIZE(25)) + data_loader_dut ( + .clk_74a ( clk_74a ), + .clk_memory ( clk_sys ), + + .bridge_wr ( bridge_wr ), + .bridge_endian_little ( bridge_endian_little ), + .bridge_addr ( bridge_addr ), + .bridge_wr_data ( bridge_wr_data ), + + .write_en ( ioctl_wr ), + .write_addr ( ioctl_addr ), + .write_data ( ioctl_dout ) + ); + + //! ------------------------------------------------------------------------------------ + //! Gamepad + //! ------------------------------------------------------------------------------------ + wire osnotify_inmenu_s; + synch_3 s2(osnotify_inmenu, osnotify_inmenu_s, clk_sys); + //! Player 1 --------------------------------------------------------------------------- + wire p1_coin, p1_start; + wire p1_up, p1_down, p1_left, p1_right; + wire p1_btn_a, p1_btn_b, p1_btn_x, p1_btn_y; + + wire p1_jump = p1_btn_a | p1_btn_b; + + pocket_gamepad + player1 ( + .iCLK ( clk_sys ), + .iJOY ( cont1_key ), + + .PAD_U ( p1_up ), + .PAD_D ( p1_down ), + .PAD_L ( p1_left ), + .PAD_R ( p1_right ), + + .BTN_A ( p1_btn_a ), + .BTN_B ( p1_btn_b ), + + .BTN_SE ( p1_coin ), + .BTN_ST ( p1_start ), + ); + //! Player 2 --------------------------------------------------------------------------- + wire p2_coin, p2_start; + wire p2_up, p2_down, p2_left, p2_right; + wire p2_btn_a, p2_btn_b, p2_btn_x, p2_btn_y; + + wire p2_jump = p2_btn_a | p2_btn_b; + + pocket_gamepad + player2 ( + .iCLK ( clk_sys ), + .iJOY ( cont2_key ), + + .PAD_U ( p2_up ), + .PAD_D ( p2_down ), + .PAD_L ( p2_left ), + .PAD_R ( p2_right ), + + .BTN_A ( p2_btn_a ), + .BTN_B ( p2_btn_b ), + + .BTN_SE ( p2_coin ), + .BTN_ST ( p2_start ), + ); + + //! ------------------------------------------------------------------------------------ + wire m_start1 = p1_start; + wire m_start2 = p2_start; + wire m_coin1 = p1_coin; + wire m_coin2 = p2_coin; + + wire m_right = p1_right | p2_right; + wire m_left = p1_left | p2_left; + wire m_down = p1_down | p2_down; + wire m_up = p1_up | p2_up; + wire m_jump_a = p1_jump | p2_jump; + + //! ------------------------------------------------------------------------------------ + //! A/V Signals + //! ------------------------------------------------------------------------------------ + wire [15:0] congo_snd_l; //! Audio + wire [15:0] congo_snd_r; //! Audio + //! ------------------------------------------------------------------------------------ + wire congo_hs, congo_vs; //! Sync H/V + wire congo_hb, congo_vb; //! Blank H/V + wire congo_de = ~(congo_hb | congo_vb); //! Data Enable + wire [7:0] congo_rgb; //! RGB 332 + wire [23:0] congo_rgb24 = { congo_rgb[7:5], 5'h0, congo_rgb[4:2], 5'h0, congo_rgb[1:0], 6'h0 }; + + //! ------------------------------------------------------------------------------------ + //! Core + //! ------------------------------------------------------------------------------------ + congo_bongo + congo_bongo_dut ( + .clock_24 ( clk_sys ), + .reset ( RESET ), + + .pause ( osnotify_inmenu_s ), + + .video_r ( congo_rgb[7:5] ), + .video_g ( congo_rgb[4:2] ), + .video_b ( congo_rgb[1:0] ), + + .video_hs ( congo_hs ), + .video_vs ( congo_vs ), + .video_hblank ( congo_hb ), + .video_vblank ( congo_vb ), + + .audio_out_r ( congo_snd_r ), + .audio_out_l ( congo_snd_l ), + + .coin1 ( m_coin1 ), + .coin2 ( m_coin2 ), + + .start1 ( m_start1 ), + .start2 ( m_start2 ), + + .left ( m_left ), + .right ( m_right ), + .up ( m_up ), + .down ( m_down ), + .fire ( m_jump_a ), + + .left_c ( m_left ), + .right_c ( m_right ), + .up_c ( m_up ), + .down_c ( m_down ), + .fire_c ( m_jump_a ), + + .dl_addr ( ioctl_addr[17:0] ), + .dl_wr ( ioctl_wr ), + .dl_data ( ioctl_dout ), + + .sw1_input ( DSW0 ), + .sw2_input ( DSW1 ), + + .flip_screen ( ), + .dbg_cpu_addr ( ) + ); + + //! ------------------------------------------------------------------------------------ + //! Pocket Video + //! ------------------------------------------------------------------------------------ + wire [23:0] s_video_rgb; + wire s_video_hs, s_video_vs, s_video_de; + wire [3:0] s_scanlines = def_scnl_s[3:0]; + + scanlines scnl + ( + .iPCLK ( clk_vid ), + .iSCANLINES ( s_scanlines ), + + .iRGB ( congo_rgb24 ), + .iVS ( congo_vs ), + .iHS ( congo_hs ), + .iDE ( congo_de ), + + .oRGB ( s_video_rgb ), + .oVS ( s_video_vs ), + .oHS ( s_video_hs ), + .oDE ( s_video_de ) + ); + + + pocket_video + pocket_video_dut ( + .iPCLK ( clk_vid ), + .iPCLK_90D ( clk_vid_90deg ), + + .iRGB ( s_video_rgb ), + .iVS ( s_video_vs ), + .iHS ( s_video_hs ), + .iDE ( s_video_de ), + + .oRGB ( video_rgb ), + .oVS ( video_vs ), + .oHS ( video_hs ), + .oDE ( video_de ), + + .oPCLK ( video_rgb_clock ), + .oPCLK_90D ( video_rgb_clock_90 ) + ); + + //! ------------------------------------------------------------------------------------ + //! Audio + //! ------------------------------------------------------------------------------------ + sound_i2s # + ( + .CHANNEL_WIDTH( 16 ), + .SIGNED_INPUT ( 1 ) + ) + sound_i2s ( + .clk_74a ( clk_74a ), + .clk_audio ( clk_sys ), + .audio_l ( congo_snd_l ), + .audio_r ( congo_snd_r ), + + .audio_mclk ( audio_mclk ), + .audio_dac ( audio_dac ), + .audio_lrck ( audio_lrck ) + ); + + //! ------------------------------------------------------------------------------------ + //! Clocks + //! ------------------------------------------------------------------------------------ + wire clk_sys; //! Core System Clock @ 24.332Mhz + wire clk_vid; //! Video: 256x224 @ 6.083Mhz + wire clk_vid_90deg; //! Video: 90º Phase Shift + wire pll_core_locked; + + mf_pllbase + mp1 ( + .refclk ( clk_74a ), + .rst ( 0 ), + + .outclk_0 ( clk_sys ), + .outclk_1 ( clk_vid ), + .outclk_2 ( clk_vid_90deg ), + + .locked ( pll_core_locked ) + ); + //! @end + +endmodule diff --git a/target/pocket/mf_pllbase.ppf b/target/pocket/mf_pllbase.ppf new file mode 100644 index 0000000..22e69f8 --- /dev/null +++ b/target/pocket/mf_pllbase.ppf @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/target/pocket/mf_pllbase.qip b/target/pocket/mf_pllbase.qip new file mode 100644 index 0000000..d94c251 --- /dev/null +++ b/target/pocket/mf_pllbase.qip @@ -0,0 +1,337 @@ +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_TOOL_NAME "altera_pll" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_TOOL_VERSION "17.1" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_TOOL_ENV "mwpim" +set_global_assignment -library "mf_pllbase" -name MISC_FILE [file join $::quartus(qip_path) "mf_pllbase.cmp"] +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_TARGETED_DEVICE_FAMILY "Cyclone V" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_GENERATED_DEVICE_FAMILY "{Cyclone V}" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_QSYS_MODE "UNKNOWN" +set_global_assignment -name SYNTHESIS_ONLY_QIP ON +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_COMPONENT_NAME "bWZfcGxsYmFzZQ==" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_COMPONENT_DISPLAY_NAME "QWx0ZXJhIFBMTA==" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_COMPONENT_REPORT_HIERARCHY "Off" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_COMPONENT_INTERNAL "Off" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_COMPONENT_VERSION "MTcuMQ==" +set_global_assignment -entity "mf_pllbase" -library "mf_pllbase" -name IP_COMPONENT_DESCRIPTION "QWx0ZXJhIFBoYXNlLUxvY2tlZCBMb29wIChBTFRFUkFfUExMKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_NAME "bWZfcGxsYmFzZV8wMDAy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_DISPLAY_NAME "QWx0ZXJhIFBMTA==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_REPORT_HIERARCHY "Off" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_INTERNAL "Off" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_AUTHOR "QWx0ZXJhIENvcnBvcmF0aW9u" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_VERSION "MTcuMQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_DESCRIPTION "QWx0ZXJhIFBoYXNlLUxvY2tlZCBMb29wIChBTFRFUkFfUExMKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZGVidWdfcHJpbnRfb3V0cHV0::ZmFsc2U=::ZGVidWdfcHJpbnRfb3V0cHV0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZGVidWdfdXNlX3JiY190YWZfbWV0aG9k::ZmFsc2U=::ZGVidWdfdXNlX3JiY190YWZfbWV0aG9k" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZGV2aWNl::NUNFQkEyRjE3QTc=::ZGV2aWNl" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BsbF9tb2Rl::RnJhY3Rpb25hbC1OIFBMTA==::UExMIE1vZGU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZnJhY3Rpb25hbF92Y29fbXVsdGlwbGllcg==::dHJ1ZQ==::ZnJhY3Rpb25hbF92Y29fbXVsdGlwbGllcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3JlZmVyZW5jZV9jbG9ja19mcmVxdWVuY3k=::NzQuMjU=::UmVmZXJlbmNlIENsb2NrIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cmVmZXJlbmNlX2Nsb2NrX2ZyZXF1ZW5jeQ==::NzQuMjUgTUh6::cmVmZXJlbmNlX2Nsb2NrX2ZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2NoYW5uZWxfc3BhY2luZw==::MC4w::Q2hhbm5lbCBTcGFjaW5n" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX29wZXJhdGlvbl9tb2Rl::bm9ybWFs::T3BlcmF0aW9uIE1vZGU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2ZlZWRiYWNrX2Nsb2Nr::R2xvYmFsIENsb2Nr::RmVlZGJhY2sgQ2xvY2s=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2ZyYWN0aW9uYWxfY291dA==::MzI=::RnJhY3Rpb25hbCBjYXJyeSBvdXQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RzbV9vdXRfc2Vs::MXN0X29yZGVy::RFNNIE9yZGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3BlcmF0aW9uX21vZGU=::bm9ybWFs::b3BlcmF0aW9uX21vZGU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3VzZV9sb2NrZWQ=::dHJ1ZQ==::RW5hYmxlIGxvY2tlZCBvdXRwdXQgcG9ydA==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2VuX2Fkdl9wYXJhbXM=::ZmFsc2U=::RW5hYmxlIHBoeXNpY2FsIG91dHB1dCBjbG9jayBwYXJhbWV0ZXJz" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX251bWJlcl9vZl9jbG9ja3M=::Mw==::TnVtYmVyIE9mIENsb2Nrcw==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "bnVtYmVyX29mX2Nsb2Nrcw==::Mw==::bnVtYmVyX29mX2Nsb2Nrcw==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX211bHRpcGx5X2ZhY3Rvcg==::MQ==::TXVsdGlwbHkgRmFjdG9yIChNLUNvdW50ZXIp" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2ZyYWNfbXVsdGlwbHlfZmFjdG9y::MQ==::RnJhY3Rpb25hbCBNdWx0aXBseSBGYWN0b3IgKEsp" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3Jfbg==::MQ==::RGl2aWRlIEZhY3RvciAoTi1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjA=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kw::MjQuMzMy::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzA=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3Iw::OA==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjA=::ODI3MTc4ODg3::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMA==::MjU=::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MA==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMA==::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MA==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzA=::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDA=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUw::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjE=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kx::Ni4wODM=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzE=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3Ix::OA==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjE=::ODI3MTc4ODg3::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMQ==::MTAw::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MQ==::Mjc2Ljc0MDY0MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMQ==::ZGVncmVlcw==::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MQ==::MjAzNDU=::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzE=::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDE=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUx::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjI=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3ky::Ni4wODM=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzI=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3Iy::OA==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjI=::ODI3MTc4ODg3::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMg==::MTAw::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5Mg==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMg==::ZGVncmVlcw==::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0Mg==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzI=::OTAuMA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDI=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUy::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjM=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kz::NDguMA==::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzM=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3Iz::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjM=::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMw==::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5Mw==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMw==::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0Mw==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzM=::LTQ1LjA=::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDM=::MjI1LjAgZGVn::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUz::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjQ=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3k0::MTMzLjExOTk4OQ==::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzQ=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3I0::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjQ=::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yNA==::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5NA==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzNA==::ZGVncmVlcw==::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0NA==::NTY0Mg==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzQ=::MjcwLjA=::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDQ=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGU0::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjU=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3k1::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzU=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3I1::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjU=::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yNQ==::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5NQ==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzNQ==::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0NQ==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzU=::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDU=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGU1::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjY=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3k2::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzY=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3I2::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjY=::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yNg==::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5Ng==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzNg==::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0Ng==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzY=::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDY=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGU2::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjc=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3k3::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzc=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3I3::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3Rvcjc=::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yNw==::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5Nw==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzNw==::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0Nw==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzc=::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDc=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGU3::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjg=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3k4::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzg=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3I4::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3Rvcjg=::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yOA==::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5OA==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzOA==::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0OA==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzg=::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDg=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGU4::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjk=::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3k5::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzk=::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3I5::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3Rvcjk=::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yOQ==::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5OQ==::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzOQ==::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0OQ==::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzk=::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDk=::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGU5::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjEw::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxMA==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzEw::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxMA==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjEw::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTA=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTA=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTA=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTA=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzEw::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDEw::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxMA==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjEx::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxMQ==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzEx::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxMQ==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjEx::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTE=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTE=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTE=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTE=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzEx::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDEx::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxMQ==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjEy::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxMg==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzEy::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxMg==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjEy::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTI=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTI=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTI=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTI=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzEy::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDEy::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxMg==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjEz::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxMw==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzEz::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxMw==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjEz::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTM=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTM=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTM=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTM=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzEz::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDEz::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxMw==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjE0::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxNA==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzE0::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxNA==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjE0::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTQ=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTQ=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTQ=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTQ=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzE0::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDE0::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxNA==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjE1::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxNQ==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzE1::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxNQ==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjE1::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTU=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTU=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTU=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTU=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzE1::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDE1::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxNQ==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjE2::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxNg==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzE2::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxNg==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjE2::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTY=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTY=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTY=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTY=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzE2::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDE2::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxNg==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Nhc2NhZGVfY291bnRlcjE3::ZmFsc2U=::TWFrZSB0aGlzIGEgY2FzY2FkZSBjb3VudGVy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX291dHB1dF9jbG9ja19mcmVxdWVuY3kxNw==::MTAwLjA=::RGVzaXJlZCBGcmVxdWVuY3k=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2RpdmlkZV9mYWN0b3JfYzE3::MQ==::RGl2aWRlIEZhY3RvciAoQy1Db3VudGVyKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9tdWx0aXBseV9mYWN0b3IxNw==::MQ==::QWN0dWFsIE11bHRpcGx5IEZhY3Rvcg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9mcmFjX211bHRpcGx5X2ZhY3RvcjE3::MQ==::QWN0dWFsIEZyYWN0aW9uYWwgTXVsdGlwbHkgRmFjdG9yIChLKQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9kaXZpZGVfZmFjdG9yMTc=::MQ==::QWN0dWFsIERpdmlkZSBGYWN0b3I=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9vdXRwdXRfY2xvY2tfZnJlcXVlbmN5MTc=::MCBNSHo=::QWN0dWFsIEZyZXF1ZW5jeQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BzX3VuaXRzMTc=::cHM=::UGhhc2UgU2hpZnQgdW5pdHM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0MTc=::MA==::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BoYXNlX3NoaWZ0X2RlZzE3::MC4w::UGhhc2UgU2hpZnQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2FjdHVhbF9waGFzZV9zaGlmdDE3::MA==::QWN0dWFsIFBoYXNlIFNoaWZ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2R1dHlfY3ljbGUxNw==::NTA=::RHV0eSBDeWNsZQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTA=::MjQuMzMyMDAwIE1Ieg==::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTA=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQw::MCBwcw==::cGhhc2Vfc2hpZnQw" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTA=::NTA=::ZHV0eV9jeWNsZTA=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE=::Ni4wODMwMDAgTUh6::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQx::MCBwcw==::cGhhc2Vfc2hpZnQx" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTE=::NTA=::ZHV0eV9jeWNsZTE=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTI=::Ni4wODMwMDAgTUh6::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTI=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQy::NDEwOTggcHM=::cGhhc2Vfc2hpZnQy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTI=::NTA=::ZHV0eV9jeWNsZTI=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTM=::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQz::MCBwcw==::cGhhc2Vfc2hpZnQz" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTM=::NTA=::ZHV0eV9jeWNsZTM=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTQ=::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQ0::MCBwcw==::cGhhc2Vfc2hpZnQ0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTQ=::NTA=::ZHV0eV9jeWNsZTQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTU=::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQ1::MCBwcw==::cGhhc2Vfc2hpZnQ1" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTU=::NTA=::ZHV0eV9jeWNsZTU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTY=::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTY=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQ2::MCBwcw==::cGhhc2Vfc2hpZnQ2" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTY=::NTA=::ZHV0eV9jeWNsZTY=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTc=::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTc=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQ3::MCBwcw==::cGhhc2Vfc2hpZnQ3" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTc=::NTA=::ZHV0eV9jeWNsZTc=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTg=::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTg=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQ4::MCBwcw==::cGhhc2Vfc2hpZnQ4" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTg=::NTA=::ZHV0eV9jeWNsZTg=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTk=::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTk=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQ5::MCBwcw==::cGhhc2Vfc2hpZnQ5" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTk=::NTA=::ZHV0eV9jeWNsZTk=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEw::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEw" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxMA==::MCBwcw==::cGhhc2Vfc2hpZnQxMA==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTEw::NTA=::ZHV0eV9jeWNsZTEw" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEx::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEx" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxMQ==::MCBwcw==::cGhhc2Vfc2hpZnQxMQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTEx::NTA=::ZHV0eV9jeWNsZTEx" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEy::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxMg==::MCBwcw==::cGhhc2Vfc2hpZnQxMg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTEy::NTA=::ZHV0eV9jeWNsZTEy" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEz::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTEz" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxMw==::MCBwcw==::cGhhc2Vfc2hpZnQxMw==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTEz::NTA=::ZHV0eV9jeWNsZTEz" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE0::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxNA==::MCBwcw==::cGhhc2Vfc2hpZnQxNA==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTE0::NTA=::ZHV0eV9jeWNsZTE0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE1::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE1" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxNQ==::MCBwcw==::cGhhc2Vfc2hpZnQxNQ==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTE1::NTA=::ZHV0eV9jeWNsZTE1" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE2::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE2" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxNg==::MCBwcw==::cGhhc2Vfc2hpZnQxNg==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTE2::NTA=::ZHV0eV9jeWNsZTE2" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE3::MCBNSHo=::b3V0cHV0X2Nsb2NrX2ZyZXF1ZW5jeTE3" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGhhc2Vfc2hpZnQxNw==::MCBwcw==::cGhhc2Vfc2hpZnQxNw==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "ZHV0eV9jeWNsZTE3::NTA=::ZHV0eV9jeWNsZTE3" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BsbF9hdXRvX3Jlc2V0::T2Zm::UExMIEF1dG8gUmVzZXQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BsbF9iYW5kd2lkdGhfcHJlc2V0::QXV0bw==::UExMIEJhbmR3aWR0aCBQcmVzZXQ=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2VuX3JlY29uZg==::ZmFsc2U=::RW5hYmxlIGR5bmFtaWMgcmVjb25maWd1cmF0aW9uIG9mIFBMTA==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2VuX2Rwc19wb3J0cw==::ZmFsc2U=::RW5hYmxlIGFjY2VzcyB0byBkeW5hbWljIHBoYXNlIHNoaWZ0IHBvcnRz" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2VuX3Bob3V0X3BvcnRz::ZmFsc2U=::RW5hYmxlIGFjY2VzcyB0byBQTEwgRFBBIG91dHB1dCBwb3J0" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGxsX3R5cGU=::R2VuZXJhbA==::UExMIFRZUEU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "cGxsX3N1YnR5cGU=::R2VuZXJhbA==::UExMIFNVQlRZUEU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BhcmFtZXRlcl9saXN0::TS1Db3VudGVyIEhpIERpdmlkZSxNLUNvdW50ZXIgTG93IERpdmlkZSxOLUNvdW50ZXIgSGkgRGl2aWRlLE4tQ291bnRlciBMb3cgRGl2aWRlLE0tQ291bnRlciBCeXBhc3MgRW5hYmxlLE4tQ291bnRlciBCeXBhc3MgRW5hYmxlLE0tQ291bnRlciBPZGQgRGl2aWRlIEVuYWJsZSxOLUNvdW50ZXIgT2RkIERpdmlkZSBFbmFibGUsQy1Db3VudGVyLTAgSGkgRGl2aWRlLEMtQ291bnRlci0wIExvdyBEaXZpZGUsQy1Db3VudGVyLTAgQ29hcnNlIFBoYXNlIFNoaWZ0LEMtQ291bnRlci0wIFZDTyBQaGFzZSBUYXAsQy1Db3VudGVyLTAgSW5wdXQgU291cmNlLEMtQ291bnRlci0wIEJ5cGFzcyBFbmFibGUsQy1Db3VudGVyLTAgT2RkIERpdmlkZSBFbmFibGUsQy1Db3VudGVyLTEgSGkgRGl2aWRlLEMtQ291bnRlci0xIExvdyBEaXZpZGUsQy1Db3VudGVyLTEgQ29hcnNlIFBoYXNlIFNoaWZ0LEMtQ291bnRlci0xIFZDTyBQaGFzZSBUYXAsQy1Db3VudGVyLTEgSW5wdXQgU291cmNlLEMtQ291bnRlci0xIEJ5cGFzcyBFbmFibGUsQy1Db3VudGVyLTEgT2RkIERpdmlkZSBFbmFibGUsQy1Db3VudGVyLTIgSGkgRGl2aWRlLEMtQ291bnRlci0yIExvdyBEaXZpZGUsQy1Db3VudGVyLTIgQ29hcnNlIFBoYXNlIFNoaWZ0LEMtQ291bnRlci0yIFZDTyBQaGFzZSBUYXAsQy1Db3VudGVyLTIgSW5wdXQgU291cmNlLEMtQ291bnRlci0yIEJ5cGFzcyBFbmFibGUsQy1Db3VudGVyLTIgT2RkIERpdmlkZSBFbmFibGUsVkNPIFBvc3QgRGl2aWRlIENvdW50ZXIgRW5hYmxlLENoYXJnZSBQdW1wIGN1cnJlbnQgKHVBKSxMb29wIEZpbHRlciBCYW5kd2lkdGggUmVzaXN0b3IgKE9obXMpICxQTEwgT3V0cHV0IFZDTyBGcmVxdWVuY3ksSy1GcmFjdGlvbmFsIERpdmlzaW9uIFZhbHVlIChEU00pLEZlZWRiYWNrIENsb2NrIFR5cGUsRmVlZGJhY2sgQ2xvY2sgTVVYIDEsRmVlZGJhY2sgQ2xvY2sgTVVYIDIsTSBDb3VudGVyIFNvdXJjZSBNVVgsUExMIEF1dG8gUmVzZXQ=::UGFyYW1ldGVyIE5hbWVz" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3BhcmFtZXRlcl92YWx1ZXM=::NCw0LDI1NiwyNTYsZmFsc2UsdHJ1ZSxmYWxzZSxmYWxzZSwxMywxMiwxLDAscGhfbXV4X2NsayxmYWxzZSx0cnVlLDUwLDUwLDEsMCxwaF9tdXhfY2xrLGZhbHNlLGZhbHNlLDUwLDUwLDI2LDAscGhfbXV4X2NsayxmYWxzZSxmYWxzZSwxLDMwLDIwMDAsNjA4LjMgTUh6LDgyNzE3ODg4NyxnY2xrLGdsYixmYl8xLHBoX211eF9jbGssZmFsc2U=::UGFyYW1ldGVyIFZhbHVlcw==" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX21pZl9nZW5lcmF0ZQ==::ZmFsc2U=::R2VuZXJhdGUgTUlGIGZpbGU=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2VuYWJsZV9taWZfZHBz::ZmFsc2U=::RW5hYmxlIER5bmFtaWMgUGhhc2UgU2hpZnQgZm9yIE1JRiBzdHJlYW1pbmc=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Rwc19jbnRy::QzA=::RFBTIENvdW50ZXIgU2VsZWN0aW9u" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Rwc19udW0=::MQ==::TnVtYmVyIG9mIER5bmFtaWMgUGhhc2UgU2hpZnRz" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2Rwc19kaXI=::UG9zaXRpdmU=::RHluYW1pYyBQaGFzZSBTaGlmdCBEaXJlY3Rpb24=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX3JlZmNsa19zd2l0Y2g=::ZmFsc2U=::Q3JlYXRlIGEgc2Vjb25kIGlucHV0IGNsayAncmVmY2xrMSc=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2VuYWJsZV9jYXNjYWRlX291dA==::ZmFsc2U=::Q3JlYXRlIGEgJ2Nhc2NhZGVfb3V0JyBzaWduYWwgdG8gY29ubmVjdCB3aXRoIGEgZG93bnN0cmVhbSBQTEw=" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_COMPONENT_PARAMETER "Z3VpX2VuYWJsZV9jYXNjYWRlX2lu::ZmFsc2U=::Q3JlYXRlIGFuIGFkanBsbGluIG9yIGNjbGsgc2lnbmFsIHRvIGNvbm5lY3Qgd2l0aCBhbiB1cHN0cmVhbSBQTEw=" + +set_global_assignment -library "mf_pllbase" -name VERILOG_FILE [file join $::quartus(qip_path) "mf_pllbase.v"] +set_global_assignment -library "mf_pllbase" -name VERILOG_FILE [file join $::quartus(qip_path) "mf_pllbase/mf_pllbase_0002.v"] +set_global_assignment -library "mf_pllbase" -name QIP_FILE [file join $::quartus(qip_path) "mf_pllbase/mf_pllbase_0002.qip"] + +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_TOOL_NAME "altera_pll" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_TOOL_VERSION "17.1" +set_global_assignment -entity "mf_pllbase_0002" -library "mf_pllbase" -name IP_TOOL_ENV "mwpim" diff --git a/target/pocket/mf_pllbase.v b/target/pocket/mf_pllbase.v new file mode 100644 index 0000000..7ea0f0e --- /dev/null +++ b/target/pocket/mf_pllbase.v @@ -0,0 +1,257 @@ +// megafunction wizard: %Altera PLL v17.1% +// GENERATION: XML +// mf_pllbase.v + +// Generated using ACDS version 17.1 590 + +`timescale 1 ps / 1 ps +module mf_pllbase ( + input wire refclk, // refclk.clk + input wire rst, // reset.reset + output wire outclk_0, // outclk0.clk + output wire outclk_1, // outclk1.clk + output wire outclk_2, // outclk2.clk + output wire locked // locked.export + ); + + mf_pllbase_0002 mf_pllbase_inst ( + .refclk (refclk), // refclk.clk + .rst (rst), // reset.reset + .outclk_0 (outclk_0), // outclk0.clk + .outclk_1 (outclk_1), // outclk1.clk + .outclk_2 (outclk_2), // outclk2.clk + .locked (locked) // locked.export + ); + +endmodule +// Retrieval info: +// +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// Retrieval info: +// IPFS_FILES : mf_pllbase.vo +// RELATED_FILES: mf_pllbase.v, mf_pllbase_0002.v diff --git a/target/pocket/mf_pllbase/mf_pllbase_0002.qip b/target/pocket/mf_pllbase/mf_pllbase_0002.qip new file mode 100644 index 0000000..5578caa --- /dev/null +++ b/target/pocket/mf_pllbase/mf_pllbase_0002.qip @@ -0,0 +1,4 @@ +set_instance_assignment -name PLL_COMPENSATION_MODE NORMAL -to "*mf_pllbase_0002*|altera_pll:altera_pll_i*|*" +set_instance_assignment -name PLL_CHANNEL_SPACING "0.0 KHz" -to "*mf_pllbase_0002*|altera_pll:altera_pll_i*|*" +set_instance_assignment -name PLL_AUTO_RESET OFF -to "*mf_pllbase_0002*|altera_pll:altera_pll_i*|*" +set_instance_assignment -name PLL_BANDWIDTH_PRESET AUTO -to "*mf_pllbase_0002*|altera_pll:altera_pll_i*|*" diff --git a/target/pocket/mf_pllbase/mf_pllbase_0002.v b/target/pocket/mf_pllbase/mf_pllbase_0002.v new file mode 100644 index 0000000..bf65a7b --- /dev/null +++ b/target/pocket/mf_pllbase/mf_pllbase_0002.v @@ -0,0 +1,93 @@ +`timescale 1ns/10ps +module mf_pllbase_0002( + + // interface 'refclk' + input wire refclk, + + // interface 'reset' + input wire rst, + + // interface 'outclk0' + output wire outclk_0, + + // interface 'outclk1' + output wire outclk_1, + + // interface 'outclk2' + output wire outclk_2, + + // interface 'locked' + output wire locked +); + + altera_pll #( + .fractional_vco_multiplier("true"), + .reference_clock_frequency("74.25 MHz"), + .operation_mode("normal"), + .number_of_clocks(3), + .output_clock_frequency0("24.332000 MHz"), + .phase_shift0("0 ps"), + .duty_cycle0(50), + .output_clock_frequency1("6.083000 MHz"), + .phase_shift1("0 ps"), + .duty_cycle1(50), + .output_clock_frequency2("6.083000 MHz"), + .phase_shift2("41098 ps"), + .duty_cycle2(50), + .output_clock_frequency3("0 MHz"), + .phase_shift3("0 ps"), + .duty_cycle3(50), + .output_clock_frequency4("0 MHz"), + .phase_shift4("0 ps"), + .duty_cycle4(50), + .output_clock_frequency5("0 MHz"), + .phase_shift5("0 ps"), + .duty_cycle5(50), + .output_clock_frequency6("0 MHz"), + .phase_shift6("0 ps"), + .duty_cycle6(50), + .output_clock_frequency7("0 MHz"), + .phase_shift7("0 ps"), + .duty_cycle7(50), + .output_clock_frequency8("0 MHz"), + .phase_shift8("0 ps"), + .duty_cycle8(50), + .output_clock_frequency9("0 MHz"), + .phase_shift9("0 ps"), + .duty_cycle9(50), + .output_clock_frequency10("0 MHz"), + .phase_shift10("0 ps"), + .duty_cycle10(50), + .output_clock_frequency11("0 MHz"), + .phase_shift11("0 ps"), + .duty_cycle11(50), + .output_clock_frequency12("0 MHz"), + .phase_shift12("0 ps"), + .duty_cycle12(50), + .output_clock_frequency13("0 MHz"), + .phase_shift13("0 ps"), + .duty_cycle13(50), + .output_clock_frequency14("0 MHz"), + .phase_shift14("0 ps"), + .duty_cycle14(50), + .output_clock_frequency15("0 MHz"), + .phase_shift15("0 ps"), + .duty_cycle15(50), + .output_clock_frequency16("0 MHz"), + .phase_shift16("0 ps"), + .duty_cycle16(50), + .output_clock_frequency17("0 MHz"), + .phase_shift17("0 ps"), + .duty_cycle17(50), + .pll_type("General"), + .pll_subtype("General") + ) altera_pll_i ( + .rst (rst), + .outclk ({outclk_2, outclk_1, outclk_0}), + .locked (locked), + .fboutclk ( ), + .fbclk (1'b0), + .refclk (refclk) + ); +endmodule + diff --git a/target/pocket/stp1.stp b/target/pocket/stp1.stp new file mode 100644 index 0000000..7a76c1d --- /dev/null +++ b/target/pocket/stp1.stp @@ -0,0 +1,1135 @@ + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + +
+ + + + + +
+ + + + + + + +
+ + + + +
+ + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + +
+ + + + + + + +
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + + + + + + + + + + + + + + + + + + + 00000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010101100010110011100010001101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100011000101100110000010011010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001000110001011001100000100110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010111110010110011110011001101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100111100101100110100001011010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001001111001011001101000010110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010100100010010011100010101101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100101001000100100110000111011010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001000010001001001100000110110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010110110010010011110011101101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100101101100100100111100111011010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001001011001001001101000001110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010101000010100011100010011101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101010000101000111000100111010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001000100001010001100000101110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010001000010100011000001011101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101110100101000111100110111010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001001101001010001101000011110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010011010010100011010000111101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101000000100000111000101111010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001010000001000001110001111110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010000000010000011000001111101001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101100100100000111100111111010011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001011001001000001111001111110100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010010010010000011010000000011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101011010101110111000100000110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101010110101011101110001000001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010001101010111011000001000011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100011010101110110000010000110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101011111101011101111001100001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010011111010111011010000100011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100111110101110110100001000110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101010010101001101110001010001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010100101010011011100010100011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100001010100110110000011000110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101011011101001101111001110001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010110111010011011110011100011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100101110100110110100000100110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101000100101001101110000001001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010101001010101011100010010011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100010010101010110000010100110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101000100101010101100000101001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010111011010101011110011010011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100110110101010110100001100110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101001101101010101101000011001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010100001010001011100010110011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101000010100010111000101100110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101000000101000101100000111001100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010110011010001011110011110011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101100110100010111100111100110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101001001101000101101000000101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010010011010001011010000001011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101011001101101111000100010110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011000110011011011100000100101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110001100110110111000001001011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101111101101101111100110010110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011011111011011011101001010101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110011110110110111010000101011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101001001100101111000101010110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011010010011001011110001010101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110000100110010111000001101011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101101101100101111100111010110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011011011011001011111001110101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110010110110010111010000011011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100101101100101110100000110110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011010100011010011110001001101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110001000110100111000001011011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100010001101001110000010110110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011011101011010011111001101101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110111010110100111110010011011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100110101101001110100001110110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011010000011000011110001011101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110100000110000111100010111011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100000001100001110000011110110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011011001011000011111001111101100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110110010110000111110011111011001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100100101100001110100000001110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011001001011000011101000000011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110101101110111111100010000111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100011011101111110000010001110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111000110111011111100000100011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110111111110111111110011000111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111101111111101111111100110001110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111001111111011111101000010011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110100101110011111100010100111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101001011100111111000101001110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111000010111001111100000110011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110010111110011111110001100111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101101111100111111100111001110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111001011111001111101000001011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110010111110011111010000010111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101010011101011111000100101110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111000100111010111100000101011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110001001110101111000001010111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101110111101011111100110101110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111011101111010111111001101011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110011011110101111010000110111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101000011100011111000101101110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111010000111000111110001011011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110000001110001111000001110111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100000011100011110000011101110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111011001111000111111001111011100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110010011110001111010000001111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100100111100011110100000011110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000110110000111000010001000111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001101100001110000000011001111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010011000011100000000010011110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000111111000111000011001100111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110001111110001110000110011001111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010111100011100000100001011110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000110010000101000010001010111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001100100001010000100010101111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010001000010100000000011011110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000100010000101000000000110111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001110110001010000110011101111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010101100010100000100000111110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000101011000101000001000001111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001101000001100000100010011111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000011010000011000000000110111110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000100100000110000000000101111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001111010001100000110011011111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011110100011000001100110111110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000101101000110000001000011111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001100000001000000100010111111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011000000010000001000101111110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000100000000100000000000111111100111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001000000001000000000001111111001110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011100100010000001100111111110011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000101001000100000001000000000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001010010001000000010000000000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011011010011110001000100000001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100110110100111100010001000000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001001101001111000000001000000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011111110011110001100110000001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100111111100111100011001100000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001011111001111000010000100000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110010001010010110001000001000001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100110010100101100010001010000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001000101001011000000001100000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010001010010110000000011000001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100111011100101100011001110000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001010111001011000010000010000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010101110010110000100000100001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100110100100110100010001001000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001101001001101000100010010000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010010010011010000000010100001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100111101100110100011001101000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001111011001101000110011010000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010110110011010000100001100001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100101101100110100001000011000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001100001001001000100010110000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010000010010010000000011100001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100100000100100100000000111000010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001110011001001000110011110000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010011100110010010000100100010001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100101001100100100001000000100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101101100101110100100010001000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011011001011101001000100010001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010100110010111010000000100100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101111110101110100110011001000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011111101011101001100110010001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010101111010111010001000010100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101011110101110100010000101000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011001001010101001000101010001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010100010010101010000000110100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101000100101010100000001101000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011101101010101001100111010001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010111011010101010001001011100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101010110101010100010000011000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011010001011001001000100110001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010110100010110010010001001100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101001000101100100000001011000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011110101011001001100110110001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010111101010110010011001101100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101011010101100100010000111000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010110101011001000100001110001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010110000010100010010001011100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101000000101000100000001111000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010000001010001000000011110001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010111001010100010011001111100010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101110010101000100110011111000101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010100101010001000100000001001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110110110110111110010001000010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101101101101111100100010000100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010011011011111000000010001001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110111111110111110011000100010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101111111101111100110011000100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010111111011111000100001001001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110101111110111110001000010010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101100101101011100100010100100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010001011010111000000011001001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110100010110101110000000110010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101110111101011100110011100100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111011101111010111001100111001001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110101011110101110001000001010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101101001101101100100010010100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011010011011011001000100101001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110100100110110110000000101010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101011011101101100110001010100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011110111011011001100110101001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110101101110110110001000011010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101101011011101101100010000110100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011000011010011001000101101001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110110000110100110000001111010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101000001101001100000001110100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011100111010011001100111101001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110111001110100110011001111010010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101010011101001100010000001100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111011000111100101000100011001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001110110001111001010001000110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011001100011110010000001001100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110011000111100100000010011001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001111111001111001011001100110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011011110011110010010000101100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110111100111100100100001011001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001110010001101001010001010110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011100100011010010000011101100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110001000110100100000011011001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001111011001101001011001110110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010011110110011010010110011101100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110101100110100100100000111001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001110100001110001010001001110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011101000011100010100010011100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110010000111000100000010111001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001100100001110001000000101110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011111010011100010110011011100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110110100111000100100001111001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001101101001110001001000011110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011100000011000010100010111100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111000000110000101000111111001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001100000001100001000000111110010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011110010011000010110011111100101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111100100110000101100111111001011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001101001001100001001000000001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011101101011111010100000000010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111011010111110101000100000101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101100110101111101000000100001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011001101011111010000001000010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111111110111110101100110000101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101101111101111101001000010001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011011111011111010010000100010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111001010110110101000101000101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101110010101101101010001010001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011000101011011010000001100010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111101110110110101100111000101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101111011101101101011001110001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011010111011011010010000010010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110110000010110110101000000100101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101110100101110101010001001001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011001001011101010000001010010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110010010111010100000010100101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101111101101110101011001101001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011011011011101010010010110010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110110110111010100100001100101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101110000101100101010001011001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011100001011001010100010110010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110000010110010100000011100101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101111001101100101011001111001010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011110011011001010110011110010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110100110110010100100000010101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101101001101100101001000000101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111101100111110110100010001010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110011001111101100000010010101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011100110011111011000000100101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111111110111110110110011001010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101111111101111101100100101010101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011101111011111011001000010101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111100100111010110100010101010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111001001110101101000101010101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011100010011101011000000110101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111110110111010110110011101010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111101101110101101100111010101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011101011011101011001000001101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111010110111010110010000011010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111010001111001101000100110101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011100100011110011000000101101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111001000111100110000001011010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111110101111001101100110110101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011111101011110011011001001101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111011010111100110010000111010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111000001110001101000101110101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011110000011100011010001011101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111000000111000110000001111010101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111100101110001101100011110101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011111001011100011011001111101010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111010010111000110010000000110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110100101110001100100000001101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111110110111111111010001000011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111001101111111110000001000110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110011011111111100000010001101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111111111111111111011001100011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111111111111111110110011000110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110111111111111100100001001101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111110010111101111010001010011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111100101111011110100010100110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110001011110111100000011001101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111101011111101111011000110011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111110111111011110110011100110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110101111110111100100000101101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111101011111101111001000001011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111101001111101110100010010110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110010011111011100000010101101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111100100111110111000000101011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111111011111101110110011010110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111110111111011101100110101101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111101101111110111001000011011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111100001111001110100010110110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111000011110011101000101101101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111100000111100111000000111011010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111000001111001110000001110110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111100111110011101100111101101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111101001111100111001000000111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111010011111001110010000001110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001011000001100011000100011101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000010110000011000100001100111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000001100000110001000001001110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001111100001100011100110011101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000011111000011000111001100111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000011110000110001010000101110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001001000000100011000101011101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000010010000001000110001010111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000000100000010001000001101110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000001000000100010000011011101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000011011000001000111001110111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000010110000010001010000011110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000101100000100010100000111101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000010100000010000110001001111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000101000000100001100011011110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000010000001000010000010111101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000011101000010000111001101111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000111010000100001110011011110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000110100001000010100001111101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000010000000000000110001011111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000100000000000001100010111110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000000000000000010000011111101011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000000000000000000100000111111010111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000110010000000001110011111110101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000100100000000010100000000011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000001001000000000101000000000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000101101000111001100010000001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001011010001110011000100000011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100000110100011100100000100000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000111111000111001110011000001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001111110001110011100110000011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100001111100011100101000010000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000001101000111001100000100001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110001001010000110011000101000011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100000010100001100100000110000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011000000101000011001000001100001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110001101110000110011100111000011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100001011100001100101000001000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011000010111000011001010000010001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001010010001010011000100100011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100010100100010100110001001000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000001001000101001000001010001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001110110001010011100110100011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100011101100010100111001101000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000011011000101001010000110001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000110110001010010100001100011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100010000100000100110001011000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000000001000001001000001110001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010000000010000010010000011100011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100011001100000100111001111000110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000110011000001001010010001001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010000100110000010010100000010011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010010110010011010110001000100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100101100100110101100010001001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101000011001001101010000010010011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010011111010011010111001100100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100111110100110101110011001001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101000111101001101010100001010011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010001111010011010101000010100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010100100100100010101100010101001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101000001001000101010000011010011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010000010010001010100000110100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010100110110100010101110011101001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101001101101000101010100101110011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010001011010001010101000001100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100100101000100100101100010011001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001010001001001011000100110011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010000100010010010100000101100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100100111010100100101110011011001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001110101001001011100110110011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010001101010010010101000011100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100011010100100101010000111001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001001000001000001011000101110011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010000000010000010100000111100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000100000000100000101000001111001101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001001100101000001011100111110011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010011001010000010111001111100110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000100010010100000101010000000101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111001011011001111011000100001011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110010110110011110110001000010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111100001101100111101000001000101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111000111111001111011100010001011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110011111110011110111001100010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111100011111100111101010000100101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000111111001111010100001001011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110010010110001110110001010010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011100000101100011101000001100101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111000001011000111010000011001011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110011011110001110111001110010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100110111100011101110011100101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111000101111000111010100000101011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110010100110010110110001001010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101100101001100101101100010010101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011000010011001011010000010101011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110000100110010110100000101010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101100111011100101101110011010101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011000110111001011010100001101011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110001101110010110101000011010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001100100001100001101100010110101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011001000011000011010000111101011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110000000110000110100000111010110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001100110011100001101110011110101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011001100111000011011100111101011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110001001110000110101000000110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010101100010110011100010001101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100101011000101100111000100011011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001000110001011001100000100110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010001100010110011000001001101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100101111100101100111100110011011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001001111001011001101000010110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010011110010110011010000101101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100101001000100100111000101011011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001010010001001001100001110110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010010000100010010011000001101101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100101101100100100111100111011011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001011011001001001111001110110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010010010110010010011010000011101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101010000101000111000100111011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001010100001010001110001001110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010001000010100011000001011101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000100010000101000110000010111011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001011101001010001111001101110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010011010010100011010000111101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000100110100101000110100001111011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001010000001000001110001011110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010100000010000011100010111101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000100000000100000110000011111011011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001011001001000001111001111110110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010110010010000011110011111101101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000100100100100000110100000000111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101010110101011101110000000001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010101101010111011100010000011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100011010101110110000010000111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101000110101011101100000100001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010111111010111011110011000011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100111110101110110100001000111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101001111101011101101000010001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010100101010011011100010100011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101001010100110111000101000111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101000010101001101100000110001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010110111010011011110011100011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101101110100110111100111000111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101001011101001101101000001001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010010001010011011110000010011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010101010010101010111000100100111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101000100101010101100000101001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010001001010101011000001010011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010101110110101010111100110100111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101011101101010101101001011001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010011011010101011010000110011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101000010100010111000101100111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101010000101000101110001011001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010000001010001011000001110011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101100110100010111100111100111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101011001101000101111001111001110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010010011010001011010000001011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100100110100010110100000010111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011010110011011011110001000101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110001100110110111000001001011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101100011001101101110000010010111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011011111011011011111001100101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110111110110110111010010101011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101100111101101101110100001010111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011010010011001011110001010101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110100100110010111100010101011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100001001100101110000011010111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011011011011001011111001110101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110110110110010111110011101011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100101101100101110100000110111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011001011011001011101000001101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110101000110100111100010011011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100010001101001110000010110111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011000100011010011100000101101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110111010110100111110011011011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101110101101001111100110110111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011001101011010011101000011101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110100000110000111100010111011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101000001100001111000101110111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011000000011000011100000111101110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110110010110000111110001111011101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101100101100001111100111110111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011001001011000011101000000011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110010010110000111010000000111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111101011011101111111000100001111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111000110111011111100000100011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111110001101110111111000001000111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111101111111101111111100110001111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111011111111011111111001100011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111110011111110111111010000100111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101001011100111111000101001111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111010010111001111110001010011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110000101110011111000001100111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111100101111100111111100011001111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111011011111001111111001110011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110010111110011111010000010111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100101111100111110100000101111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111010100111010111110001001011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110001001110101111000011010111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011100010011101011110000010101111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111011101111010111111001101011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110111011110101111110011010111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011100110111101011110100001101111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111010000111000111110001011011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001110100001110001111100010110111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100000011100011110000011101111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111000000111000111100000111011110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001110110011110001111110011110111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100100111100011110100000011111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111001001111000111101000000111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110001101100001110000100010001111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100011011000011100000000110011111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000100110000111000000000100111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110001111110001110000110011001111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100011111100011100001100110011111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000101111000111000001000010111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001100100001010000100010101111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011001000010100001000101011111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000100010000101000000000110111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001000100001010000000001101111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011101100010100001100111011111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000101011000101000001000001111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001010110001010000010000011111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011010000011000001000100111111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000110100000110000010001101111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100001001000001100000000001011111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011110100011000001100110111111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000111101000110000011001101111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100001011010001100000010000111111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011000000010000001000001111111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000110000000100000010001011111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001000000001000000000001111111101110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000010000000010000000000011111111011101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000111001000100000011001111111110111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001010010001000000010000000000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000010100100010000000100000000000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100110110100111100010001000000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001101101001111000100010000000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110010011010011110000000010000000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100111111100111100011001100000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001111111001111000110011000000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110010111110011110000100001000000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100100110100111100010000010000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011001100101001011000100010100000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010001010010110000000011000000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100100010100101100000000110000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011001110111001011000110011100000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010101110010110000100100100000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100101011100101100001000001000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001101001001101000100010010000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011010010011010001000100100000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100100100100110100000000101000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001111011001101000110011010000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011110110011010001100110100000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100101101100110100001000011000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001011011001101000010000110000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010011000010010010001000101100000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100100000100100100000000111000001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001000001001001000000001110000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010011100110010010001100111100000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100111001100100100001001000100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001010011001001000010000001000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011011001011101001000100010000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010110110010111010010001000100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101001100101110100000001001000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011111101011101001100110010000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010111111010111010011001100100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101011110101110100010000101000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010111101011101000100001010000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010110010010101010010001010100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101000100101010100000001101000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101010001001010101000000011010000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010111011010101010011001110100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101110110101010100110010111000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101010101101010101000100000110000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010110100010110010010001001100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101101000101100100100010011000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010010001011001000000010110000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010111101010110010011001101100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101111010101100100110011011000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010110101011001000100001110000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010101101010110010001000011100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101100000101000100100010111000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010000001010001000000011110000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010100000010100010000000111100001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101110010101000100110011111000011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011100101010001001100111110000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010101001010100010001000000010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101101101101111100100010000100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011011011011111001000100001000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110100110110111110000000100010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101011111101111100110001000100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011111111011111001100110001000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110101111110111110001000010010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101011111101111100010000100100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111011001011010111001000101001000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110100010110101110000000110010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011101000101101011100000001100100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111011101111010111001100111001000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110111011110101110011001110010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011101010111101011100010000010100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011010011011011001000100101000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110110100110110110010001001010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101101001001101101100000001010100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010010011011011000000010101000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110111101110110110011001101010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101101011011101101100010000110100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010110111011011000100001101000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110110000110100110010001011010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101100001101001100000011110100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011010000011010011000000011101000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110111001110100110011001111010001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001101110011101001100110011110100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011010100111010011000100000011000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001110110001111001010001000110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011101100011110010100010001100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110011000111100100000010011000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001100110001111001000000100110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011111110011110010110011001100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110111100111100100100001011000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001101111001111001001000010110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010011100100011010010100010101100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111001000110100101000111011000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001100010001101001000000110110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010011110110011010010110011101100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111101100110100101100111011000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001101011001101001001000001110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011101000011100010100010011100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000111010000111000101000100111000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001100100001110001000000101110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100011001000011100010000001011100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000111110100111000101100110111000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001101101001110001001000011110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100011011010011100010010000111100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111000000110000101000101111000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001110000001100001010001011110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000011000000011000010000001111100011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111100100110000101100111111000111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001111001001100001011001111110001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000011010010011000010010000000010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100110011010111110101000000000100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101110110101111101010001000001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011001101011111010000001000010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110110011010111110100000010000100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101111111101111101011001100001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011011111011111010010000100010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110110111110111110100100001000100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101110010101101101010001010001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011100101011011010100010100010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110110001010110110100000011000100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101111011101101101011001110001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011110111011011010110011100010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110110101110110110100100000100100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101101011101101101001000001001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101011101001011101010100010010010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110010010111010100000010100100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101100100101110101000000101001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101011111011011101010110011010010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010111110110111010100100101100100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101101101101110101001000011001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011100001011001010100010110010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111000010110010101000101100100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101100000101100101000000111001001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011110011011001010110011110010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111100110110010101100111100100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101101001101100101001000000101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011010011011001010010000001010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101111011001111101101000100010100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011100110011111011000000100101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110111001100111110110000001001010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101111111101111101101100110010100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011111111011111011001001010101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110111011110111110110010000101010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111001001110101101000101010100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011110010011101011010001010101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111000100111010110000001101010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111101101110101101100111010100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011111011011101011011001110101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111010110111010110010000011010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110101101110101100100000110100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011110100011110011010001001101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111001000111100110000001011010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001110010001111001100000010110100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011111101011110011011001101101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111111010111100110110011011010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001110110101111001100100001110100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011110000011100011010001011101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111100000111000110100010111010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110000001110001100000011110100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011101001011100011011000111101001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111110010111000110110011111010011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110100101110001100100000001100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011101001011100011001000000011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111101101111111110100010000110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110011011111111100000010001100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111100110111111111000000100011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111111111111111110110011000110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111111111111111101100110001100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111101111111111111001000010011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111100101111011110100010100110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111111001011110111101000101001100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111100010111101111000000110011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111010111111011110110001100110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111111101111110111101100111001100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111101011111101111001000001011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111010111111011110010000010110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111010011111011101000100101100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111110100111110111000001101011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111001001111101110000001010110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111110111111011101100110101100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111111101111110111011001101011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111011011111101110010000110110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111000011110011101000101101100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111110000111100111010001011011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111000001111001110000001110110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011110000011110011100000011101100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111111001111100111011001111011001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111010011111001110010000001110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011110100111110011100100000011100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000010110000011000110001000111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000101100000110001000011001110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000011000001100010000010011100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000011111000011000111001100111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000111110000110001110011001110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000111100001100010100001011100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000010010000001000110001010111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000100100000010001100010101110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000001000000100010000011011100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000000010000001000100000110111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000110110000010001110011101110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000101100000100010100000111100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000001011000001000101000001111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000101000000100001100010011110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001010000001000011000100111100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000000100000010000100000101111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000111010000100001110011011110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001110100001000011100110111100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000001101000010000101000011111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000100000000000001100000111110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001000000000000011000101111100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000000000000000000100000111111001111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000000000000000001000001111110011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001100100000000011100111111100111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000001001000000000101000000000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000010010000000001010000000001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001011010001110011000100000010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100010110100011100110001000000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000001101000111001000001000001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001111110001110011100110000010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100011111100011100111001100000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000011111000111001010000100001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110000111010001110011100001000010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100010010100001100110001010000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011000000101000011001000001100001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000001010000110010000011000010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100011011100001100111001110000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011000110111000011001010010010001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000101110000110010100000100010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100010100100010100110001001000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000101001000101001100010010001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000010010001010010000010100010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100011101100010100111001101000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000111011000101001110011010001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000110110001010010100001100010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100001101100010100101000011000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000100001000001001100010110001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010000000010000010010000011100010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100000000100000100100000111000101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000110011000001001110011110001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010001100110000010010100101010010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100001001100000100101000000100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100101100100110101100010001001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001011001001101011000100010010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010000110010011010100000100100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100111110100110101110011001001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001111101001101011100110010010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010001111010011010101000010100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100011110100110101010000101001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101001001001000101011000101010010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010000010010001010100000110100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010100000100100010101000001101001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101001101101000101011100111010010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010011011010001010111001010100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010100010110100010101010000011001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001010001001001011000100110010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010010100010010010110001001100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100001000100100101000001011001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001110101001001011100010110010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010011101010010010111001101100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100011010100100101010000111001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000110101001001010100001110010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010010000010000010110001011100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000100000000100000101000001111001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001000000001000001010000011110010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010011001010000010111001111100101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100110010100000101110011111001011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001000100101000001010100000001010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110010110110011110110001000010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100101101100111101100010000101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000011011001111010000010001010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110001111110011110111000100010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100111111100111101110011000101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000111111001111010100001001010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110001111110011110101000010010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100100101100011101100010100101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111000001011000111010000111001010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110000010110001110100000110010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100110111100011101110011100101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111001101111000111011100111001010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110001011110001110101000001010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101100101001100101101100010010101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001010011001011011000100101010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110000100110010110100000101010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100001001100101101000001010101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001110111001011011100110101010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110001101110010110101000011010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100011011100101101010000110101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011001000011000011011000101101010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110010000110000110100001111010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100000001100001101000001110101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011001100111000011011100111101010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110011001110000110111001111010101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100010011100001101010000001101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100101011000101100111000100011010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001010110001011001110001000110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010001100010110011000001001101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100011000101100110000010011010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001011111001011001111001100110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010011110010110011010000101101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100111100101100110100001011010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001010010001001001110001010110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010100100010010011100011101101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100001000100100110000011011010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001011011001001001111001110110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010110110010010011110011101101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100101100100100110100000111010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001010100001010001110000001110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010101000010100011100010011101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000100010000101000110000010111010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001000100001010001100000101110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010111010010100011110011011101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000100110100101000110100001111010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001001101001010001101000011110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010100000010000011100010111101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101000000100000111000101111010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001000000001000001100000111110101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010110010010000011110011111101011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101100100100000111100111111010111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001001001001000001101000000001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010001101010011011100000000011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101011010101110111000100000110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101000110101011101100000100001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010001101010111011000001000011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101111110101110111100110000110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101001111101011101101000010001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010011111010111011010000100011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101001010100110111000101000110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101010010101001101110001010001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010000101010011011000001100011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101101110100110111100111000110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101011011101001101111001110001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010010111010011011010000010011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100101110100110110100000100110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101010100101010101110001001001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010001001010101011000001010011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100010010101010110000010100110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101011101101010101111001101001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010111011010101011010010110011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100110110101010110100001100110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101010000101000101110001011001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010100001010001011100010110011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100000010100010110000011100110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101011001101000101111001111001101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010110011010001011110011110011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100100110100010110100000010110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101001001101000101101000000101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110110101100110110111100010001011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101100011001101101110000010010110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011000110011011011100000100101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110110111110110110111110011001011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101111101101101111100100010110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011001111011011011101000010101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110100100110010111100010101011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101001001100101111000101010110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011000010011001011100000110101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110110110110010111110011101011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101101101100101111100111010110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011001011011001011101000001101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110010110110010111010000011011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101010001101001111000100110110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011000100011010011100000101101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110001000110100111000001011011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101110101101001111100110110110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011011101011010011111001101101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110011010110100111010000111011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101000001100001111000101110110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011010000011000011110001011101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110000000110000111000001111011011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001100100101100001111100011110110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011011001011000011111001111101101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110010010110000111010000000111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100100101100001110100000001110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111010110111011111110001000011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111110001101110111111000001000111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100011011101111110000010001110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111011111111011111111001100011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110111111110111111110011000111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100111111101111110100001001110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111010010111001111110001010011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110100101110011111100010100111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100001011100111110000011001110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111000010111001111100000110011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110110111110011111110011100111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100101111100111110100000101110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111001011111001111101000001011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110101001110101111100010010111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011101010011101011110000110101110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111000100111010111100000101011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110111011110101111110011010111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101110111101011111100110101110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111001101111010111101000011011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001110100001110001111100010110111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101000011100011111000101101110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111000000111000111100000111011101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110000001110001111000001110111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101100111100011111100111101110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111001001111000111101000000111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110010011110001111010000001111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100011011000011100001000100011110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000110110000111000000001100111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001001100001110000000001001111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100011111100011100001100110011110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000111111000111000011001100111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001011110001110000010000101111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011001000010100001000101011110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000110010000101000010001010111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001000100001010000000001101111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010001000010100000000011011110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000111011000101000011001110111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001010110001010000010000011111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010101100010100000100000111110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000110100000110000010001001111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001101000001100000100010011111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010010000011000000000010111110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000111101000110000011001101111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001111010001100000110011011111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010110100011000000100001111110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000100000000100000010000011111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001100000001000000100010111111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000010000000010000000000011111110111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000100000000100000000000111111101111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001110010001000000110011111111011110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000010100100010000000100000000001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000101001000100000001000000000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001101101001111000100010000000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011011010011110001000100000001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100100110100111100000000100000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001111111001111000110011000000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011111110011110001100110000001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100101111100111100001000010000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001011111001111000010000100000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110011001010010110001000101000001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100100010100101100000000110000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001000101001011000000001100000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110011101110010110001100111000001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100111011100101100001001001000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001010111001011000010000010000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011010010011010001000100100001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100110100100110100010001001000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001001001001101000000001010000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011110110011010001100110100001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100111101100110100011001101000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001011011001101000010000110000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010110110011010000100001100001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100110000100100100010001011000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001000001001001000000001110000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010000010010010000000011100001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100111001100100100011001111000011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001110011001001000010010101000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010100110010010000100000010001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010110110010111010010001000100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101101100101110100100010001000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010011001011101000000010010001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010111111010111010011001100100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101111110101110100110011001000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010111101011101000100001010001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010101111010111010001000010100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101100100101010100100010101000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101010001001010101000000011010001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010100010010101010000000110100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101110110101010100110011101000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011101101010101001100111010001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010101011010101010001000001100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101101000101100100100010011000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011010001011001001000100110001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010100100010110010000000101100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101111010101100100110001011000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011110101011001001100110110001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010101101010110010001000011100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101011010101100100010000111000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011000001010001001000101110001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010100000010100010000000111100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101000000101000100000001111000111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011100101010001001100111110001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010111001010100010011001111100011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101010010101000100010000000100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011011011011111001000100001001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110110110110111110010001000010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101001101101111100000001000100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111010111111011111001100010001001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110111111110111110011001100010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101011111101111100010000100100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010111111011111000100001001001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110110010110101110010001010010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011101100101101011100000011100100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010001011010111000000011001001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110111011110101110011001110010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101110111101011100110011100100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010101111010111000100000101001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110110100110110110010001001010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101101001101101100100010010100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010010011011011000000010101001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110100100110110110000000101010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101111011101101100110011010100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010110111011011000100001101001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110101101110110110001000011010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001101100001101001100100010110100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011011000011010011000000111101001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110100000110100110000000111010011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001101110011101001100110011110100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011100111010011001100111101001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110101001110100110001000000110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011101100011110010100010001100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111011000111100101000100011001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001100110001111001000000100110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011001100011110010000001001100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111111100111100101100110011001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001101111001111001001000010110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011011110011110010010000101100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111001000110100101000101011001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001110010001101001010001010110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011000100011010010000001101100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111101100110100101100111011001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001111011001101001011001110110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011010110011010010010000011100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111010000111000101000000111001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001110100001110001010001001110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100011001000011100010000001011100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110010000111000100000010111001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001111101001110001011001101110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100011011010011100010010000111100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110110100111000100100001111001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001110000001100001010001011110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011100000011000010100010111100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110000000110000100000011111001111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001111001001100001011001111110011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011110010011000010110011111100111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110100100110000100100000000101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001100010101101101010000000001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011101101011111010100010000010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110110011010111110100000010000101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101100110101111101000000100001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011111111011111010110011000010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110110111110111110100100101000101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101101111101111101001000010001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011100101011011010100010100010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111001010110110101000101000101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101100010101101101000000110001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011110111011011010110011100010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111101110110110101100111000101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101101011101101101001000001001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011010111011011010010000010010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010111010010111010101000100100101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101100100101110101000000101001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011001001011101010000001010010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010111110110111010101100110100101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101111101101110101001001011001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011011011011101010010000110010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111000010110010101000101100101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101110000101100101010001011001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011000001011001010000001110010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111100110110010101100111100101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101111001101100101011001111001011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011010011011001010010000001010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110100110110010100100000010101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011110110011111011010001000101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110111001100111110110000001001010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110011001111101100000010010101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011111111011111011011001100101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111111110111110110110010001010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110111101111101100100001010101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011110010011101011010001010101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111100100111010110100010101010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110001001110101100000011010101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011111011011101011011000110101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111110110111010110110011101010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110101101110101100100000110101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011101011011101011001000001101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111101000111100110100010011010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001110010001111001100000010110101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011100100011110011000000101101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111111010111100110110011011010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111110101111001101100110110101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011101101011110011001000011101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111100000111000110100010111010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111000001110001101000101110101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011100000011100011000000111101011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111010010111000110110001111010111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111100101110001101100111110101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011101001011100011001000000011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111010010111000110010000000110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111011011111111101000100001101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111100110111111111000001100011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111001101111111110000001000110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111111111111111101100110001101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111111111111111111011001100011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111011111111111110010000100110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111111001011110111101000101001101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111110010111101111010001010011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111000101111011110000001100110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110001011110111100000011001101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111111011111101111011001110011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111010111111011110010000010110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110101111110111100100000101101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111110100111110111010001001011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111101001111101110000011010110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110010011111011100000010101101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111111101111110111011001101011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111111011111101110110011010110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110110111111011100100001101101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111110000111100111010001011011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111100001111001110100010110110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011110000011110011100000011101101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111100000111100111000000111011011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111110011111001110110011110110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011110100111110011100100000011101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111101001111100111001000000111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000101100000110001100010001110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001011000001100011000110011101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000000110000011000100000100111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000111110000110001110011001110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001111100001100011100110011101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000001111000011000101000010111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000100100000010001100010101110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001001000000100011000101011101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000000010000001000100000110111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000000100000010001000001101110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001101100000100011100111011101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000001011000001000101000001111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000010110000010001010000011110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001010000001000011000100111101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000010100000010000110001001111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000001000000100001000001011110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001110100001000011100110111101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000011101000010000111001101111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000011010000100001010000111110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000000010000001000011000001111101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000010000000000000110001011111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000000000000000001000001111110111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000000000000000010000011111101111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000011001000000000111001111111011111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000010010000000001010000000001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000100100000000010100000000011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100010110100011100110001000000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000101101000111001100010000001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000011010001110010000010000011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100011111100011100111001100000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000111111000111001110011000001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000111110001110010100001000011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100001111100011100101000010000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000100101000011001100010100001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000001010000110010000011000011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100000010100001100100000110000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000110111000011001110011100001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110001101110000110010100100100011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100001011100001100101000001000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000101001000101001100010010001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001010010001010011000100100011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100000100100010100100000101000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000111011000101001110011010001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001110110001010011100110100011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100001101100010100101000011000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000011011000101001010000110001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001000010000010011000101100011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100000000100000100100000111000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000000001000001001000001110001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001100110000010011100111100011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101011000100000100111001011000111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111000000000000000110000001001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100010011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001001001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110010011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001010011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001101001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011010011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000110011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010011001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010110011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001110011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011110011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111100111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011111001111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111110011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010000101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100001011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110001011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000100101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101001011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111001011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000010101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100101011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010101011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000110101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001101011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011101011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111010111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000011011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010001101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010011011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001011011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010101101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101011011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111011011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100111011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110111011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000111101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101111011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111101111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111111011111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111110111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000000011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000000111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010000111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001000111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011000111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011100011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000100111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010100111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011010011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101100111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101100111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111001111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111100111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100010111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001001011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110010111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101010111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001101011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011010111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000110111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010110111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001110111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011110111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111101111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011111011111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000001111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010000111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110001111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110001111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101001111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111001111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000010111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100101111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110101111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000110111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101101111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001110111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011101111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111011111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000011111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010011111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001011111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010101111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011011111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000111111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010011111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100111111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110111111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000111111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101111111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111111111111010000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111111111110100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111111111111101000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000000000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100000000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110000000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000010000000000000000000000000000100000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000100000000000000000000000000001000000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011000000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000100000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010100000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011010000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001100000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011100000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111000000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101100000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010001000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100010000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001001000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110010000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101010000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001101000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111010000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100110000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010110000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000111000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001110000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011110000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111100000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011111000000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000001000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010000100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010001000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001001000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111001000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011100100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111001000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100101000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110101000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000110100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101101000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001110100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111101000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111010000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100011000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001001100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010011000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001011000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010101100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011011000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000111000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010011100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010111000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001111000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101111000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111110000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011111100000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111111000000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000000010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100000100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110000100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000100010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101000100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111000100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000010010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000100100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010100100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001100100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011100100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111001000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000010100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010001010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010010100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110010100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010101010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101010100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001101010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111010100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100110100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110110100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000111010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101110100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111010000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011110100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111101000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000000110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000001100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010001100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001001100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011001100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011100110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000101100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110101100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011010110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110101100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101101100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111011000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001110110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111101100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111111111111111111100100011100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111111111111111111111001000111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000111110000110001110001001110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000011000001100010000110011100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000000110000011000100001100111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000101100000110001100000101110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100001101100000100010100001011100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000001011000001000101001010111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000110110000010001110001101110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001101100000100011100011011100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000000010000001000100001110111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000100100000010001100000011110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001001000000100011000000111100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000001101000010000101001001111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000011010000100001010010011110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001110100001000011100010111100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000000100000010000100001101111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000001000000100001000011011110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001010000001000011000001111100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000011101000010000111000011111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000010010000000001010010111110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001100100000000011100011111100000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000011001000000000111000111111000000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000000000000000001000011111110000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001000000000000011000100000010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000010000000000000110000000000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000011111000111001010010000001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000111110001110010100100000010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100011111100011100111000100000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000001101000111001000011000001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000011010001110010000110000010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100010110100011100110000010000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000101101000111001100000100001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000101110000110010100101000010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100011011100001100111000110000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000110111000011001110001100001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000001010000110010000111000010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100000010100001100110001011000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000100101000011001100000010001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000110110001010010100100100010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100001101100010100101001001000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000111011000101001110001010001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000010010001010010000110100010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100000100100010100100001101000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000101001000101001100000110001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001010010001010011000001100010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100001001100000100101001011000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000110011000001001110001110001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001100110000010011100011100010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100000000100000100100001111000100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000000001000001001000011110001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001000010000010011000000010010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010001111010011010101001000100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100011110100110101010010001001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001111101001101011100010010010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010010110010011010100000100100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100001100100110101000011001001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001011001001101011000001010010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010010110010011010110000010100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010100010110100010101010010101001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101001101101000101011100011010010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010011011010001010111000110100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010100000100100010101000011101001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101000001001000101010000111010010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010010010010001010110000001100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100011010100100101010010011001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000110101001001010100100110010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010011101010010010111000101100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100101000100100101000001011001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000010001001001010000110110010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010010100010010010110000011100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100100101000100100101100000111001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001000100101000001010100101110010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010011001010000010111001111100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100110010100000101110001111001000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001000000001000001010000111110010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010000000010000010100001111100100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100100000100000101100000000101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000111111001111010100100001010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110001111110011110101001000010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100111111100111101110001000101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111001111111001111011100010001010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110000110110011110100001100010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100101101100111101100000100101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111001011011001111011000001001010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110001011110001110101001010010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100010111100011101110011100101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111001101111000111011100011001010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110000010110001110100001110010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011100000101100011101000011100101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111001001011000111011000000101010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110001101110010110101001001010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100011011100101101010010010101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001110111001011011100010101010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110011101110010110111000101010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100001001100101101000011010101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001010011001011011000001101010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110010100110010110110000011010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100010011100001101010010110101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011000100111000011010100111101010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110011001110000110111000111010100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100000001100001101000011110101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011000000011000011010000111101010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110010000110000110110000000110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010111110010110011010000001101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100111100101100110100100011010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001011111001011001111000100110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010111110010110011110001001101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100011000101100110000110011010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001010110001011001110000010110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010101100010110011100000101101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100101100100100110100101011010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001001011001001001101001010110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010110110010010011110001101101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100001000100100110000111011010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001000010001001001100001110110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010100100010010011100000011101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100101100100100100110100000111010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001001101001010001101001001110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010111010010100011110001011101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101110100101000111100010111010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001000100001010001100001101110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010101000010100011100010111101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101010000101000111000001111010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001001001001000001101001011110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010010010010000011010010111101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101100100100000111100011111010000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001000000001000001100001111110100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010000000010000011000011111101000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101000000100000111000000000110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001010000001000001110000000001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010011111010111011010010000011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101111110101110111100010000110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101011111101011101111000100001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010001101010111011000011000011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110100011010101110111000101000110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101010110101011101110000010001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010010111010011011010010100011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100101110100110110100101000110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101011011101001101111000110001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010000101010011011000011100011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100001010100110110000111000110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101010010101001101110000001001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010100101010011011100000010011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100110110101010110100100100110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101011101101010101111000101001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010111011010101011110001010011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100010010101010110000110100110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101000100101010101110001001001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010101001010101011100000110011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100100110100010110100101100110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101001001101000101101001011001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010110011010001011110001110011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010101000010100010110000111100110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101000000101000101100001111001100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010100001010001011100000001011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101000010100010111000000010110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011001111011011011101001000101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110110111110110110111110001001011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101111101101101111100010010110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011000110011011011100001100101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110001100110110111000011001011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101011001101101111000001010110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011001011011001011101001010101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110010110110010111010010101011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101101101100101111100011010110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011010010011001011100000110101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110000100110010111000011101011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101001001100101111000000110110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011010010011001011110000001101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110011010110100111010010011011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101110101101001111100110110110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011011101011010011111000101101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110001000110100111000011011011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100010001101001110000110110110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011010100011010011110000011101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110010010110000111010010111011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100100101100001110100101110110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011011001011000011111000111101100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110110010110000111110001111011000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100000001100001110000111110110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011010000011000011110000000011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110100000110000111100000000111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100111111101111110100100001110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111011111111011111111001100011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110111111110111111110001000111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100011011101111110000110001110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111000110111011111100001100011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110101101110111111100000100111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100101111100111110100101001110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111001011111001111101001010011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110110111110011111110001100111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101101111100111111100011001110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111000010111001111100001110011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110100101110011111100000010111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101001011100111111000000101110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111001101111010111101001001011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110011011110101111110011010111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101110111101011111100010101110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111000100111010111100001101011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110001001110101111000011010111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101010011101011111000001101110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111001001111000111101001011011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110010011110001111010010110111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101100111100011111100011101110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111011001111000111111000111011100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110000001110001111000011110111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101000011100011111000000011110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111010000111000111110000000111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001011110001110000010010001111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010111100011100000100100011110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000111111000111000011000100111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001001100001110000000011001111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010011000011100000000110011110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000110110000111000010000010111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001110110001010000010000101111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010101100010100000100101011110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000111011000101000011000110111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001110110001010000110001101111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010001000010100000000111011110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000110010000101000010000001111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001100100001010000100000011111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010110100011000000100100111110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000101101000110000001001001111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001111010001100000110001011111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010010000011000000000110111110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000100100000110000000001101111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001101000001100000100000111111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011010000011000001000001111110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000101001000100000001001011111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001110010001000000110001111111000001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011100100010000001100011111110000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000100000000100000000001111111100000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001100000001000000100010000010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011000000010000001000000000001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100101111100111100001001000000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001011111001111000010010000000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011111110011110001100010000001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100100110100111100000001100000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001001101001111000000011000000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011011010011110001000001000001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100110110100111100010000010000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001010111001011000010010100000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110011101110010110001100011000001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100111011100101100011000110000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001000101001011000000011100000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110010001010010110001000101100001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100110010100101100010000001000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001011011001101000010010010000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010110110011010000100100100001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100111101100110100011000101000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001001001001101000000011010000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010010010011010000000110100001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100110100100110100010000011000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001101001001101000100000110000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010100110010010000100101100001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100111001100100100011000111000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001110011001001000110001110000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010000010010010000000111100001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100100000100100100000001111000010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001100001001001000100000001000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010111101011101000100100010001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010101111010111010001001000100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101111110101110100110001001000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101011011001011101000000010010001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010100110010111010000001100100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101101100101110100100000101000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011011001011101001000001010001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010101011010101010001001010100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101110110101010100110001101000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011101101010101001100011010001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010100010010101010000001110100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101000100101010100000011101000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011001001010101001000000110001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010101101010110010001001001100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101011010101100100010010011000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011110101011001001100010110001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010111100010110010011000101100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101001000101100100000011011000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011010001011001001000001110001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010110100010110010010000011100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101010010101000100010010111000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011100101010001001100111110001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010111001010100010011000111100010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101000000101000100000011111000100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010000001010001000000111110001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010110000010100010010000000010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101011111101111100010010000100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010111111011111000100100001001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110111111110111110011000100010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101111111101111100110001000100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010011011011111000000110001001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110110110110111110010000010010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101101101101111100100000100100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010101111010111000100101001001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110101011110101110011001110010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101110111101011100110001100100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010001011010111000000111001001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110100010110101110000001110010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101100101101011100100000010100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010110111011011000100100101001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110101101110110110001001001010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101111011101101100110001010100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011110111011011001100010101001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110100100110110110000001101010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101101001101101100100000110100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011010011011011001000001101001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110101001110100110001001011010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101010011101001100010010110100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011100111010011001100011101001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110100000110100110000001111010010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101000001101001100000011110100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011000011010011001000000011001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101111111001111001001000000110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011011110011110010010010001100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111111100111100101100010011001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001111111001111001011000100110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011001100011110010000011001100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111011000111100101000001011001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001110110001111001010000010110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011010110011010010010010101100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110101100110100100100101011001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001111011001101001011000110110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011000100011010010000011101100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110001000110100100000111011001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001110010001101001010000001110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011110110011010010110000011100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110110100111000100100100111001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001111101001110001011000101110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011111010011100010110001011100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110010000111000100000110111001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001110100001110001010001011110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011101000011100010100000111100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110100100110000100100101111001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001101001001100001001001011110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011110010011000010110001111100100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110000000110000100000111111001000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001100000001100001000001111110010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011100000011000010100000000010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111000000110000101000000000101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101101111101111101001001000001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011111111011111010110001000010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111111110111110101100010000101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101100110101111101000001100001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011001101011111010100010100010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111011010111110101000001000101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101101011101101101001001010001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011010111011011010010010100010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111101110110110101100011000101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101100010101101101000001110001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011000101011011010000011100010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111001010110110101000000100101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101110010101101101010000001001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011011011011101010010010010010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010111110110111010101100010100101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101111101101110101011000101001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011001001011101010000011010010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110010010111010100000100100101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101110100101110101010000011001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011010011011001010010010110010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110100110110010100100101100101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101111001101100101011000111001010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011100001011001010000001110010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110000010110010100000111100101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101110000101100101010000000101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011100001011001010100000001010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110111101111101100100100010101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011111111011111011011000100101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111111110111110110110001001010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110011001111101100000110010101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011100110011111011000001100101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111101100111110110100000101010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110101101110101100100101010101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011101011011101011001001010101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111110110111010110110001101010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101111001001110101100000011010101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011100010011101011000001110101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111100100111010110100000011010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111001001110101101000000110101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011101101011110011001001001101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111111010111100110110011011010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111110101111001101100010110101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011100100011110011000001101101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111001000111100110000011011010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111010001111001101000001110101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011101001011100011001001011101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111010010111000110010010111010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111100101110001101100011110101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011111001011100011011000111101010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111000000111000110000011111010100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111000001110001101000000001101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011110000011100011010000000011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111011111111111110010010000110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111110111111111111101100110001101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111111111111111111011000100011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111001101111111110000011000110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110011011111111100000110001101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111110110111111111010000010011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111010111111011110010010100110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110101111110111100100101001101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111111011111101111011000110011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111110111111011110110001100110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110001011110111100000111001101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111110010111101111010000001011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111100101111011110100000010110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110110111111011100100100101101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111101101111110111001001101011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111111011111101110110001010110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110010011111011100000110101101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111100100111110111000001101011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111101001111101110100000110110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011111100111110011100100101101101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111101001111100111001001011011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111110011111001110110001110110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111100111110011101100011101101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111100000111100111000001111011010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111100001111001110100000001110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111000011110011101000000011101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000001111000011000101001000111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000011110000110001010010001110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001111100001100011100010011101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000000110000011000100001100111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000001100000110001000011001110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001011000001100011000001011101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000011111000011000101000010111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000010110000010001010010101110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001101100000100011100011011101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000011011000001000111000110111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000000100000010001000011101110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001001000000100011000000111101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000010010000001000110000001111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000011010000100001010010011110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000110100001000010100100111101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000011101000010000111000101111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000001000000100001000011011110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000010000001000010000110111101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000010100000010000110000011111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000101000000100001100000111110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000100100000000010100101111101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000011001000000000111000111111010000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000110010000000001110001111110100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000000000000000010000111111101000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000010000000000000110001000011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000100000000000001100000000001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000111110001110010100100000011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100001111100011100101001000000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000111111000111001110001000001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000011010001110010000110000011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100000110100011100100001100000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000101101000111001100000100001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001011010001110011000001000011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100001011100001100101001010000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000110111000011001110001100001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110001101110000110011100011000011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100000010100001100100001110000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000000101000011001100010110001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110001001010000110011000000100011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100001101100010100101001001000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000011011000101001010010010001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001110110001010011100010100011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100010100100010100100001101000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000001001000101001000011010001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001010010001010011000001100011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100010100100010100110000011000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000010011000001001010010110001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001100110000010011100011100011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100011001100000100111000111000110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000000001000001001000011110001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010000000010000010010000111100011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100010000100000100110000000100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100011110100110101010010001001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101000111101001101010100100010011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010011111010011010111000100100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100101100100110101000001001001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101000011001001101010000110010011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010010110010011010110000010100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100101100100110101100000101001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101000101101000101010100101010011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010011011010001010111001110100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010100110110100010101110001101001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101000001001000101010000111010011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010000010010001010100001110100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010100100100100010101100000011001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000110101001001010100100110011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010001101010010010101001001100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100100111010100100101110001011001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001110101001001011100010110011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010000100010010010100001101100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100100101000100100101100000111001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001010001001001011000001110011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010001001010000010101001011100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100110010100000101110011111001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001001100101000001011100011110011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010000000010000010100001111100110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000100000000100000101000011111001100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001001000001000001011000000001011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110001111110011110101001000010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111100011111100111101010010000101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111001111111001111011100010001011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110011111110011110111000100010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111100001101100111101000011000101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111001011011001111011000001001011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110010110110011110110000010010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011100010111100011101010010100101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111000101111000111011100111001011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110011011110001110111000110010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011100000101100011101000011100101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111000001011000111010000111001011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110010010110001110110000001010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100011011100101101010010010101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011000110111001011010100100101011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110011101110010110111000101010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101100111011100101101110001010101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011000010011001011010000110101011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110010100110010110110000011010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101100101001100101101100000110101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011000100111000011010100101101011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110001001110000110101001011010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001100110011100001101110001110101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011000000011000011010000111101011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110000000110000110100001111010110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001100100001100001101100000001101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110101111100101100110100000011011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001001111001011001101001000110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010111110010110011110001001101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100101111100101100111100010011011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001000110001011001100001100110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010101100010110011100000101101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100101011000101100111000001011011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001001011001001001101001010110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010010010110010010011010010101101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100101101100100100111100011011011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001000010001001001100001110110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010010000100010010011000011101101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100101001000100100111000000111011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001010010001001001110000001110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010011010010100011010010011101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101110100101000111100010111011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001011101001010001111000101110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010001000010100011000011011101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101010000101000111000101111011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001010100001010001110000011110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010010010010000011010010111101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000100100100100000110100101111011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001011001001000001111000111110110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010000000010000011000011111101100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000100000000100000110000111111011000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001010000001000001110000000001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010100000010000011100000000011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100111110101110110100100000111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101011111101011101111000100001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010111111010111011110001000011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100011010101110110000110000111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101000110101011101110001010001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010101101010111011100000100011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100101110100110110100101000111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101001011101001101101001010001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010110111010011011110001100011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100001010100110110000111000111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101000010101001101100001110001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010100101010011011100000010011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101001010100110111000000100111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101001101101010101101001001001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010111011010101011110001010011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010101110110101010111100010100111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101000100101010101100001101001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010001001010101011000011010011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010101010010101010111000001100111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101001001101000101101001011001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010010011010001011010010110011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101100110100010111100011100111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101010000101000101100000111001110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010000001010001011000011110011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101000010100010111000000010111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101010000101000101110000000101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110011110110110111010010001011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101111101101101111100010010111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011011111011011011111000100101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110001100110110111000011001011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101100011001101101110000110010111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011010110011011011110000010101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110010110110010111010010101011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100101101100101110100101010111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011011011011001011111000110101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110110100110010111110001101011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100001001100101110000111010111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011010010011001011110000001101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110100100110010111100000011011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100110101101001110100100110111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011011101011010011111001101101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110111010110100111110001011011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100010001101001110000110110111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011000100011010011100001101101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110101000110100111100000111011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100100101100001110100101110111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011001001011000011101001011101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110110010110000111110001111011100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101100101100001111100011110111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011000000011000011100001111101110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110100000110000111100000000111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101000001100001111000000001111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111001111111011111101001000011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110011111110111111110011000111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111101111111101111111100010001111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111000110111011111100001100011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111110001101110111111000011000111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111101011011101111111000001001111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111001011111001111101001010011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110010111110011111010010100111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101101111100111111100011001111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111011011111001111111000110011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110000101110011111000011100111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101001011100111111000000101111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111010010111001111110000001011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110011011110101111010010010111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011100110111101011110100100101111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111011101111010111111000101011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110001001110101111000011010111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011100010011101011110000110101111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111010100111010111110000011011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110110011110001111010000110111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100100111100011110100101101111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111011001111000111111000111011110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001110110011110001111110001110111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100000011100011110000111101111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111010000111000111110000000111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001110100001110001111100000001111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010111100011100000100100011111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000101111000111000001001000111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110001111110001110000110001001111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010011000011100000000110011111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000100110000111000000001100111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110001101100001110000100000101111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100011111100011100000100001011111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000101011000101000001001010111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001110110001010000110001101111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011101100010100001100011011111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000100010000101000000001110111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001100100001010000100010011111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011001000010100001000000111111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000101101000110000001001001111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100001011010001100000010010011111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011110100011000001100010111111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000100100000110000000001101111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100001001000001100000000011011111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011010000011000001000001111111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000110100000110000010000011111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001010010001000000010010111111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011100100010000001100011111111000011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000111001000100000011000111111110000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001000000001000000000011111111100001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000010000000010000001000100001100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000110000000100000010000000000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001011111001111000010010000000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110010111110011110000100100000000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100111111100111100011000100000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001001101001111000000011000000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110010011010011110000000110000000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100110110100111100010000010000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001101101001111000100000100000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010101110010110000100101000000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100111011100101100011000110000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011001110111001011000110001100000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010001010010110000000111000000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100100010100101100000001010000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011001100101001011000100000010000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010110110011010000100100100000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100101101100110100001001001000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001111011001101000110001010000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010011010010011010000000010100000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100100100100110100000001101000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001101001001101000100000110000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011010010011010001000001100000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100101001100100100001001011000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001110011001001000110001110000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010011100110010010001100011100000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100100000100100100000001111000001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001000001001001000000011110000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010011000010010010001000000010000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010101111010111010001001000100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101011110101110100010010001000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011111101011101001100010010000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010110110010111010000000100100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101001100101110100000011001000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011011001011101001000001010000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010110110010111010010000010100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101010110101010100010010101000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011101101010101001100111010000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010111011010101010011000110100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101000100101010100000011101000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101010001001010101000000111010000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010110010010101010010000001100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101011010101100100010010011000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010110101011001000100100110000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010111101010110010011000101100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101111010101100100110001011000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010010001011001000000110110000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010110100010110010010000011100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101101000101100100100000111000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010100101010001000100101110000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010111001010100010011001111100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101110010101000100110001111000010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010000001010001000000111110000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010100000010100010000001111100001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101100000101000100100000000100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010111111011111000100100001000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110101111110111110001001000010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101111111101111100110001000100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011111111011111001100010001000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110100110110111110000001100010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101101101101111100100000100100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011011011011111001000001001000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110101011110101110001001010010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101010111101011100110011100100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111011101111010111001100011001000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110100010110101110000001110010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011101000101101011100000011100100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111011001011010111001000000101000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110111101110110110001001001010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101101011011101101100010010010100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011110111011011001100010101000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110111101110110110011000101010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101101001001101101100000011010100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011010011011011001000001101000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110110100110110110010000011010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101010011101001100010010110100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011010100111010011000100101101000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110111001110100110011000111010001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101000001101001100000011110100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011010000011010011000000111101000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110110000110100110010000000110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011111110001011010010000001100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110111100111100100100100011000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001111111001111001011000100110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011111110011110010110001001100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110011000111100100000110011000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001110110001111001010001010110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011101100011110010100000101100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110101100110100100100101011000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001101011001101001001001010110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010011110110011010010110001101100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110001000110100100000111011000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001100010001101001000001110110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010011100100011010010100000011100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111001000110100101000000111000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001101101001110001001001001110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011111010011100010110001011100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000111110100111000101100010111000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001100100001110001000001101110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011101000011100010100010111100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000111010000111000101000001111000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001101001001100001001001011110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000011010010011000010010010111100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111100100110000101100011111000100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001100000001100001000001111110001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000011000000011000010000011111100010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111000000110000101000000000100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001110000001100001010000000001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011011111011111010010010000010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111111110111110101100010000100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101111111101111101011000100001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011001101011111010000011000010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110110011010111110101000101000100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101110110101111101010000010001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011010111011011010010010100010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110110101110110110100100101000100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101111011101101101011000110001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011000101011011010000011100010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110110001010110110100000111000100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101110010101101101010000001001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011100101011011010100000010010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110110110111010100100100100100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101111101101110101011000101001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101011111011011101010110001010010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110010010111010100000110100100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101100100101110101000001101001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101011101001011101010100000110010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110100110110010100100101100100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101101001101100101001001011001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011110011011001010110001110010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010111000010110010100000011100100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101100000101100101000001111001001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011100001011001010100000001010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111000010110010101000000010100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011101111011111011001001000101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111111110111110110110001001010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101111111101111101101100010010100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011100110011111011000001100101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110111001100111110110000011001010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101111011001111101101000001010100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011101011011101011001001010101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111010110111010110010010101010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111101101110101101100011010100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011111011011101011011000110101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111000100111010110000011101010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111001001110101101000000110100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011110010011101011010000001101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111011010111100110010010011010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111110101111001101100110110100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011111101011110011011000101101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111001000111100110000011011010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001110010001111001100000110110100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011110100011110011010000011101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111010010111000110010010111010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110100101110001100100101110100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011111001011100011011000111101001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111110010111000110110001111010010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110000001110001100000111110100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011110000011100011010000000011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111100000111000110100000000110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110111111111111100100100001100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111101111111111111011001100011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111111111111111110110001000110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110011011111111100000110001100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111100110111111111000001100011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111101101111111110100000100110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110101111110111100100101001100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111101011111101111001001010011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111110111111011110110001100110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111111101111110111101100011001100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111100010111101111000001110011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111100101111011110100000010110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111111001011110111101000000101100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111101101111110111001001001011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111011011111101110010010010110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111110111111011101100010101100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111100100111110111000001101011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111001001111101110000011010110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111010011111011101000001101100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111111001111100111001000011011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111010011111001110010010110110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111100111110011101100011101100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111111001111100111011000111011001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111000001111001110000011110110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111000011110011101000000011100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111110000111100111010000000111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000011110000110001010010001110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000111100001100010100100011100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000011111000011000111000100111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000001100000110001000011001110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000011000001100010000110011100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000010110000011000110000010111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000111110000110001110000101110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000101100000100010100101011100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000011011000001000111000110111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000110110000010001110001101110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000001000000100010000111011100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000010010000001000110001001111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000100100000010001100000011110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000110100001000010100100111100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000001101000010000101001001111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000111010000100001110001011110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000010000001000010000110111100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000000100000010000100001101111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000101000000100001100000111110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001010000001000011000001111100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000001001000000000101001011111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000110010000000001110001111110010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001100100000000011100011111100100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000000000000000000100001111111001000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000000000000000001100010100111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001000000000000011000000000010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100001111100011100101001000000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000011111000111001010010000001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001111110001110011100010000010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100000110100011100100001100000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000001101000111001000011000001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001011010001110011000001000010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100010110100011100110000010000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011000010111000011001010010100001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110001101110000110011100011000010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100011011100001100111000110000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011000000101000011001000011100001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000001010000110010000111000010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100010010100001100110000001000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000011011000101001010010010001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000110110001010010100100100010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100011101100010100111000101000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000101001000101001000001010001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000010010001010010000110100010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100010100100010100110000011000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000101001000101001100000110001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010000100110000010010100101100010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100011001100000100111000111000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000110011000001001110001110001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010000000010000010010000111100010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100000000100000100100001111000101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000100001000001001100000001001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101000111101001101010100100010010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010001111010011010101001000100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100111110100110101110001001001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001111001001101011100010010010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010000110010011010100001100100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100101100100110101100000101001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001011001001101011000001010010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010001011010001010101001010100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010100110110100010101110011101001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101001101101000101011100011010010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010000010010001010100001110100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010100000100100010101000011101001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101001001001000101011000000110010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010001101010010010101001001100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100011010100100101010010011001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001110101001001011100010110010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010011101010010010111000101100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100001000100100101000011011001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001010001001001011000001110010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010010100010010010110000011100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000100010010100000101010010111001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001000100101000001011100111110010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010011001010000010111000111100101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000100000000100000101000011111001010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001000000001000001010000111110010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010010000010000010110000000010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111100011111100111101010010000101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000111111001111010100100001010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110011111110011110111000100010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100111111100111101110001000101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000011011001111010000110001010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110010110110011110110000010010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100101101100111101100000100101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111000101111000111010100101001010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110001011110001110101001110010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100110111100011101110001100101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111000001011000111010000111001010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110000010110001110100001110010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100100101100011101100000010101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011001110111001011010100000101010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110001101110010110101001001010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101100111011100101101110001010101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001110111001011011100010101010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110000100110010110100001101010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101100101001100101101100000110101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001010011001011011000001101010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110001001110000110101001011010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100010011100001101010010110101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011001100111000011011100011101010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110000000110000110100001111010101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100000001100001101000011110101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011001000011000011011000000011010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111011011010001101101000000110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010011110010110011010010001101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100101111100101100111100010011010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001011111001011001111000100110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010001100010110011000011001101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100101011000101100111000101011010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001010110001011001110000010110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010010010110010010011010010101101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100101100100100110100101011010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001011011001001001111000110110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010010000100010010011000011101101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100001000100100110000111011010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001010010001001001110000001110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010100100010010011100000011101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000100110100101000110100100111010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001011101001010001111000101110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010111010010100011110001011101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000100010000101000110000110111010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001000100001010001110001011110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010101000010100011100000111101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000100100100100000110100101111010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001001001001000001101001011110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010110010010000011110001111101010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000100000000100000110000111111010100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001000000001000001100001111110101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010100000010000011100000000011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101000000100000111000000000110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101001111101011101101001000001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010111111010111011110001000011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101111110101110111100010000110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101000110101011101100001100001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010001101010111011100010000011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101011010101110111000001000110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101001011101001101101001010001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010010111010011011010010100011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101101110100110111100011000110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101010010101001101100001110001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010000101010011011000011100011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101001010100110111000000100110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101010010101001101110000001001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010011011010101011010010010011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010101110110101010111100010100110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101011101101010101111000101001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010001001010101011000011010011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100010010101010110000110100110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101010100101010101110000011001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010010011010001011010010110011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100100110100010110100101100110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101011001101000101111000111001101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010100001010001011000001110011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100000010100010110000111100110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101010000101000101110000000101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010100001010001011100000001011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101100111101101101110100100010110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011011111011011011111001100101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110110111110110110111110001001011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101100011001101101110000110010110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011000110011011011100001100101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110110101100110110111100000101011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100101101100101110100101010110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011001011011001011101001010101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110110110110010111110001101011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101101101100101111100011010110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011000010011001011100001110101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110100100110010111100000011011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101001001100101111000000110110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011001101011010011101001001101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110111010110100111110011011011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101110101101001111100010110110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011000100011010011100001101101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110001000110100111000011011011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101010001101001111000001110110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011001001011000011101001011101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110010010110000111010010111011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101100101100001111100011110110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011011001011000011111000111101101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110000000110000111000011111011010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101000001100001111000000001110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011010000011000011110000000011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111110011111110111111010010000111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111100111111101111111100110001110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111011111111011111111000100011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111110001101110111111000011000111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100011011101111110000110001110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111010110111011111110000010011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110110111110011111010010100111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100101111100111110100101001110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111011011111001111111000110011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110110111110011111110001100111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100001011100111110000111001110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111010010111001111110000001011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110100101110011111100000010111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011100110111101011110100100101110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111001101111010111101001001011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110111011110101111110001010111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011100010011101011110000110101110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111000100111010111100001101011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110101001110101111100000110111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011101110111101011110100001101110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111001001111000111101001011011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001110110011110001111110001110111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101100111100011111100011101110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111000000111000111100001111011101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001110100001110001111100000001111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101000011100011111000000011110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000101111000111000001001000111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001011110001110000010010001111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100011111100011100001100010011110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000100110000111000000001100111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001001100001110000000011001111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100011011000011100001000001011110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000110110000111000010000010111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001010110001010000010010101111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011101100010100001100011011110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000111011000101000011000110111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001000100001010000000011101111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011001000010100001000100111110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000110010000101000010000001111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100001011010001100000010010011111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010110100011000000100100111110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000111101000110000011000101111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100001001000001100000000011011111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010010000011000000000110111110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000110100000110000010000011111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001101000001100000100000111111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000010100100010000000100101111110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000111001000100000011000111111101000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001110010001000000110001111111010001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000010000000010000000000111111110100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000100000000100000010001010111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001100000001000000100000000000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110010111110011110000100100000001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100101111100111100001001000000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001111111001111000110001000000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110010011010011110000000110000001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100100110100111100000001100000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001101101001111000100000100000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011011010011110001000001000001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100101011100101100001001010000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011001110111001011000110001100000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110011101110010110001100011000001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100100010100101100000001110000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001000101001011000000011100000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110011001010010110001000000100001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100101101100110100001001001000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001011011001101000010010010000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011110110011010001100010100001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100110100100110100000000101000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001001001001101000000011010000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011010010011010001000001100001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100110100100110100010000011000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001010011001001000010010110000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010011100110010010001100011100001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100111001100100100011000111000011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001000001001001000000011110000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010000010010010000000111100001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100110000100100100010000000100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101011110101110100010010001000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010111101011101000100100010001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010111111010111010011000100100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101111110101110100110001001000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010011001011101000000110010001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010110110010111010010000010100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101101100101110100100000101000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101010101101010101000100101010001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010111011010101010011001110100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101110110101010100110001101000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101010001001010101000000111010001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010100010010101010000001110100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101100100101010100100000011000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010110101011001000100100110001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010101101010110010001001001100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101111010101100100110001011000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011110101011001001100010110001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010100100010110010000001101100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101101000101100100100000111000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011010001011001001000001110001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010101001010100010001001011100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101010010101000100110011111000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011100101010001001100011110001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010100000010100010000001111100011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101000000101000100000011111000110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011000001010001001000000001001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110101111110111110001001000010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101011111101111100010010000100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011111111011111001100010001001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110111111110111110011000100010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101001101101111100000011000100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011011011011111001000001001001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110110110110111110010000010010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011101010111101011100010010100100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010101111010111000100101001001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110111011110101110011000110010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011101000101101011100000011100100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010001011010111000000111001001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110110010110101110010000001010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101111011101101100010000010100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010110111011011000100100101001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110111101110110110011000101010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101111011101101100110001010100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010010011011011000000110101001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110110100110110110010000011010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101101001101101100100000110100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011010100111010011000100101101001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110101001110100110001001011010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001101110011101001100110001110100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011010000011010011000000111101001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110100000110100110000001111010011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001101100001101001100100000001100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111101111010011101100000011001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001101111001111001001001000110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011111110011110010110001001100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111111100111100101100010011001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001100110001111001000001100110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011101100011110010100010101100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111011000111100101000001011001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001101011001101001001001010110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011010110011010010010010101100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111101100110100101100011011001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001100010001101001000001110110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011000100011010010000011101100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111001000110100101000000111001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001110010001101001010000001110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100011011010011100010010010011100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000111110100111000101100010111001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001111101001110001011000101110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100011001000011100010000011011100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000110010000111000101000101111001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001110100001110001010000011110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000011010010011000010010010111100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110100100110000100100101111001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001111001001100001011000111110011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000011000000011000010000011111100110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110000000110000100000111111001100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001110000001100001010000000001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011100000011000010100000000010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110110111110111110100100100000101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101111111101111101011000100001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011111111011111010110001000010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110110011010111110100000110000101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101100110101111101000001000001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011101101011111010100000100010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110110101110110110100100101000101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101101011101101101001001010001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011110111011011010110001100010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110111001010110110100000011000101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101100010101101101000001110001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011100101011011010100000010010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111001010110110101000000100101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101101101101110101001001001001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101011111011011101010110001010010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010111110110111010101100010100101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101100100101110101000001101001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011001001011101010000011010010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010111010010111010101000001100101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101101001101100101001001011001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011010011011001010010010110010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111100110110010101100011100101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101110000101100101000000111001011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011000001011001010000011110010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111000010110010101000000010101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101110000101100101010000000101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110111011110111110110010010001010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101111111101111101101100110010101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011111111011111011011000100101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110111001100111110110000011001010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110011001111101100000110010101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011110110011111011010000010101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111010110111010110010010101010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110101101110101100100101010101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011111011011101011011000110101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111110110111010110110001101010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110001001110101100000111010101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011110010011101011010000001101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111100100111010110100000011010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001110110101111001100100100110101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011101101011110011011001101101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111111010111100110110001011010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001110010001111001100000110110101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011100100011110011000001101101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111101000111100110100000111010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110100101110001100100101110101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011101001011100011001001011101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111110010111000110110001111010110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111100101110001101100011110101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011100000011100011000001111101011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111100000111000110100000000110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111000001110001101000000001101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111101111111111111001001000011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111011111111111110010011000110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111111111111111101100010001101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111100110111111111000001100011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111001101111111110000011000110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111011011111111101000001001101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111111011111101111001000010011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111010111111011110010010100110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111111101111110111101100011001101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111111011111101111011000110011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111000101111011110000011100110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111111001011110111101000000101101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111110010111101111010000001011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111011011111101110010010010110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110110111111011100100100101101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111111101111110111011000101011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111001001111101110000011010110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110010011111011100000110101101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111110100111110111010000011011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111111011111101110010000110110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011110100111110011100100101101101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111111001111100111011000111011011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111110011111001110110001110110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011110000011110011100000111101101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111110000111100111010001000111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111100001111001110100000001110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000111100001100010100100011101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000001111000011000101001000111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000111110000110001110001001110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000011000001100010000110011101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000000110000011000100001100111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000101100000110001100000101110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001011000001100011000001011101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000001011000001000101001010111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000110110000010001110001101110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001101100000100011100011011101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000000010000001000100001110111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000100100000010001100010011110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001001000000100011000000111101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000001101000010000101001001111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000011010000100001010010011110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001110100001000011100010111101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000000100000010000100001101111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000001000000100001000011011110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001010000001000011000001111101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000010100000010000110000011111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000010010000000001010010111110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001100100000000011100011111101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000011001000000000111000111111011000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000000000000000001000011111110110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000000000000000000011000101011101100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000010000000000000110000000000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000011111000111001010010000001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000111110001110010100100000011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100011111100011100111000100000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000101101000111001000011000001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000011010001110010000110000011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100010110100011100110000010000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000101101000111001100000100001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000101110000110010100101000011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100011011100001100111000110000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000110111000011001110001100001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000001010000110010000111000011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100000010100001100100001110000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000100101000011001100000010001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000110110001010010100100100011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100001101100010100101001001000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000111011000101001110001010001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010001010010001010010000010100011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100000100100010100100001101000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000101001000101001100000110001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001010010001010011000001100011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100001001100000100101001011000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000110011000001001110011110001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001100110000010011100011100011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100000000100000100100001111000111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000000001000001001000011110001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110000000000000001100000010011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010001001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010010011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001010011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010101001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111010011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111010011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010011001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100110011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110110011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000111001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101110011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111001110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111110011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111100111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000000101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100001011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010001011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000100101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001001011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011001011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011100101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000101011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010101011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011010101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001101011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101101011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111010111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111101011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100011011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001001101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110011011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101011011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001101101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111011011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000111011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010111011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001111011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011111011100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111110111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011111101110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000000111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010000011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010000111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110000111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101000111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111000111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000010011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100100111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110100111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000110011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101100111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001110011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011100111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111001111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000010111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010010111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001010111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010101011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011010111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000110111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010011011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110110111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110110111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101110111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111101111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111011110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111110111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000000111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100001111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110001111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000100111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001001111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011001111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000010111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000101111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010101111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011010111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001101111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011101111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111011111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100011111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010001111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100011111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110011111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101011111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001101111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111011111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100111111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110111111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000111111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001111111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011111111100011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111111111000110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111111110001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000000000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010000000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010000000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000100000000000000000000000000001000000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000001000000000000000000000000000010000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011000000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011100000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111000000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100100000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110100000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000110000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101100000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001110000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111100000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111000000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100010000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001001000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010010000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001010000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011010000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000110000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010011000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010110000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001110000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111110000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111100000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011111000001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111110000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010000100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100001000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110001000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000100100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101001000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111001000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000010100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000101000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010101000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000110100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001101000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011101000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111010000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011110100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000011000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010001100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010011000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011001100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101011000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010101100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101011000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011101100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111011000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100111000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001011100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110111000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000111100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101111000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001111100001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111111000010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111110000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000000010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000000100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001000001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001000010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010000100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001000100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010100010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011000100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011100010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000100100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010010010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010100100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000101001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011010010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110100100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000011001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010110010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101100100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111001000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001110010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111100100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000001010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100010100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001001010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110010100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001100101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000101010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101010100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001010101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001101010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011010100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001110101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000011010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000110100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000010110100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011011010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001110100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010111010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011110100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000111101000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011111010001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000001100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000000011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010000110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100001100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000100011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000011000110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110001100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000010011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000100110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000101001100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000110011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001100110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000111001100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000000001011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000010110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000100101100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001001011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001010110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000110101100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001101011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000000110110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000001101100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001011011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000001110110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000011101100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000000000000000000000000000000001111011000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000000000000000000000000000000010001110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000000000000000000000000000000000000011100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111111111111111111111001000111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111111111111111111110010001110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000111100001100010100010011100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000010110000011000110001100111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000101100000110001100011001110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000011000001100010000001011100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000000110000011000100000010111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000110110000010001110010101110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000101100000100010100011011100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000001011000001000101000110111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000100100000010001100011101110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100001001000000100010000101111100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000000010000001000100000001111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000111010000100001110010011110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001110100001000011100100111100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000001101000010000101000101111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000101000000100001100011011110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001010000001000011000110111100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000000100000010000100000011111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000001000000100001000000111110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001100100000000011100101111100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000001001000000000101000111111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000010010000000001010001111110001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000001000000000000011000111111100010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000010000000000000110001111111000100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000000000000000001000000000001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001111110001110011100100000010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100011111100011100111001000000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000011111000111001010001000001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110001011010001110011000010000010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100010110100011100110001100000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111000001101000111001000000100001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000011010001110010000001000010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100011011100001100111001010000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011000010111000011001010001100001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000101110000110010100011000010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100010010100001100110001110000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000100101000011001100011100001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000001010000110010000000100010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100011101100010100111001001000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000111011000101001110010010001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000110110001010010100010100010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100001100100010100111000101000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000101001000101001100011010001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010000010010001010010000001100010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100000100100010100100000011000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000110011000001001110010110001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010001100110000010010100111100010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100001001100000100101000111000100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001000100001000001001100011110001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001000010000010011000111100010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100000000100000100100000000100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100111110100110101110010001001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001111101001101011100100010010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010001111010011010101000100100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100011110100110101010001001001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001011001001101011000110010010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010000110010011010100000010100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100001100100110101000000101001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101001101101000101011100101010010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010011011010001010101001110100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010100010110100010101010001101001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101001001001000101011000111010010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010010010010001010110001110100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010100000100100010101000000011001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001001110101001001011100100110010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010011101010010010111001001100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100011010100100101010001011001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000110101001001010100010110010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010010100010010010110001101100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100100001000100100101000000111001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000010001001001010000001110010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010011001010000010111001011100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100110010100000101110011111001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001000100101000001010100011110010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010010000010000010110001111100100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100100000100000101100011111001001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001000000001000001010000000001010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110011111110011110111000000010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100111111100111101110010000101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000111111001111010100010001010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110001111110011110101000100010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100101101100111101100011000101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111000011011001111010000001001010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110000110110011110100000010010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100110111100011101110010100101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111001101111000111011100101001010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110001011110001110101000110010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011100100101100011101100011100101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111001001011000111011000111001010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110000010110001110100000001010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111100010011100011101110000010101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001110111001011011100100101010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110001101110010110101000101010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100011011100101101010001010101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011001010011001011011000110101010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110000100110010110100001011010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100001001100101101000000110101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011001100111000011011100101101010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110011001110000110111001011010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100010011100001101010001110101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011001000011000011011000111101010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110010000110000110110001111010100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001100000001100001101000000001101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011000000011000011010000000011010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001011111001011001111001000110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010011110010110011010001001101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100111100101100110100010011010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001010110001011001110001100110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110010101100010110011000010101101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100011000101100110000001011010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001011011001001001111001010110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010110110010010011110010101101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100101100100100110100011011010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001010010001001001110001110110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010100100010010011100011101101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100100001000100100110000000111010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001000010001001001100000001110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010111010010100011110010011101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000100110100101000110100010111010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001001101001010001101000101110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100010101000010100011100011011101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101010000101000111000100111010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001000100001010001100000011110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010110010010000011110010111101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101100100100000111100101111010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001001001001000001101000111110100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000010100000010000011100001111101001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101000000100000111000111111010010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001000000001000001100000000001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010000000010000011000000000011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101111110101110111100100000110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101001111101011101101000100001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010011111010111011010001000011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110101011010101110111000110000110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101010110101011101110001100001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010001101010111011000000100011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110101101110100110111100101000110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101011011101001101111001010001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010010111010011011010001100011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110100001010100110111000011000110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101010010101001101110001110001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011010000101010011011000000010011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100001010100110110000000100110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101011101101010101111001001001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101010011011010101011010001010011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100110110101010110100010100110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101010100101010101110001101001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010101001010101011100011010011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010100010010101010110000001100110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101011001101000101111001011001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010110011010001011110010110011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100100110100010110100011100110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101001001101000101101000111001100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010100001010001011100011110011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010100000010100010110000000010110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101000000101000101100000000101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110110111110110110111110010001011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101101111101101101110100110010110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011001111011011011101000100101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110110101100110110111100011001011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101011001101101111000110010110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011000110011011011100000010101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010110110110110010111110010101011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101101101100101111100101010110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011001011011001011101000110101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110010110110010111010001101011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101001001100101111000111010110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011000010011001011100000001101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110000100110010111000000011011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101110101101001111100100110110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011011101011010011111001101101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110011010110100111010001011011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001101010001101001111000110110110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011010100011010011110001101101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100110001000110100111000000111011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001101100101100001111100101110110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011011001011000011111001011101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110010010110000111010001111011001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100100101100001110100011110110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011010000011000011110001111101100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000110000000110000111000000000111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100000001100001110000000001110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111011111111011111111001000011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110111111110111111110010000111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100111111101111110100010001110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111010110111011111110001100011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110101101110111111100011000111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111100011011101111110000001001110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111001111111011111111000010011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110110111110011111110010100111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100101111100111110100011001110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111001011111001111101000110011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110100101110011111100011100111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111100001011100111110000000101110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111000010111001111100000001011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110111011110101111110010010111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101110111101011111100100101110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111001101111010111101000101011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101110101001110101111100011010111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101010011101011111000110101110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111000100111010111100000011011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110001001110101111000000110111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101100111100011111100101101110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111001001111000111101000111011100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110010011110001111010001110111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011101000011100011111000111101110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111010000111000111100001000111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110000001110001111000000001111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100011111100011100001100100011110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000111111000111000011001000111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001011110001110000010001001111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100011011000011100001000110011110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000110110000111000010001100111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110001001100001110000000000101111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010011000011100000000001011110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000111011000101000011001010111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001010110001010000010001101111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010101100010100000100011011110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000110010000101000010001110111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010001100100001010000000010111111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010001000010100000000000111110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000111101000110000011001001111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001111010001100000110010011111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010110100011000000100010111110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000110100000110000010001101111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001101000001100000100011011111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000010010000011000000000001111110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000100100000110000000000011111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001110010001000000110010111111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000010100100010000000100011111110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000101001000100000001000111111100100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000001100000001000000100011111111001001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011000000010000001000111111110010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000100000000100000000000000000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001111111001111000110010000000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011111110011110001100100000001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100101111100111100001000100000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111001001101001111000100001000000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011011010011110001000110000001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100100110100111100000000010000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001001101001111000000000100000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110011101110010110001100101000001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100101011100101100001000110000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001010111001011000010001100000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110011001010010110001000111000001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100110010100101100010001110000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001000101001011000000000010000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010011110110011010001100100100001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100111101100110100011001001000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001011011001101000010001010000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010110110011010000100010100001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100110100100110100010001101000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101001001001001101000000000110000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010010010011010000000001100001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100111001100100100011001011000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001001110011001001000010011110000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010100110010010000100011100001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100110000100100100010001111000010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001100001001001000100011110000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010010000010010010000000000010001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010111111010111010011001000100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101111110101110100110010001000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010111101011101000100010010001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010101111010111010001000100100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101101100101110100100011001000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101010011001011101000000001010001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010100110010111010000000010100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101110110101010100110010101000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101011101101010101000100111010001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010101011010101010001000110100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010101100100101010100100011101000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011001001010101001000111010001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001010100010010101010000000001100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100101111010101100100110010011000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011110101011001001100100110001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010101101010110010001000101100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101011010101100100010001011000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011010001011001001000110110001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010100100010110010000000011100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101001000101100100000000111000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011100101010001001100101110001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010111001010100010011001011100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101010010101000100010001111000101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001011000001010001001000111110001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010110000010100010010001111100010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000101000000101000100000000000100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111011111111011111001100000001001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110111111110111110011001000010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101011111101111100010001000100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010111111011111000100010001001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110110110110111110010001100010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111101001101101111100000000100100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010011011011111000000001001001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110111011110101110011001010010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101110111101011100110010100100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010101111010111000100011001001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110110010110101110010001110010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101100101101011100100011100100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111010001011010111000000000101001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111110101011110101110011000001010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101111011101101100110010010100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011010110111011011000100010101001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110101101110110110001000101010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101101101001101101100100011010100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011011010011011011000000101101001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110100100110110110000000011010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001101110011101001100110010110100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011100111010011001100101101001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110101001110100110001000111010010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001101100001101001100100011110100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011000011010011001000111101001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110100000110100110000000000110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101000001101001100000000001100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111111100111100101100100011001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001101111001111001001000100110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011011110011110010010001001100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100111011000111100101000110011001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001110110001111001000001010110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011001100011110010000000101100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111101100110100101100101011001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001111011001101001011001010110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011010110011010010010001101100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100111001000110100101000111011001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001110010001101001010001110110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010011000100011010010000000011100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110001000110100100000000111001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001111101001110001011001001110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100011011010011100010010001011100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110110100111000100100010111001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001110100001110001010001101110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011101000011100010100011011100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110010000111000100000001111001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001111001001100001011001011110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011110010011000010110010111100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110100100110000100100011111001010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001110000001100001010000111110010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011100000011000010100011111100101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000110000000110000100000000000101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001100000001100001000000000001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011111111011111010110010000010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110110111110111110100100010000101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101101111101111101001000100001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111011101101011111010100011000010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111011010111110101000110000101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101100110101111101000000010001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011110111011011010110010100010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111101110110110101100101000101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101101011101101101001000110001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011011000101011011010100001100010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111001010110110101000111000101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101100010101101101000000001001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011000101011011010000000010010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010111110110111010101100100100101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101101101101110101001001101001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011011011011101010010001010010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010111010010111010101000110100101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101110100101110101010001101001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011001001011101010000000110010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010111100110110010101100101100101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101111001101100101011001011001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011010011011001010010001110010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110100110110010100100011100101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101110000101100101010001111001010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001011000001011001010000000001010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110000010110010100000000010101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011111111011111011011001000101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110111111110111110110010011001010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110111101111101100100010010101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011110110011111011010001100101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111101100111110110100011001010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101110011001111101100000001010101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011111011011101011011001010101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111110110111010110110010101010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110101101110101100100011010101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011101011011101011001000110101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111100100111010110100011101010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101110001001110101100000000110101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011100010011101011000000001101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111111010111100110110010011010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111110101111001101100110110101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011101101011110011001000101101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100111101000111100110100011011010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111010001111001101000110110101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010011100100011110011000000011101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000111110010111000110110000111010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111100101110001101100101110101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011101001011100011001000111101010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111010010111000110010001111010101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001111000001110001101000111110101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011100000011100011000000000011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111000000111000110000000000110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111111111111111101100100001101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111111111111111111011001000011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111011111111111110010001000110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111111011011111111101000110001101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111110110111111111010001100011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111111001101111111110000000100110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111110111111111111101100001001101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111111011111101111011001010011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111010111111011110010001100110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110101111110111100100011001101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101111110010111101111010001110011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011111000101111011110000010010110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110001011110111100000000101101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111111101111110111011001001011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111111011111101110110010010110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110110111111011100100010101101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111110100111110111010001101011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111101001111101110100011010110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011110010011111011100000001101101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111100100111110111000000011011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111110011111001110110010110110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011110100111110011100100011101101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111101001111100111001000111011010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001111100001111001110100011110110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011111000011110011100000100011101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111100000111100111000000000111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000111110000110001110010001110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001111100001100011100100011101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000001111000011000101000100111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110000101100000110001100011001110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001011000001100011000110011101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000000110000011000100000010111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000001100000110001000000101110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001101100000100011100101011101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000001011000001000101000110111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000010110000010001010001101110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100001001000000100011000111011101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000010010000001000110001011111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000000100000010001000000011110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001110100001000011100100111101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000011101000010000111001001111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000011010000100001010001011110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000001010000001000011000110111101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000010100000010000110001101111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100000001000000100001000000111110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000010000001000010000001111101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000011001000000000111001011111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000000010010000000001010001111110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000100100000000010100011111101010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000010000000000000110001111111010100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000100000000000001100011111110101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000000000000000000010000000000011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100011111100011100111001000000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000111111000111001110010000001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000111110001110010100010000011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100000110100011100110000100000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111000101101000111001100011000001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110000011010001110010000001000011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011100000110100011100100000010000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000110111000011001110010100001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110000101110000110010100011000011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100001011100001100101000110000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011000100101000011001100011100001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110001001010000110011000111000011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001100000010100001100100000001000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101000111011000101001110010010001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001110110001010011100100100011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100001101100010100101000101000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000011011000101001010001010001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010001010010001010011000110100011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100000100100010100100000011000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101000001001000101001000000110001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001100110000010011100101100011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100011001100000100101001111000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000010011000001001010001110001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010001000010000010011000111100011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100100010000100000100110001111000110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001000000001000001001000000001001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101001111101001101011100100010011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010011111010011010111001000100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100011110100110101010001001001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101000111101001101010100010010011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111010010110010011010110001100100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110100001100100110101000000101001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101000011001001101010000001010011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010011011010001010111001010100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010100110110100010101110011101001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101000101101000101010100011010011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010010010010001010110001110100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010100100100100010101100011101001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101000001001000101010000000110011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010011101010010010111001001100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100100111010100100101110010011001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000110101001001010100010110011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010001101010010010101000101100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100100101000100100101100011011001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001000010001001001010000001110011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010010000100010010010100000011100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100110010100000101110010111001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001001100101000001011100101110011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010001001010000010101000111100110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000100100000100000101100011111001101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001001000001000001011000111110011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000010000000010000010100000000010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110100011111100111101110000000101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111001111111001111011100100001011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110001111110011110101000100010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111100011111100111101010001000101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111001011011001111011000110001011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110000110110011110100000010010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111100001101100111101000000100101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111001101111000111011100101001011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110011011110001110111001010010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011100010111100011101010001100101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111001001011000111011000111001011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101110010010110001110110001110010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011100000101100011101000000010101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111000001011000111010000000101011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110011101110010110111001001010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100011011100101101010001010101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011000110111001011010100010101011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110110010100110010110110001101010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101100101001100101101000010110101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011000010011001011010000001101011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110011001110000110111001011010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001100110011100001101110010110101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011000100111000011010100011101011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110010000110000110110001111010110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001100100001100001101100011110101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011000000011000011010000000011011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000110000000110000110100000000110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010111110010110011110010001101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100100111100101100110100010011011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001001111001011001101000100110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110010101100010110011100011001101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100101011000101100110000101011011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011001000110001011001100000010110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010110110010010011110010101101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100101101100100100111100101011011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001001011001001001101000110110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010010100100010010011100011101101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100101001000100100111000111011011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001000010001001001100000001110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010010000100010010011000000011101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101110100101000111100100111011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001001101001010001101000101110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010011010010100011010001011101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000101010000101000111000110111011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110001010100001010001110001101110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100010001000010100011000000111101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000101100100100000111100101111011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001011001001000001111001011110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010010010010000011010001111101101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000100000000100000111000011111011010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100001010000001000001110001111110110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000010000000010000011000000000011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000000100000000100000110000000000111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101011111101011101111001000001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111010011111010111011010001000011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100111110101110110100010000111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101010110101011101110001100001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111010101101010111011100011000011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110100011010101110110000001000111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101011011101001101111001010001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010110111010011011110010100011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100101110100110110100011000111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101001010101001101111000110001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011010100101010011011100011100011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110100001010100110110000000100111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001101000010101001101100000001001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010111011010101011110010010011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010101110110101010110100110100111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101001101101010101101000101001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101010101001010101011100011010011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011010101010010101010111000110100111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010101000100101010101100000011001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001010110011010001011110010110011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101100110100010111100101100111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101001001101000101101000111001110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010010011010001011010001110011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010101000010100010111000111100111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101000000101000101100000000101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001010000001010001011000000001011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101111101101101111100100010111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011011111011011011101001100101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110011110110110111010001001011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101101011001101101111000110010111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111011010110011011011110001100101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110110001100110110111000000101011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101101101101100101111100101010111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011011011011001011111001010101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110010110110010111010001101011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100101101100101110100011010111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101011010010011001011110001110101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010110000100110010111000000011011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000101100001001100101110000000110111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011011101011010011111001001101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110111010110100111110010011011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100110101101001110100010110111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011010100011010011110001101101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100110101000110100111100011011011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001100010001101001110000001110111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011011001011000011111000011101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110110010110000111110010111011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100100101100001110100011110111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011001001011000011101000111101110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000110100000110000111100011111011101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001100000001100001110000000001111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000011000000011000011100000000011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110111111110111111110010000111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111101111111101111111100100001111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111001111111011111101000100011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111110101101110111111100011000111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011111101011011101111111000110001111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111000110111011111100000010011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011110011111110111111110000100111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101101111100111111100101001111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111001011111001111101000110011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110010111110011111010001100111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111101001011100111111000111001111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111010010111001111100001001011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011110000101110011111000000010111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101110111101011111100100101111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111011101111010111111001001011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110011011110101111010001010111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011101010011101011111000110101111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110111010100111010111110001101011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101110001001110101111000000110111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001011100010011101011110000001101111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111011001111000111111001011011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110010011110001111010001110111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100100111100011110100011101111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100111010000111000111110001111011110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001110100001110001111000010101111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011100000011100011110000000011111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000111111000111000011001000111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110001111110001110000110010001111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010111100011100000100010011111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000110110000111000010001100111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110001101100001110000100011001111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100010011000011100000000001011111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011000100110000111000000000010111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001110110001010000110010101111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100010101100010100000100011011111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000101011000101000001000110111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010001100100001010000100011101111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010100011001000010100001000101011111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001000100010000101000000000001111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001111010001100000110010011111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011110100011000001100100111111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000101101000110000001000101111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100001101000001100000100001011111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000011010000011000001000110111111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000100100000110000000000011111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100001001000001100000000000111111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011100100010000001100101111111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000000101001000100000001000111111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001010010001000000010001111111101001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000011000000010000001000111111111010011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100000110000000100000010001111111110100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000001000000001000000000000000000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110011111110011110001100100000000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100111111100111100011001000000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001011111001111000010001000000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110010011010011110001000010000000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111100110110100111100010001100000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111001001101001111000000000100000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001110010011010011110000000001000000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100111011100101100011001010000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011001010111001011000010011100000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010101110010110000100011000000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101100110010100101100010001110000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011001100101001011000100011100000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110010001010010110000000000100000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110100111101100110100011001001000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001111011001101000110010010000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010110110011010000100010100000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100101101100110100001000101000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101001101001001101000100011010000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010010010010011010000000001100000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010100100100100110100000000011000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001110011001001000110010110000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010011100110010010000100111100000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100101001100100100001000111000001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001001100001001001000100011110000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010010011000010010010001000111100000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000100100000100100100000000000100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110101111110101110100110010001000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011111101011101001100100010000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010101111010111010001000100100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101011110101110100010001001000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101011011001011101001000110010000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011010100110010111010000000010100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110101001100101110100000000101000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011101101010101001100101010000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010111011010101010011001110100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101010110101010100010001101000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101011001001010101001000111010000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101010110010010101010010001110100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010101000100101010100000000011000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001011110101011001001100000110000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010111101010110010011001001100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101011010101100100010001011000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010110101011001000100010110000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010110100010110010010001101100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100101001000101100100000000111000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001001010010001011001000000001110000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010111001010100010011001011100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101110010101000100110010111000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010100101010001000100011110000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100010110000010100010010001111100001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000101100000101000100100011111000011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001010000001010001000000000001000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110010101111110101110011000000010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101111111101111100110010000100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010111111011111000100010001000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110101111110111110001000100010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111101101101101111100100011000100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111010011011011111000000001001000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011110100110110111110000000010010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101110111101011100110010100100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111011101111010111001100101001000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110101011110101110001000110010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011101100101101011100100011100100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010111011001011010111001000111001000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001110100010110101110000000001010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011101000101101011100000000010100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011110111011011001100100101000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110101101110110110001000101010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101101011011101101100010001010100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011011010011011011001000110101000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010110110100110110110000001011010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101101001001101101100000000110100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011100111010011001100101101000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110111001110100110011001011010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101010011101001100010001110100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011011000011010011001000111101000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100110110000110100110010001111010001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001101000001101001100000000001100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000011010000011010011000000000011000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001111111001111001011001000110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110011011110011110010010001001100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110111100111100100100010011000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111001110110001111001010001100110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110011101100011110010100010001100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100110011000111100100000001011000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001111011001101001011001010110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010011110110011010010110010101100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110101100110100100100011011000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101001110010001101001010001110110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010011100100011010010100011101100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100110001000110100100000000111000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001001100010001101001000000001110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011111010011100010110010011100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000110110100111000100100010111000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001101101001110001001000101110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100011101000011100010100011011100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011000111010000111000101000110111000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010001100100001110001000000011110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011110010011000010110010111100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111100100110000101100101111000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001101001001100001001000111110001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000011000000011000010100001111100011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010000111000000110000101000111111000110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000001100000001100001000000000001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000011000000011000010000000000010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111111110111110101100100000100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011101101111101111101001000100001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011011111011111010010001000010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011110111011010111110101000110000100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111101110110101111101010001100001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100111011001101011111010000000100010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010110111101110110110101100101000100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101111011101101101011001010001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011010111011011010010001100010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110110101110110110100100011000100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101101110010101101101010001110001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100011011000101011011010000000010010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000110110001010110110100000000100100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101111101101110101011001001001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101011111011011101010010011010010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110110110111010100100010100100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110101110100101110101010001101001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101011101001011101010100011010010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001010110010010111010100000001100100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100101111001101100101011001011001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011110011011001010110010110010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110100110110010100100011100100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101101001101100101001000111001001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101001011100001011001010100011110010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000010110000010110010100000000010100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000101100000101100101000000000101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111111110111110110110010001010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001101111111101111101100100110010100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011101111011111011001000100101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101110111101100111110110100011001010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011101111011001111101101000110010100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011011100110011111011000000010101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010111110110111010110110010101010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111101101110101101100101010100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011101011011101011001000110101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111010110111010110010001101010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010101111001001110101101000111010100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001011100010011101011000000001101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010111000100111010110000000011010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111110101111001101100100110100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011111101011110011011001001101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111011010111100110010001011010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011001111010001111001101000110110100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110011110100011110011010001101101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100100111001000111100110000000111010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010001110100101110001101100001110100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011111001011100011011001011101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111010010111000110010001111010011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110100101110001100100011110100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010100011110000011100011010001111101001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100000111000000111000110000000000110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000001110000001110001100000000001100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111111111111111111011001000011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111111111111111110110010000110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110111111111111100100010001100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111111110110111111111010001100011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101111111101101111111110100011000110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001111110011011111111100000001001100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010011111100110111111111000000010011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111110111111011110110010100110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111110101111110111100100011001100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111101011111101111001000110011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101011111100101111011110100011100110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000111111001011110111100000100101100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010001111100010111101111000000001011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111111011111101110110010010110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111110111111011101100100101100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111101101111110111001000101011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101101111101001111101110100011010110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011011111010011111011101000110101100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010111100100111110111000000011011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100101111001001111101110000000110110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111100111110011101100101101100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111101001111100111001000111011001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111010011111001110010001110110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001010011111000011110011101000111101100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010000111110000111100111000001010111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100001111000001111001110000000001110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001111100001100011100100011100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000011111000011000111001000111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000011110000110001010001001110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001011100001011000001100011000110011100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010111000010110000011000110001100111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100110000001100000110001000000101110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001100000011000001100010000001011100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000011011000001000111001010111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000100010000010110000010001010001101110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000101100000100010100011011100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010101000010010000001000110001110111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101010000100100000010001100011101110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001000100000001000000100010000000111100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000011101000010000111001001111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000111010000100001110010011110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000110100001000010100010111100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010110000010100000010000110000101111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101100000101000000100001100011011110011001100001000000000000000000011111110010000000000011010001011110001000000000100000010110001011000001001000001001000000010000001000010000001111100110011000010000000000000000000111111100100000000000110100010111100010000000001000000101100010110000010010000010010000000100000010000100000011111001100110000100000000000000000001111111001000000000001101000101111000100000000010000001011000101100000100100000101000000110010000000001110010111110011001100001 + 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111T1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 + + + + + + + + + + + + + + + + + + + + + + + + + + + +