GithubHelp home page GithubHelp logo

chiefdome / clash-demo-digitalclock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mgajda/clash-demo-digitalclock

0.0 2.0 0.0 140 KB

Simple demo of CLaSH: digital stopwatch on Papillio 250K

License: Other

Haskell 79.38% VHDL 20.62%

clash-demo-digitalclock's Introduction

StopWatch

This is a simple demo of CLaSH tool for Haskell compilation to .vhdl.

Uses one algebraic datatype, and two types of counters as Mealy machines.

Displays seconds since reset on a seven segment display.

Important files:

  • DigitalClock.hs - contains Haskell code.

  • TopEntity.vhd - contains wrapper that translates signal names in VHDL generated from Haskell to Papillio LogicStart pin codes.

  • constraints.ucf - maps descriptive pin codes to FPGA's pin numbers.

  • SevenSeg.xise and SevenSeg.gise - Xilinx ISE project.

Recompilation

Not all steps are automated yet, so you may need to do few steps to get it on your Papillio:

  1. For simulation just compile it with clash as a Haskell program, and run.

  2. For VHDL generation:

    • run interpreter: clash --interactive DigitalClock.hs
    • enter :vhdl in the interpreter to generate .vhdl code
  3. Refresh Xilinx ISE project by:

    • removing all previously generated .vhdl files: rm -rf xst/ DigitalClock/*.vhdl
    • clicking on ISE - it will ask you to remove files from the project, mark checkbox yes.
    • copy new VHDL files: cp -r vhdl/DigitalClock/*.vhdl DigitalClock/
    • re-add these files as source files in Xilinx ISE (right click within project window)
  4. Recompile Xilinx ISE project and generate new bitcode file SevenSeg.bit.

    • If there are any errors, compare type of recordish in TopEntity.vhd wrapper file, and generated DigitalClock/topEntity_0.vhdl file. Modify the name of the datatype accordingly in two selectors just below.
    • Make sure the toolchain follows all the steps until generation of code for the target device. (Note that for a different device you may just provide different constraints.ucf file to ISE, since this file maps VHDL signal names to FPGA pins.)
  5. Upload the bitcode onto your FPGA device: papillio-prog -f SevenSeg.bit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.