Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: azonenberg/openfpga
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 8a4cc7048640
Choose a base ref
...
head repository: azonenberg/openfpga
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 85c1d9a4158f
Choose a head ref

Commits on Jun 6, 2017

  1. xc2bit: Initial commit

    ArcaneNibble committed Jun 6, 2017
    Copy the full SHA
    eac55c8 View commit details
  2. Copy the full SHA
    7ab293d View commit details
  3. Copy the full SHA
    7a12381 View commit details
  4. Copy the full SHA
    fcf4820 View commit details
  5. Copy the full SHA
    69190f7 View commit details
  6. Copy the full SHA
    7333ae8 View commit details
  7. Copy the full SHA
    257c8ca View commit details
  8. Copy the full SHA
    83fd2b4 View commit details
  9. Copy the full SHA
    17b0d0c View commit details
  10. Copy the full SHA
    3a9242e View commit details
  11. Copy the full SHA
    f91b84a View commit details
  12. Copy the full SHA
    3619ea2 View commit details
  13. Copy the full SHA
    d39ad24 View commit details
  14. Copy the full SHA
    7d634cc View commit details
  15. Copy the full SHA
    955d1e6 View commit details
  16. Copy the full SHA
    7649887 View commit details
  17. Copy the full SHA
    4575838 View commit details
  18. Copy the full SHA
    e65ec71 View commit details
  19. xc2bit: Expose ZIA map

    ArcaneNibble committed Jun 6, 2017
    Copy the full SHA
    d02f09d View commit details
  20. Copy the full SHA
    c67b94a View commit details
  21. Copy the full SHA
    076e2c3 View commit details
  22. Copy the full SHA
    476582b View commit details

Commits on Jun 7, 2017

  1. Merge pull request #92 from rqou/xc2bit_only

    Merged xc2bit from rqou
    azonenberg authored Jun 7, 2017
    Copy the full SHA
    85c1d9a View commit details
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -8,3 +8,6 @@
/debian/gp4par-dbg/
/debian/gp4par-doc/
/obj-*/

# Because these are library crates, do not check in their Cargo.lock files
/src/xc2bit/Cargo.lock
18 changes: 18 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ include(GNUInstallDirs)
# Project configuration
set(YOSYS_COMMAND "yosys" CACHE STRING "Command used to run yosys")
set(IVERILOG_COMMAND "iverilog" CACHE STRING "Command used to run Icarus Verilog")
set(CARGO_COMMAND "cargo" CACHE STRING "Command used to run cargo")

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
@@ -88,6 +89,23 @@ endif()
# FORCE is required for the "asked for but missing tool" case
set(BUILD_TESTS ${BUILD_TESTS} CACHE BOOL "Build and run tests" FORCE)

find_program(CARGO ${CARGO_COMMAND})
if(DEFINED BUILD_RUST AND NOT BUILD_RUST)
message(STATUS "BUILD_RUST turned off, Rust code will not be built nor run")
elseif(DEFINED BUILD_RUST AND BUILD_RUST AND NOT CARGO)
message(WARNING "BUILD_RUST turned on but no cargo found, Rust code will not be built nor run")
set(BUILD_RUST OFF)
elseif(NOT DEFINED BUILD_RUST AND NOT CARGO)
message(WARNING "cargo not found, Rust code will not be built nor run")
set(BUILD_RUST OFF)
else()
message(STATUS "Rust enabled")
set(BUILD_RUST ON)
endif()

# FORCE is required for the "asked for but missing tool" case
set(BUILD_RUST ${BUILD_RUST} CACHE BOOL "Build and run Rust code" FORCE)

# Subdirectories
add_subdirectory(src)
if(BUILD_TESTS)
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -7,3 +7,9 @@ add_subdirectory(xbpar)
add_subdirectory(log)
add_subdirectory(gpcosim)
add_subdirectory(xptools)

if(BUILD_RUST)
add_custom_target(xc2bit ALL
${CMAKE_COMMAND} -E env CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}/xc2bit ${CARGO} build
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/xc2bit)
endif()
10 changes: 10 additions & 0 deletions src/xc2bit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "xc2bit"
version = "0.0.1"

[profile.release]
lto = true

[lib]
name = "xc2bit"
crate-type = ["rlib"]
33 changes: 33 additions & 0 deletions src/xc2bit/src/bin/xc2jedblank.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright (c) 2016-2017, Robert Ou <rqou@robertou.com> and contributors
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.
*/

extern crate xc2bit;
use xc2bit::*;

fn main() {
let bitstream = XC2Bitstream::blank_bitstream("XC2C32A", "6", "VQ44").expect("failed to create bitstream");

bitstream.write_jed(&mut ::std::io::stdout());
}
53 changes: 53 additions & 0 deletions src/xc2bit/src/bin/xc2jeddump.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
Copyright (c) 2016-2017, Robert Ou <rqou@robertou.com> and contributors
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.
*/

use std::fs::File;
use std::io::Read;

extern crate xc2bit;
use xc2bit::*;

fn main() {
let args = ::std::env::args().collect::<Vec<_>>();

if args.len() != 2 {
println!("Usage: {} file.jed", args[0]);
::std::process::exit(1);
}

// Read the entire file
let mut f = File::open(&args[1]).expect("failed to open file");
let mut data = Vec::new();
f.read_to_end(&mut data).expect("failed to read data");

let bits_result = read_jed(&data);
let (bits, device_name_option) = bits_result.expect("failed to read jed");
let device_name = device_name_option.expect("missing device name in jed");

let bitstream_result = process_jed(&bits, &device_name);
let bitstream = bitstream_result.expect("failed to process jed");

bitstream.dump_human_readable(&mut ::std::io::stdout());
}
53 changes: 53 additions & 0 deletions src/xc2bit/src/bin/xc2jedroundtrip.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
Copyright (c) 2016-2017, Robert Ou <rqou@robertou.com> and contributors
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.
*/

use std::fs::File;
use std::io::Read;

extern crate xc2bit;
use xc2bit::*;

fn main() {
let args = ::std::env::args().collect::<Vec<_>>();

if args.len() != 2 {
println!("Usage: {} file.jed", args[0]);
::std::process::exit(1);
}

// Read the entire file
let mut f = File::open(&args[1]).expect("failed to open file");
let mut data = Vec::new();
f.read_to_end(&mut data).expect("failed to read data");

let bits_result = read_jed(&data);
let (bits, device_name_option) = bits_result.expect("failed to read jed");
let device_name = device_name_option.expect("missing device name in jed");

let bitstream_result = process_jed(&bits, &device_name);
let bitstream = bitstream_result.expect("failed to process jed");

bitstream.write_jed(&mut ::std::io::stdout());
}
Loading