📄 class.ptf
字号:
#:-:
#:-: file: class.ptf
#:-: date: 2003.01.13 09:14:04
#:-: generated by a perl script
#:-:
# ###############################################################
# class.ptf for cal_avalon_uart
#
# This PTF-file declares the Altera UART as an SOPC-Builder library
# component. This file should appear in a component-directory with several
# "companion" files and directories. If this component-directory is
# anywhere on the SOPC-Builder's library search-path, then the UART
# will be "discovered" as a library comonent and available for your
# use in systems.
#
# The UART-in-particular has a wizard which is defined by a section of
# this PTF-file (below), and a generator-program which happens to be
# built on the "Europa" object-library.
#
# ###############################################################
CLASS cal_avalon_uart
{
SDK_GENERATION
{
SDK_FILES 0
{
cpu_architecture = "always";
printf_txchar_routine = "nr_uart_txchar";
printf_rxchar_routine = "nr_uart_rxchar";
}
SDK_FILES 1
{
cpu_architecture = "nios";
c_structure_type = "np_uart *";
short_type = "uart";
c_header_file = "sdk/uart_struct.h";
asm_header_file = "sdk/uart_struct.s";
sdk_files_dir = "sdk";
}
SDK_FILES 2
{
cpu_architecture = "arm922t";
c_structure_type = "np_uart *";
short_type = "uart";
c_header_file = "sdk/uart_struct.h";
sdk_files_dir = "sdk_arm";
}
SDK_FILES 3
{
cpu_architecture = "arm922t";
toolchain = "gnu";
asm_header_file = "sdk/uart_struct.s";
}
}
ASSOCIATED_FILES
{
Add_Program = "default";
Edit_Program = "default";
Generator_Program = "em_uart.pl";
Software_Rebuild_Program = "em_uart.pl";
}
MODULE_DEFAULTS
{
class = "cal_avalon_uart";
class_version = "2.0";
SLAVE s1
{
SYSTEM_BUILDER_INFO
{
Bus_Type = "avalon";
Is_Printable_Device = "1";
Address_Alignment = "native";
Address_Width = "3";
Data_Width = "16";
Has_IRQ = "1";
Read_Wait_States = "1";
Write_Wait_States = "1";
}
}
SYSTEM_BUILDER_INFO
{
Instantiate_In_System_Module = "1";
Is_Enabled = "1";
}
SIMULATION
{
DISPLAY
{
SIGNAL a
{
name = " Bus Interface";
format = "Divider";
}
SIGNAL b
{
name = "chipselect";
}
SIGNAL c
{
name = "address";
radix = "hexadecimal";
}
SIGNAL d
{
name = "writedata";
radix = "hexadecimal";
}
SIGNAL e
{
name = "readdata";
radix = "hexadecimal";
}
SIGNAL f
{
name = " Internals";
format = "Divider";
}
SIGNAL g
{
name = "tx_ready";
}
SIGNAL h
{
name = "tx_data";
radix = "ascii";
}
SIGNAL i
{
name = "rx_char_ready";
}
SIGNAL j
{
name = "rx_data";
radix = "ascii";
}
}
INTERACTIVE_OUT log
{
enable = "0";
file = "_log_module.txt"; # suffix to $module_name in em_uart.pl
radix = "ascii";
signals = "temp,list";
exe = "perl -- tail-f.pl";
}
INTERACTIVE_IN drive
{
enable = "0"; # file descriptors are really just suffixes used by perl...
file = "_input_data_stream.dat";
mutex = "_input_data_mutex.dat";
log = "_in.log";
rate = "100";
signals = "temp,list";
exe = "perl -- uart.pl";
}
}
WIZARD_SCRIPT_ARGUMENTS
{
baud = "115200";
data_bits = "8";
fixed_baud = "1";
parity = "N";
stop_bits = "1";
use_cts_rts = "0";
use_eop_register = "0";
sim_true_baud = "0";
sim_char_stream = "";
use_fifo = "0";
fifo_size = "16";
fifo_export_used = "0";
export_irq="0";
}
}
USER_INTERFACE
{
USER_LABELS
{
name = "Cal UART (RS-232 serial port)";
technology = "Communication";
}
LINKS
{
LINK help
{
title="Data Sheet";
url="http://www.altera.com/literature/ds/ds_nios_uart.pdf";
}
}
WIZARD_UI default
{
CONTEXT
{
WSA = "WIZARD_SCRIPT_ARGUMENTS";
INI = "SIMULATION/INTERACTIVE_IN drive";
INO = "SIMULATION/INTERACTIVE_OUT log";
SBI = "SLAVE/SYSTEM_BUILDER_INFO";
}
DEBUG
{
}
title = "Cal's Avalon UART - {{ $MOD }}";
ACTION wizard_finish
{
$MOD/SYSTEM_BUILDER_INFO/View/Settings_Summary = "{{ $WSA/data_bits }}-bit UART with {{ $WSA/baud }} baud, <br>
{{ $WSA/stop_bits }} stop bits and {{ $WSA/parity }} parity";
}
PAGES main
{
PAGE 1
{
spacing = "10";
title = "Configuration";
GROUP baud
{
title = "Baud Rate";
spacing = "5";
align = "left";
COMBO rate
{
id="baud_rate";
title = "Baud Rate (bps): ";
editable = "1";
DATA
{
baud = "$";
}
ITEM
{
title = "115200";
}
ITEM
{
title = "57600";
}
ITEM
{
title = "38400";
}
ITEM
{
title = "31250";
}
# midi rate, actually useful
ITEM
{
title = "28800";
}
ITEM
{
title = "19200";
}
ITEM
{
title = "14400";
}
ITEM
{
title = "9600";
}
ITEM
{
title = "4800";
}
ITEM
{
title = "2400";
}
ITEM
{
title = "1200";
}
ITEM
{
title = "300";
}
}
TEXT
{
title = "Input Clock Frequency (MHz): {{ $SYS/clock_freq / 1E6 }}";
}
TEXT
{
divisor = "{{ (($SYS/clock_freq / $WSA/baud) + 0.5) }}";
divisor_bits = "{{ ceil(log2($divisor)); }}";
min_baud = "{{ ceil($SYS/clock_freq / 65535); }}";
baud_too_low = "{{ $divisor_bits > 16 }}";
actual = "{{ $SYS/clock_freq / int($divisor) }}";
b_error = "{{ 100 * ($actual - $WSA/baud) / $WSA/baud }}";
round_err = "{{ int($b_error * 100) / 100 }}";
too_small = "{{ $round_err == 0 }}";
show_err = "{{ if ($too_small) '<0.01'; else $round_err }}";
title = "Baud error: {{ $show_err }}%";
valid = "{{ $b_error < 3.0 }}";
valid2 = "{{ $divisor_bits <= 16 }}";
foreground = "{{ if ($valid) 'black'; else 'red'; }}"; # if the following assignment is 'error' the user will be prevented from
# creating such a UART.
warning = "{{ if (!$valid) 'Baud error too large, UART may not function.'; }}";
error_msg = "Baud rate too low; must be >= {{ $min_baud }} baud";
error = "{{ if (!$valid2) $error_msg; }}";
}
GROUP
{
height = "5";
width = "1";
}
# GROUP changeable
# {
# layout = "horizontal";
# spacing = "0";
CHECK opt
{
id="baud_rw";
title=" Baud rate can be changed by software<br> (divisor register is writeable)";
DATA
{
fixed_baud = "!$";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -