Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)Igalia
By Andy Wingo.
With the new compiler and virtual machine in Guile 2.2, Guile hackers need to update their mental performance models. This talk will give a bit of a state of the union of Guile performance, with an updated overview of the cost of various kinds of abstractions. Sometimes abstraction is free!
(c) 2016 FOSDEM VZW
CC BY 2.0 BE
https://archive.fosdem.org/2016/
Introduction to Lisp. A survey of lisp's history, current incarnations and advanced features such as list comprehensions, macros and domain-specific-language [DSL] support.
Optimizing with persistent data structures (LLVM Cauldron 2016)Igalia
By Andy Wingo.
Is there life beyond phi variables and basic blocks? Andy will report on his experience using a new intermediate representation for compiler middle-ends, "CPS soup". The CPS soup language represents programs using Clojure-inspired maps, allowing optimizations to be neatly expressed as functions from one graph to another. Using these persistent data structures also means that the source program doesn't change while the residual program is being created, eliminating one class of problems that the optimizer writer has to keep in mind. Together we will look at some example transformations from an expressiveness as well as a performance point of view, and we will also cover some advantages which a traditional SSA graph maintains over CPS soup.
Knit, Chisel, Hack: Building Programs in Guile Scheme (Strange Loop 2016)Igalia
By Andy Wingo.
This talk makes the case that Guile is a delightful medium for making crafty programs, from the most ephemeral scripts to long-lived systems that you can rely on for years. Guile takes the elegant Scheme programming language, integrates it with the POSIX environments that you know and loathe and love, and wraps it all up in a responsive, hackable environment that nurtures programs from the small up to the large. Guile hacker will give you a gentle introduction to the language as they lead you through the process of building cool stuff in Scheme. With all this going for it, maybe you will choose to make your next program in Guile!
(c) Strange Loop 2016
http://www.thestrangeloop.com/2016/sessions.html
Invented by John McCarthy (1958)
Two simple data structure (atoms and lists)
Heavy use of recursion
Interpretive language
Variations
Scheme
Common Lisp (de facto industrial standard)
Most widely used AI programming language
Functional Programming Paradigm
Low maintenance overhead
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...Frank Nielsen
These are the slides accompanying the textbook:
A Concise and Practical Introduction to Programming Algorithms in Java
by Frank Nielsen
Published by Springer-Verlag (2009), Undergraduate textbook in computer science (UTiCS series)
ISBN: 978-1-84882-338-9
http://www.lix.polytechnique.fr/~nielsen/JavaProgramming/
http://link.springer.com/book/10.1007%2F978-1-84882-339-6
Good news, everybody! Guile 2.2 performance notes (FOSDEM 2016)Igalia
By Andy Wingo.
With the new compiler and virtual machine in Guile 2.2, Guile hackers need to update their mental performance models. This talk will give a bit of a state of the union of Guile performance, with an updated overview of the cost of various kinds of abstractions. Sometimes abstraction is free!
(c) 2016 FOSDEM VZW
CC BY 2.0 BE
https://archive.fosdem.org/2016/
Introduction to Lisp. A survey of lisp's history, current incarnations and advanced features such as list comprehensions, macros and domain-specific-language [DSL] support.
Optimizing with persistent data structures (LLVM Cauldron 2016)Igalia
By Andy Wingo.
Is there life beyond phi variables and basic blocks? Andy will report on his experience using a new intermediate representation for compiler middle-ends, "CPS soup". The CPS soup language represents programs using Clojure-inspired maps, allowing optimizations to be neatly expressed as functions from one graph to another. Using these persistent data structures also means that the source program doesn't change while the residual program is being created, eliminating one class of problems that the optimizer writer has to keep in mind. Together we will look at some example transformations from an expressiveness as well as a performance point of view, and we will also cover some advantages which a traditional SSA graph maintains over CPS soup.
Knit, Chisel, Hack: Building Programs in Guile Scheme (Strange Loop 2016)Igalia
By Andy Wingo.
This talk makes the case that Guile is a delightful medium for making crafty programs, from the most ephemeral scripts to long-lived systems that you can rely on for years. Guile takes the elegant Scheme programming language, integrates it with the POSIX environments that you know and loathe and love, and wraps it all up in a responsive, hackable environment that nurtures programs from the small up to the large. Guile hacker will give you a gentle introduction to the language as they lead you through the process of building cool stuff in Scheme. With all this going for it, maybe you will choose to make your next program in Guile!
(c) Strange Loop 2016
http://www.thestrangeloop.com/2016/sessions.html
Invented by John McCarthy (1958)
Two simple data structure (atoms and lists)
Heavy use of recursion
Interpretive language
Variations
Scheme
Common Lisp (de facto industrial standard)
Most widely used AI programming language
Functional Programming Paradigm
Low maintenance overhead
(chapter 7) A Concise and Practical Introduction to Programming Algorithms in...Frank Nielsen
These are the slides accompanying the textbook:
A Concise and Practical Introduction to Programming Algorithms in Java
by Frank Nielsen
Published by Springer-Verlag (2009), Undergraduate textbook in computer science (UTiCS series)
ISBN: 978-1-84882-338-9
http://www.lix.polytechnique.fr/~nielsen/JavaProgramming/
http://link.springer.com/book/10.1007%2F978-1-84882-339-6
Instruction sets picc done by Priyanga KRPriyangaKR1
Complete set: 35 instructions.
MC Architecture: RISC microcontroller.
Instruction Types:
1. Data Processing Operations:
– Copy data between registers.
– Manipulate data in a single register.
2. Arithmetic and Logic operations:
3. Bit Operation:
4. Program Sequence Control Operations:
– Unconditional Jump.
– Conditional Jump.
– Call.
– Control.
LISP, an acronym for list processing, is a programming language that was designed for easy manipulation of data strings. It is a commonly used language for artificial intelligence (AI) programming.
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDAAshish Duggal
Push Down Automata (PDA) is part of TOC (Theory of Computation)
From this presentation you will get all the information related to PDA also it will help you to easily understand this topic. There is also one example.
This PPT is very helpful for Computer science and Computer Engineer
(B.C.A., M.C.A., B.TECH. , M.TECH.)
An introduction to SLIME, the Superior Lisp Interaction Mode for Emacs.
This talk was given at ILUGD, March 2009 meeting at JNU, New Delhi.
The same talk was given a week later at OSSCamp, held at IIT Delhi on March 29.
Computer Organization1
CS1400
Feng Jiang
Boolean algebra
• Reading 2.5 P57-P65
• Axioms and Theorems
• Theorems required P57 P58 T1- T3
• Could derive T6 T7 T8
• De Morgan’s theorems and T9 T10
Boolean algebra
Boolean algebra
Digital Logic Fundamentals
Z = X+Y Z =
——
Z = Z = X + Y—
—
NOT all variables
Change & to | and | to &
NOT the result
De Morgan's
theorems
X�Y
X�Y
Boolean algebra
Boolean algebra
T8 T3
Duality
P59
• Review
• Boolean algebra
• Exercise Examples (a)-(e) P61
Day 5
Boolean algebra
• Exercise
• P61
• Homework(no submission)
• P98-100 2.1 -2.12, 2.14
Boolean algebra
Boolean algebra
Boolean algebra
Less terms is preferred
Less variables in one term is preferred
“Big not” should be simplified
Boolean algebra
De Morgan’s theorems
Complement
Sum of products <> product of sums
Boolean algebra De Morgan’s theorems
Boolean algebra De Morgan’s theorems
Boolean algebra
De Morgan’s theorems
Complement
Sum of products <> product of sums
• Review
• Boolean algebra
• Exercise Examples (a)-(e) P61
Day 5
• Start
• K-map
• Review Boolean algebra
• (Application of De Morgan’s and Exercise 2 )
• Read
• Applications of combinational logic
Day 6
• Review: Axioms and Theorems, solution manual, link,
reference
• Karnaugh Map
• Review Boolean algebra (Exercise 2)
• (Application of De Morgan’s and Exercise 2 )
• Reading for next class
• Applications of combinational logic
• Multiplexer ? Adder ? Decoder?
Day 6
• A two-dimensional tool of the truth table
• Could be used to simplify Boolean
expressions
• Review “truth table” & “minterm”
• 2^n lines vs. 2^n cells
Karnaugh Map (K-Map)
KarnaughMaps
Karnaugh Maps
Karnaugh Maps, how to plot
By truth table
By Boolean expression
F= A’D+A’BCD+ACD’
Karnaugh Maps, how to plot
Examples:
Karnaugh Maps, how to plot
Examples:
F= B+A’C
F= AB’C +BC
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Larger group >> less variables in one term
Karnaugh Maps, to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Larger group >> less variables in one term
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
F=A’B’ + A’BCD+ACD
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
For a four-variable K-map
Karnaugh Maps, to simplify
Map the terms
Group adjacent cells
• Start
• K-map
• Review Boolean algebra (announce quiz2)
• (Application of De Morgan’s and Exercise 2 )
• Read
• Applications of combinational logic
Day 6
Boolean algebra Applications of De Morgan’s theorems
Boolean algebra Ap.
Instruction sets picc done by Priyanga KRPriyangaKR1
Complete set: 35 instructions.
MC Architecture: RISC microcontroller.
Instruction Types:
1. Data Processing Operations:
– Copy data between registers.
– Manipulate data in a single register.
2. Arithmetic and Logic operations:
3. Bit Operation:
4. Program Sequence Control Operations:
– Unconditional Jump.
– Conditional Jump.
– Call.
– Control.
LISP, an acronym for list processing, is a programming language that was designed for easy manipulation of data strings. It is a commonly used language for artificial intelligence (AI) programming.
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDAAshish Duggal
Push Down Automata (PDA) is part of TOC (Theory of Computation)
From this presentation you will get all the information related to PDA also it will help you to easily understand this topic. There is also one example.
This PPT is very helpful for Computer science and Computer Engineer
(B.C.A., M.C.A., B.TECH. , M.TECH.)
An introduction to SLIME, the Superior Lisp Interaction Mode for Emacs.
This talk was given at ILUGD, March 2009 meeting at JNU, New Delhi.
The same talk was given a week later at OSSCamp, held at IIT Delhi on March 29.
Computer Organization1
CS1400
Feng Jiang
Boolean algebra
• Reading 2.5 P57-P65
• Axioms and Theorems
• Theorems required P57 P58 T1- T3
• Could derive T6 T7 T8
• De Morgan’s theorems and T9 T10
Boolean algebra
Boolean algebra
Digital Logic Fundamentals
Z = X+Y Z =
——
Z = Z = X + Y—
—
NOT all variables
Change & to | and | to &
NOT the result
De Morgan's
theorems
X�Y
X�Y
Boolean algebra
Boolean algebra
T8 T3
Duality
P59
• Review
• Boolean algebra
• Exercise Examples (a)-(e) P61
Day 5
Boolean algebra
• Exercise
• P61
• Homework(no submission)
• P98-100 2.1 -2.12, 2.14
Boolean algebra
Boolean algebra
Boolean algebra
Less terms is preferred
Less variables in one term is preferred
“Big not” should be simplified
Boolean algebra
De Morgan’s theorems
Complement
Sum of products <> product of sums
Boolean algebra De Morgan’s theorems
Boolean algebra De Morgan’s theorems
Boolean algebra
De Morgan’s theorems
Complement
Sum of products <> product of sums
• Review
• Boolean algebra
• Exercise Examples (a)-(e) P61
Day 5
• Start
• K-map
• Review Boolean algebra
• (Application of De Morgan’s and Exercise 2 )
• Read
• Applications of combinational logic
Day 6
• Review: Axioms and Theorems, solution manual, link,
reference
• Karnaugh Map
• Review Boolean algebra (Exercise 2)
• (Application of De Morgan’s and Exercise 2 )
• Reading for next class
• Applications of combinational logic
• Multiplexer ? Adder ? Decoder?
Day 6
• A two-dimensional tool of the truth table
• Could be used to simplify Boolean
expressions
• Review “truth table” & “minterm”
• 2^n lines vs. 2^n cells
Karnaugh Map (K-Map)
KarnaughMaps
Karnaugh Maps
Karnaugh Maps, how to plot
By truth table
By Boolean expression
F= A’D+A’BCD+ACD’
Karnaugh Maps, how to plot
Examples:
Karnaugh Maps, how to plot
Examples:
F= B+A’C
F= AB’C +BC
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Larger group >> less variables in one term
Karnaugh Maps, to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Larger group >> less variables in one term
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
F=A’B’ + A’BCD+ACD
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
Karnaugh Maps, how to simplify
Map the terms
Group adjacent cells
*NO diagonal adjacent
*torus shaped
For a four-variable K-map
Karnaugh Maps, to simplify
Map the terms
Group adjacent cells
• Start
• K-map
• Review Boolean algebra (announce quiz2)
• (Application of De Morgan’s and Exercise 2 )
• Read
• Applications of combinational logic
Day 6
Boolean algebra Applications of De Morgan’s theorems
Boolean algebra Ap.
Ast2Cfg - A Framework for CFG-Based Analysis and Visualisation of Ada ProgramsGneuromante canalada.org
Georg Kienesberger - Vienna University of Technology
FOSDEM’09
Free and Open Source Software Developers’ European Meeting
7-8 February 2009 - Brussels, Belgium
These slides are licensed under a Creative Commons Attribution-Share Alike 3.0 Austria License. http://creativecommons.org
ScalaDays 2013 Keynote Speech by Martin OderskyTypesafe
Scala gives you awesome expressive power, but how to make best use of it? In my talk I will discuss the question what makes good Scala style. We will start with syntax and continue with how to name things, how to mix objects and functions, where (and where not) to use mutable state, and when to use which design pattern. As most questions of style, the discussion will be quite subjective, and some of it might be controversial. I am looking forward to discuss these topics with the conference attendees.
R is a very popular platform for Data Science. Apache Spark is a highly scalable data platform. How could we have the best of both worlds? How could a Data Scientist leverage the rich 10000+ packages on CRAN, and integrate Spark into their existing Data Science toolset?
SparkR is a new language binding for Apache Spark and it is designed to be familiar to native R users. In this talk we will walkthrough many examples how several new features in Apache Spark 2.x will enable scalable machine learning on Big Data. In addition to talking about the R interface to the ML Pipeline model, we will explore how SparkR support running user code on large scale data in a distributed manner, and give examples on how that could be used to work with your favorite R packages. We will also discuss best practices around using this new feature. We will also look at exciting changes in and coming next in Apache Spark 2.x releases.
We describe an OCL-based internal DSL to define bridges between the CS and the AS of a language. Important topics such as name resolution and disambiguation are covered.
Stack is a collection based on the principle of adding elements and retrieving them in the opposite order
What is STACK?
Stack Operations
Applications
Built-in Stack
Downloadable Resources
Machine Learning with Apache Flink at Stockholm Machine Learning GroupTill Rohrmann
This presentation presents Apache Flink's approach to scalable machine learning: Composable machine learning pipelines, consisting of transformers and learners, and distributed linear algebra.
The presentation was held at the Machine Learning Stockholm group on the 23rd of March 2015.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdffxintegritypublishin
Advancements in technology unveil a myriad of electrical and electronic breakthroughs geared towards efficiently harnessing limited resources to meet human energy demands. The optimization of hybrid solar PV panels and pumped hydro energy supply systems plays a pivotal role in utilizing natural resources effectively. This initiative not only benefits humanity but also fosters environmental sustainability. The study investigated the design optimization of these hybrid systems, focusing on understanding solar radiation patterns, identifying geographical influences on solar radiation, formulating a mathematical model for system optimization, and determining the optimal configuration of PV panels and pumped hydro storage. Through a comparative analysis approach and eight weeks of data collection, the study addressed key research questions related to solar radiation patterns and optimal system design. The findings highlighted regions with heightened solar radiation levels, showcasing substantial potential for power generation and emphasizing the system's efficiency. Optimizing system design significantly boosted power generation, promoted renewable energy utilization, and enhanced energy storage capacity. The study underscored the benefits of optimizing hybrid solar PV panels and pumped hydro energy supply systems for sustainable energy usage. Optimizing the design of solar PV panels and pumped hydro energy supply systems as examined across diverse climatic conditions in a developing country, not only enhances power generation but also improves the integration of renewable energy sources and boosts energy storage capacities, particularly beneficial for less economically prosperous regions. Additionally, the study provides valuable insights for advancing energy research in economically viable areas. Recommendations included conducting site-specific assessments, utilizing advanced modeling tools, implementing regular maintenance protocols, and enhancing communication among system components.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
Welcome to WIPAC Monthly the magazine brought to you by the LinkedIn Group Water Industry Process Automation & Control.
In this month's edition, along with this month's industry news to celebrate the 13 years since the group was created we have articles including
A case study of the used of Advanced Process Control at the Wastewater Treatment works at Lleida in Spain
A look back on an article on smart wastewater networks in order to see how the industry has measured up in the interim around the adoption of Digital Transformation in the Water Industry.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
2. Overview
• What
is
CλaSH?
• The
CλaSH
compiler
pipeline
• Transforma5ons
• Structural
vs
Behavioural
• CλaSH
vs
Embedded
• Demo
• Conclusions
Slide
2
of
35
4. Hard
work,
LINT
tools,
test
benches,
staring
at
two
30”
screens
full
of
waveforms,
some
asser5ons
(SVA)
and
linear
logic
(PSL),
and
a
liSle
magic.
Slide
4
of
35
9. What
is
CλaSH?
• CAES
Language
for
Synchronous
Hardware
• A
compiler
that
views
Haskell
programs
as
structural
circuit
descrip5ons.
• Input:
(seman5c)
subset
of
Haskell
• Output:
Low-‐level
synthesisable
VHDL
Slide
9
of
35
10. Small
CλaSH
example
mac :: Signal (Signed 6)
-> Signal (Signed 6)
-> Signal (Signed 6)
mac x y = acc
where
acc = register 0 ((x * y) + acc)
Slide
10
of
35
11. Another
example
dotp :: Vec 4 (Signed 10)
-> Vec 4 (Signed 10)
-> Signed 10
dotp xs ys = foldl (+) 0 $ zipWith (*) xs ys
Slide
11
of
35
12. Compiler
Pipeline
• Use
GHC
API
to
convert
Haskell
to
GHC’s
Core
– Custom
set
of
op5miza5ons
enabled
– No
CorePrep
(Breaks
up
Integer
literals)
• Transform
to
CλaSH’s
Core
(no
coercions)
• Normalize
CλaSH
Core
• Convert
to
Netlist
datatype
– Includes
primi5ve
handling
• “PreSy”
print
VHDL
Slide
12
of
35
13. Core:
System
F’ish
+
letrec
+
case
data Term
= Var Type TmName -- ^ Variable reference
| Data DataCon -- ^ Datatype constructor
| Literal Literal -- ^ Literal
| Prim Text Type -- ^ Primitive
| Lam (Bind Id Term) -- ^ Term-abstraction
| TyLam (Bind TyVar Term) -- ^ Type-abstraction
| App Term Term -- ^ Application
| TyApp Term Type -- ^ Type-application
| Letrec (Bind (Rec [LetBinding]) Term) -- ^ Recursive let-binding
| Case Term Type [Bind Pat Term] -- ^ Case-expression
data Type
= VarTy Kind TyName -- ^ Type variable
| ConstTy ConstTy -- ^ Type constant
| ForAllTy (Bind TyVar Type) -- ^ Polymorphic Type
| AppTy Type Type -- ^ Type Application
| LitTy LitTy -- ^ Type literal
Slide
13
of
35
14. Structure:
an
“opera5onal”
seman5cs
Syntac'cal
element
• Func5on
applica5on
• Example:
f(g x)
Structure
• Component
instan5a5on
• Example:
x
g
f
Slide
14
of
35
15. Structure:
an
“opera5onal”
seman5cs
Syntac'cal
element
• Lamda-‐binder
• Example:
x y. x
Structure
• Input
port
• Example:
x
y
Slide
15
of
35
16. Structure:
an
“opera5onal”
seman5cs
Syntac'cal
element
• Case-‐statement
on
a
product
type,
or,
projec5on
• Example:
case z of (a,b) -> a
Structure
• Con5nue
with
one
of
the
wires,
basically
a
NOP
• Example:
a
b
Slide
16
of
35
17. Structure:
an
“opera5onal”
seman5cs
Syntac'c
element
• Case-‐statement
on
a
sum-‐
type.
• Example:
case z of
True -> a
False -> b
Structure
• Mul5plexer
of
the
alterna5ves,
with
the
subject
driving
the
selec5on
• Example:
z
a
b
Slide
17
of
35
18. Normal
form
• Only
lamba’s
at
outermost
posi5on
• Lambda’s
followed
by
a
single
letrec
• Let-‐bound
values
all
in
ANF
• Letrec
body
is
a
variable
reference
• Completely
monomorphic
and
first-‐order
Slide
18
of
35
19. Compila5on
example
Haskell
data Opc = Add | Mul
alu Add = (+)
alu Mul = (*)
Core
alu = ds ->
case ds of
Add -> (+)
Mul -> (*)
Slide
19
of
35
20. Compila5on
example
Core
alu = ds ->
case ds of
Add -> (+)
Mul -> (*)
Normalised
Core
alu = ds x y ->
let a = (+) x y
b = (∗) x y
r = case ds of
Add -> a
Mul -> b
in res
Slide
20
of
35
21. Transforma5ons
• Preserve
first-‐order
func5on
hierarchy
• Don’t
lose
sharing
=>
larger
circuit
• Open
ques5on:
is
case-‐of-‐case
bad?
case (case e of {p1 -> a1 .. pN -> aN})
{q1 -> b1 .. qN -> bN}
=>
case e of {p1 -> case a1 of {q1 -> b1 .. qN -> bN}
…
pN -> case aN of {q1 -> b1 .. qN -> bN
}
•
Currently:
only
when
the
subject
is
higher-‐order
Slide
21
of
35
22. Primi5ve
templates
[ { "BlackBox" :
{ "name" : "CLaSH.Signal.Internal.register#”
, "templateD" :
"register_~SYM[0] : block
signal ~SYM[1] : ~TYP[2];
signal ~SYM[2] : ~TYP[1];
begin
~SYM[2] <= ~ARG[1];
process(~CLK[0],~RST[0],~SYM[2])
begin
if ~RST[0] = '0' then
~SYM[1] <= ~SYM[2];
elsif rising_edge(~CLK[0]) then
~SYM[1] <= ~ARG[2];
end if;
end process;
~RESULT <= ~SYM[1];
end block;"
}
}
]
Slide
22
of
35
23. Embedded
DSL
/
Lava
• Why
CλaSH
when
we
already
have
Lava?
• Building
parallel
circuits
in
Haskell
for
more
than
a
decade
• “Straighkorward”
to
implement:
– Don’t
have
to
deal
with
higher-‐order
func5ons
or
recursions
Slide
23
of
35
25. EDSL
vs
PaSern
Matching
• You
can
use
paSern
matching
as
part
of
a
func5ons
that
generates
a
circuit.
• But
you
cannot
use
paSern
matching
as
way
to
specify
the
behaviour
of
the
circuit.
Slide
25
of
35
26. EDSL
vs
PaSern
Matching
Not
observable
f :: Bool -> Signal Int8
-> Signal Int8
f True a = a + 1
f False a = a - 1
Invalid
pa:ern
f :: Signal Bool
-> Signal Int8
-> Signal Int8
f True a = a + 1
f False a = a - 1
Slide
26
of
35
27. PaSern
matching
in
CλaSH
Example
-- generate clk enable signal
if sclSync then do
cnt .= clkCnt
clkEn .= True
else if _slaveWait then do
clkEn .= False
else do
cnt -= 1
clkEn .= False
-- generate bus status controller
zoom busState (busStatusCtrl clkCnt cmd sdaChk
isdaOen _clkEn cState
i2ci)
Slide
27
of
35
28. PaSern
matching
in
CλaSH
Example
-- generate clk enable signal
if sclSync then do
cnt .= clkCnt
clkEn .= True
else if _slaveWait then do
clkEn .= False
else do
cnt -= 1
clkEn .= False
-- generate bus status controller
zoom busState (busStatusCtrl clkCnt cmd sdaChk
isdaOen _clkEn cState
i2ci)
Slide
28
of
35
30. What
isn’t
working
• GADT
paSern
matching
• Irreducible
recursive
func5ons
cannot
be
translated
• Compiler
is
“really”
slow
and
tends
to
eat
up
memory
(8gb
or
over
runs
happen)
– Efficient
code
as
an
aperthought
doesn’t
work
– Quadra5c
in
the
size
of
the
let-‐binding
• Finding
the
right
idiom
for
specifying
hardware
in
Haskell
Slide
30
of
35
31. Future
Work
• Inline
HO-‐func5ons
instead
of
specialisa5on
• Use
a
dependently-‐typed
core
to
support
e.g.
hardware
specifica5ons
using
Idris.
– How
to
merge
with
GHC’s
open
type
families?
• Get
my
ring-‐solver
in
good
shape
for
inclusion
in
GHC
7.10
• Make
the
compiler
faster:
– FlaSen
MTL
stack
– Be
more
efficient
with
binders
(perhaps
use
another
library)
– Make
term
type
a
triple
of:
(term,type,free
variables)
Slide
31
of
35
32. Conclusions
• GHC
API
enables
lots
of
fun
projects
and
isn’t
that
scary.
• Use
CλaSH
instead
of
Lava
when
you
care
about
paSern
matching.
• S5il
need
to
find
an
idioma5c
way
to
write
hardware
in
Haskell
• Stop
wri5ng
VHDL/Verilog,
use
Haskell;
CλaSH
will
do
the
rest.
Slide
32
of
35
34. Extensions
used
by
the
Prelude
other-extensions: DataKinds
DefaultSignatures
DeriveDataTypeable
FlexibleContexts
GADTs
GeneralizedNewtypeDeriving
KindSignatures
MagicHash
MultiParamTypeClasses
ScopedTypeVariables
StandaloneDeriving
TemplateHaskell
TupleSections
TypeFamilies
TypeOperators
UndecidableInstances
Slide
34
of
35
35. Disabled
GHC
Op5miza5ons
Name
Reason
Opt_SpecConstr
Creates
local
func5ons:
normal
form
does
not
have
them
Opt_DoEtaReduc5on
We
want
eta-‐expansion
Opt_Pedan5cBoSoms
Stops
eta-‐expansion
through
case-‐expressions
Slide
35
of
35