Lib4U

‎"Behind every stack of books there is a flood of knowledge."

VHDL modules

15734_110029599955_386330_a

This page is to be used for link on useful VHDL module, documentation, code and how to use them. (Canevas Modules)

Contents

[hide]

[edit]

Avalon and SOPC Builder

When they use the Avalon bus, they need to be integrated with SOPC Builder software from Altera. It is quite easy to implement a full embedded system based on a processor (as NIOSII) and specific programmable interface. SOPC Builder is a tool how automatically generate all the Avalon bus module from the information provided by the modules themselves and the Avalon rules.

The module generated by SOPC Builder is then used on QuartusII to create the FPGA system by adding external components and pins connections.

 

[edit]

Programmable interfaces

Programmables interfaces are modules using the Avalon bus Memory Mapped interface and/or Streaming interface. They can be Avalon slave (AS) or Avalon Master/Avalon Slave (AM).

[edit]

Parallel Port PIOSCN(AS)


Author: R.Beuchat, EPFL/IC/LAP & HESSO/hepia/LSN

© 2008

This file is free to be copied and used by anyone

No guarantee is provide to its reliability

[edit]

Behavior

Avalon Slave module for a programmable Parallel Port, where each bit of the 8 bits port can be specified as:

  • Input or Output with a Data direction Register, ‘0’ –> Input (default at Reset), ‘1’ –> Output
  • A Write access to data register provide the value to Output if the direction is Output, in all case the value is memorized,and if the port was specified as input then output when the write was done, a change to the direction will output the last memorized value.
  • A register where each bit write as ‘1’ will provide a ‘1’ in output bit, a ‘0’ does not change the value. Function Set.
  • A register where each bit write as ‘1’ will provide a ‘0’ in output bit, a ‘0’ does not change the value. Function Clear.
  • A register where each bit write as ‘1’ will toggle (invert) the output bit. Function Not.
  • The state at the pin level can be read.
  • The memorized output value can be read.
[edit]

Register’s mapping

  • Avalon slave bus programmable interface
  • PIO parallel Port with Set, Clear and Not functions
  • Direction of each bit programmable in the Direction register
    • 0: Input (reset initialisation)
    • 1: Output
PIOSCN register’s Mapping
Address Function Write Read
0 Data Port Register Output Data internal Port Register
1 Set Access ‘1’ –> set ‘1’,’0′ –> don’t change bit external PIO
2 Clear Access ‘1’ –> clr ‘0’,’0′ –> don’t change bit external PIO
3 Not Access (Toggle) ‘1’ –> not,’0′ –> don’t change bit external PIO
4 Direction Register ‘1’ –> OUT,’0′ –> IN (default) direction
5 0
6 0
7 0

In reading the address 0, the interface provide alway the internal value of the register, even if the port is in Output. In reading, the read back value is the written value

In reading address 1, 2, 3, we always read the external port value, thus if we don not have short circuit, we read the written valu in output mode, and the external input in input mode

The direction register has to be initialized before use of the port if we need output utilisation Writing a ‘1’ to the corresponding bit put it in OUTPUT direction, a ‘0’ in INPUT

Register at address 5, 6, 7 are for future use.

[edit]

Avalon Model

  • Avalon used with generic width (8 by default)
  • Use the Native Avalon slave implementation (Register mode)
    • 0 wait in write access
    • 1 wait in read access
[edit]

Access to registers

As the access is done in Native mode, the :

  • IORD()
  • IOWR()

macro needs to be used in NIOS IDE. This was the preferred model until version 7.2 of Quartus/SOPC Builder.

If the design is implemented in Dynamic access, the IORD8(), IORD16() or IORD32() have to be used for reading and IOWR8(), IOWR16() or IOWR32() for writing. This access is recommended from version 8.0 of Quartus/SOPC Builder.

[edit]

VHDL code

You have to unzip the PIOSCN.zip in a directory in your Altera Quartus own library directory.

This directory needs to be available to Quartus II and specifically SOPC Builder

(Tools –> Options –> IP Search Path, Add if necessary the Path library).

[edit]

C code example

[edit]

i2c (AS)


To do


Author:

This file is free to be copied and used by anyone

No guarantee is provide to its reliability

[edit]

Behavior

[edit]

Register’s mapping

[edit]

Avalon Model

[edit]

Access to registers

[edit]

VHDL code

[edit]

Ethernet interface (AS)


To do

 

[edit]

FX2 interface (AS)


To do

[edit]

VHDL code

[edit]

PWM (AS)


To do

[edit]

LCD controller (AM)


HITACHI TX07D09VM1CAB with touch screen [HITACHI LCD.zip]

[edit]

Camera interface (AM)


[edit]

Extension instructions

Extension instructions are instruction to be added has NIOSII added instructions to the processor core.

[edit]

Independent modules

VHDL code without NIOSII, Avalon bus connection. Useful code or demonstration.

[edit]

SDRAM Controller

Basic SDRAM controller with a pipelined Avalon interface. Frequency is fixed at 120MHz. Adapt counter values if you change the frequency as speciefied in the SDRAM datasheet.Media:Fpga4u_sdram_controller.vhd Media:Fpga4u_sdram_controller_hw.tcl

Source:

http://fpga4u.epfl.ch/wiki/VHDL_modules

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Virtual Fashion Technology

Virtual Fashion Education

toitocuaanhem

"chúng tôi chỉ là tôi tớ của anh em, vì Đức Kitô" (2Cr 4,5b)

VentureBeat

News About Tech, Money and Innovation

digitalerr0r

Modern art using the GPU

Theme Showcase

Find the perfect theme for your blog.

lsuvietnam

Learn to Learn

Gocomay's Blog

Con tằm đến thác vẫn còn vương tơ

Toán cho Vật lý

Khoa Vật lý, Đại học Sư phạm Tp.HCM - ĐT :(08)-38352020 - 109

Maths 4 Physics & more...

Blog Toán Cao Cấp (M4Ps)

Bucket List Publications

Indulge- Travel, Adventure, & New Experiences

Lib4U

‎"Behind every stack of books there is a flood of knowledge."

The WordPress.com Blog

The latest news on WordPress.com and the WordPress community.

%d bloggers like this: