cossin_table: fix build script usage
This commit is contained in:
parent
18ea94298b
commit
7fa4b76e4d
@ -1,3 +1,4 @@
|
|||||||
|
use std::env;
|
||||||
use std::f64::consts::PI;
|
use std::f64::consts::PI;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
@ -6,8 +7,10 @@ use std::path::Path;
|
|||||||
fn write_cossin_table() {
|
fn write_cossin_table() {
|
||||||
const DEPTH: usize = 7;
|
const DEPTH: usize = 7;
|
||||||
|
|
||||||
let mut file =
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||||
File::create(Path::new("src").join("cossin_table.rs")).unwrap();
|
let dest_path = Path::new(&out_dir).join("cossin_table.rs");
|
||||||
|
let mut file = File::create(dest_path).unwrap();
|
||||||
|
|
||||||
writeln!(file, "pub(crate) const COSSIN_DEPTH: usize = {};", DEPTH)
|
writeln!(file, "pub(crate) const COSSIN_DEPTH: usize = {};", DEPTH)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
write!(
|
write!(
|
||||||
|
@ -18,7 +18,6 @@ pub fn shift_round(x: i32, shift: usize) -> i32 {
|
|||||||
(x + (1 << (shift - 1))) >> shift
|
(x + (1 << (shift - 1))) >> shift
|
||||||
}
|
}
|
||||||
|
|
||||||
mod cossin_table;
|
|
||||||
pub mod iir;
|
pub mod iir;
|
||||||
pub mod lockin;
|
pub mod lockin;
|
||||||
pub mod pll;
|
pub mod pll;
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
use super::{
|
use super::Complex;
|
||||||
cossin_table::{COSSIN, COSSIN_DEPTH},
|
|
||||||
Complex,
|
|
||||||
};
|
|
||||||
use core::f64::consts::PI;
|
use core::f64::consts::PI;
|
||||||
|
|
||||||
|
include!(concat!(env!("OUT_DIR"), "/cossin_table.rs"));
|
||||||
|
|
||||||
/// Compute the cosine and sine of an angle.
|
/// Compute the cosine and sine of an angle.
|
||||||
/// This is ported from the MiSoC cossin core.
|
/// This is ported from the MiSoC cossin core.
|
||||||
/// (https://github.com/m-labs/misoc/blob/master/misoc/cores/cossin.py)
|
/// (https://github.com/m-labs/misoc/blob/master/misoc/cores/cossin.py)
|
||||||
|
Loading…
Reference in New Issue
Block a user