Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tclapp/aldec/alint/alint.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package require Tcl 8.5

namespace eval ::tclapp::aldec::alint {
# Allow Tcl to find tclIndex
variable home [file join [pwd] [file dirname [info script]]]
if {[lsearch -exact $::auto_path $home] == -1} {
lappend ::auto_path $home
}
}

package provide ::tclapp::aldec::alint 1.0
18 changes: 18 additions & 0 deletions tclapp/aldec/alint/app.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<catalog>
<apps>
<app>
<revision_history>Initial version</revision_history>
<name>alint</name>
<company>aldec</company>
<company_display>Aldec, Inc.</company_display>
<display>Alint Linter</display>
<procs>
<proc>
<name>convert_project</name>
<summary>Convert Vivado project to Alint</summary>
</proc>
</procs>
</app>
</apps>
</catalog>
44 changes: 44 additions & 0 deletions tclapp/aldec/alint/convert_project.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package require Vivado 1.2024.1

namespace eval ::tclapp::aldec::alint {
namespace export convert_project
}

proc ::tclapp::aldec::alint::convert_project {alint_path} {

# Summary: Convert Vivado project to Alint

# Argument Usage:
# alint_path: Path where Alint is located

# Return Value:

# Categories: xilinxtclstore, aldec, alint, convert

set alintcon $alint_path/bin/alintcon

if {![file exists $alintcon]} {
error "Required file $alintcon not found"
}

# Generate a script file for Alint
set alint_script_path [file tempfile]
set alint_script_file [open $alint_script_path w]
set alint_script {
convert.xpr.project {*}$argv
}
puts $alint_script_file $alint_script
close $alint_script_file

set project_dir [get_property DIRECTORY [current_project]]
set project_name [get_property NAME [current_project]]
set xpr_path [file join $project_dir $project_name.xpr]
if {![file exists $xpr_path]} {
error "Project file not found"
}

exec -- $alintcon \
-batch \
-do $alint_script_path $xpr_path \
>@stdout
}
18 changes: 18 additions & 0 deletions tclapp/aldec/alint/doc/legal.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright (c) 2025, Aldec, Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary 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.

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 COPYRIGHT HOLDER 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.


=================================================================================================
This file must be included in <app>/doc/legal.txt for all accepted contributions to the Xilinx Tcl Store.
All contributors must date and digitally sign once below in order to submit to the Xilinx Tcl Store
<YYYYMMDD Date>::<github id>::<Full Name>
=================================================================================================
20250627::cezdro::Cezary Drożak
11 changes: 11 additions & 0 deletions tclapp/aldec/alint/pkgIndex.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Tcl package index file, version 1.1
# This file is generated by the "pkg_mkIndex" command
# and sourced either when an application starts up or
# by a "package unknown" script. It invokes the
# "package ifneeded" command to set up package-related
# information so that packages will be loaded automatically
# in response to "package require" commands. When this
# script is sourced, the variable $dir must contain the
# full path name of this file's directory.

package ifneeded ::tclapp::aldec::alint 1.0 [list source [file join $dir alint.tcl]]
1 change: 1 addition & 0 deletions tclapp/aldec/alint/revision_history.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0 Initial version
9 changes: 9 additions & 0 deletions tclapp/aldec/alint/tclIndex
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tcl autoload index file, version 2.0
# This file is generated by the "auto_mkindex" command
# and sourced to set up indexing information for one or
# more commands. Typically each line is a command that
# sets an element in the auto_index array, where the
# element name is the name of a command and the value is
# a script that loads the command.

set auto_index(::tclapp::aldec::alint::convert_project) [list source [file join $dir convert_project.tcl]]
4 changes: 4 additions & 0 deletions tclapp/aldec/alint/tclstore.wpc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version:1
74636c73746f7265:6170705f696e7374616c6c5f636f756e743a3a616c696e74:31:74636c73746f72655c7573616765:00:00:
74636c73746f7265:6c696e745f66696c65735f636f756e74:32:74636c73746f72655c7573616765:00:00:
eof:729719586
38 changes: 38 additions & 0 deletions tclapp/aldec/alint/test/src/testbench.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
`timescale 1ns / 1ps
module testbench;

reg CLK = 0;
reg RST = 0;
reg [3:0] D;
wire [3:0] O;

UUT uut (
.CLK(CLK),
.RST(RST),
.D(D),
.O(O)
);

initial
forever CLK = #10 ~CLK;

initial
begin
RST = 1;
D = 0;
#100;
RST = 0;
#100;
D = 3;
#100;
D = 4;
#100;
D = 7;
#100;
D = 0;
$display("SIMULATION_FINISHED");
end



endmodule
16 changes: 16 additions & 0 deletions tclapp/aldec/alint/test/src/uut.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
`timescale 1ns / 1ps
module UUT(CLK,RST,D,O);

input CLK;
input RST;
input [3:0] D;
output [3:0] O;
reg [3:0] O;

always @(posedge CLK)
if (RST)
O <= 'b0;
else
O <= D;

endmodule
49 changes: 49 additions & 0 deletions tclapp/aldec/alint/test/test.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
set app_name {aldec::alint}

if {![info exists alint_path]} {
error "alint tests require \$alint_path variable to run"
}

set file_dir [file normalize [file dirname [info script]]]
puts "== Unit Test directory: $file_dir"

set ::env(XILINX_TCLAPP_REPO) [file normalize [file join $file_dir .. .. ..]]
puts "== Application directory: $::env(XILINX_TCLAPP_REPO)"
lappend auto_path $::env(XILINX_TCLAPP_REPO)

set list_installed_apps [::tclapp::list_apps]

# Uninstall the app if it is already installed
if {[lsearch -exact $list_installed_apps $app_name] != -1} {
::tclapp::unload_app $app_name
}

# Install the app and require the package
catch "package forget ::tclapp::${app_name}"
::tclapp::load_app $app_name
package require ::tclapp::${app_name}

set project_name "test_project"

# Prepare Vivado project
create_project -force -quiet $project_name ./$project_name
add_files -copy_to ./$project_name/sources -force -fileset sources_1 "$file_dir/src/uut.v"
add_files -copy_to ./$project_name/sources -force -fileset sim_1 "$file_dir/src/testbench.v"
update_compile_order -fileset sources_1
update_compile_order -fileset sim_1

::tclapp::${app_name}::convert_project $alint_path

if {[file exists ./$project_name/ALINT-PRO/$project_name.alintws]} {
puts "TEST_PASSED"
} else {
error "TEST_FAILED"
}

close_project
file delete -force ./$project_name

# Uninstall the app if it was not already installed when starting the script
if {[lsearch -exact $list_installed_apps $app_name] == -1} {
::tclapp::unload_app $app_name
}