text stringlengths 59 71.4k |
|---|
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// (c) Copyright 1995-2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant an... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
`timescale 1 ns / 10 ps
module synth_reg_w_init (i, ce, clr, clk, o);
parameter width = 8;
parameter init_index = 0;
parameter [width-1 : 0] init_value = 'b0000;
parameter latency = 1;
input[width - 1:0] i;
input ce, clr, clk;
output[width - 1:0] o;
wire[(latency + 1) * width - 1:0] dl... |
(** * Rel: Properties of Relations *)
(* $Date: 2012-04-23 14:08:14 -0400 (Mon, 23 Apr 2012) $ *)
Require Export SfLib.
(** A (binary) _relation_ is just a parameterized proposition. As you know
from your undergraduate discrete math course, there are a lot of
ways of discussing and describing relations _in g... |
#include <bits/stdc++.h> using namespace std; const long long A = 31, mod = 1000000033LL; vector<string> read(int n) { vector<string> ans(n); for (auto &x : ans) cin >> x; return ans; } vector<long long> hsh(vector<string> vec, long long a) { vector<long long> ans; for (auto x : vec) { ... |
//Legal Notice: (C)2014 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> int debugnum = 0; using namespace std; const long long MOD = 998244353; inline long long add(long long a, long long b) { return (a + b) % MOD; } int toint(bitset<10> bs) { int ret = 0; for (int i = 9; i >= 0; i--) { ret = (ret << 1) | bs[i]; } return ret; } l... |
#include <bits/stdc++.h> bool map[21][21]; int i, j, k, n, m, lim, tot, l, t, c[1 << 10]; long long f[1 << 10][1 << 10], ans; int main() { scanf( %d%d%d , &n, &m, &lim); tot = 1 << n; memset(map, 0, sizeof(map)); memset(f, 0, sizeof(f)); for (i = 0; i < tot; i++) for (j = i, c[i] = 0; ... |
//------------------------------------------------------------------------------
// YF32 -- A small SOC implementation based on mlite (32-bit RISC CPU)
// @Taiwan
//------------------------------------------------------------------------------
//... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); if (arr[n - 1] < arr[n - 2] + arr[n - 3]) { cout << YES << endl; for (int i = 0; i < n - 2; i++) { cout <... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int main() { int A, B; scanf( %d%d , &A, &B); int S = A + B; long long K = 0; while ((K + 1) * (K + 2) / 2 <= S) ++K; vector<int> a, b; for (int i = (K + 1) - 1; i >= (1); --i) { if (i <= A) { a.pus... |
#include <bits/stdc++.h> using namespace std; int n, r[20], b[20]; char ch[20]; long long dp[(1 << 16)][260]; long long dfs(int bit, int discount) { long long& ret = dp[bit][discount]; if (ret != -1) return ret; if (bit == (1 << n) - 1) { return ret = 0; } ret = 0xffffffffffffff; ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long inf = 0x3f3f3f3f3f3f3f3f; const long long mod = 1e9 + 7; const int N = 2e5 + 10; int T; int n, m; int cnt[1000][2], mz[40][40]; int main() { scanf( %d , &T); while (T--) { scanf( %d%d , &n, &m); ... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// -------... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 3e+5; bool vis[MAX_N] = {0}; char t = . ; int main() { int n, m, ans = 0, cnt = 0; string str; cin >> n >> m >> str; for (int i = 0; i < n; i++) { if (str[i] == t) { ans++; if (i == 0 || str[i - 1] != t) cnt... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) #pragma GCC optimization( unroll-loops ) using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void naive(int x, int y) { if (x == y) { cout << Yes n ; return; }... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while (t--) { string s1; cin >> s1; int p1 = 0, p2 = 0, c1, c2; set<pair<pair<int, int>, pair<int, int> > > s; int c = 0;... |
`timescale 1ns/1ps
/***************************************************************************
Name:
Date: 7/18/2016
Founction: I2C top module
Note:
****************************************************************************/
module I2C_MASTER(clk,rst_n,sda,scl,RD_EN,WR_EN,receive_status,maddress_sel
);
input clk;
... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int AND = 0; const int OR = 1; const int NAND = 2; const int NOR = 3; const int N = 111; int n, m, k; string s; int a[N][3]; int b[N][3]; vector<int> g[N]; bool st[N]; int ord[N]; int ordSz; int col[N]; int C; bool used[N]; bool old... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int p, n; char arr[1002], brr[1002]; int main() { scanf( %s , arr); n = strlen(arr); for (int i = 0; i < n; i++) { if (arr[i] == . ) { p = i; } } if (arr[p - 1] == 9 ) { printf( GOTO Vasilisa. n ); } else { i... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; double distance(double v, double a, double t) { return v * t + a * t * t / 2; } double time(double v, double a, double d) { return (-v + sqrt(v * v + 2 * a * d)) / a; } int main(int argc, char* argv[]) { cout.precision(16); double a, v, l, d, w; ci... |
#include<bits/stdc++.h> #define ll long long #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() #define sz(x) (int)(x).size() #define PB push_back #define PI 3.1415926535897932384626433832795 #define what(x) cout<<#x<< is <<x<<endl; using namespace std; #ifdef LOCAL//ONLINE_JUDG... |
#include <bits/stdc++.h> using namespace std; struct Ratio { long long p; long long q; Ratio(long long p_, long long q_) : p(p_), q(q_) {} bool operator<(const Ratio& o) const { return p * o.q < q * o.p; } bool operator>(const Ratio& o) const { return p * o.q > q * o.p; } bool operator==(con... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// Simplistic packetizer mod supporting circular buffer
// The mod relies on following RAM writer module address rolling over
// The paketizer lets through data to RAM writer untill trigger signal,
// then lets through cfg_data number of beats and stops
// The start position is recorded
// Requirement: trigger signal ... |
#include <bits/stdc++.h> using namespace std; struct yy { int id, val; } f[8000]; int a[8000], p[8000][2], d[8000]; bool b[8000]; bool cmp(yy x, yy y) { return x.val > y.val; } int main() { int i, j, n, m, t, x; bool tm; scanf( %d%d , &n, &m); for (i = 1; i <= 2 * n; ++i) { scanf... |
//Legal Notice: (C)2016 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
// UC Berkeley CS250
// Authors: Ryan Thornton ()
// Arya Reais-Parsi ()
///////// BASIC LUT /////////
// Assumptions:
// MEM_SIZE is a multiple of CONFIG_WIDTH
module lut #(
parameter INPUTS=4, MEM_SIZE=1<<INPUTS, CONFIG_WIDTH=8
) (
// IO
input [INPUTS-1:0] addr,
output out,
// Stre... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: dram_mem.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or
/... |
#include <bits/stdc++.h> using namespace std; long long N = 1e7 + 5; std::vector<long long> v(N, 0); std::vector<long long> p; void sieve() { for (long long i = 2; i < N; i++) { if (v[i] != 0) continue; p.push_back(i); for (long long j = 2 * i; j < N; j += i) v[j] = 1; } } int ma... |
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; cin >> s1 >> s2; if (s2.size() > s1.size()) swap(s1, s2); int x = s1.size() - s2.size(); for (int i = 0; i < s1.size() && i < s2.size(); ++i) { if (s1[s1.size() - i - 1] != s2[s2.size() - i - 1]) { x = s1.siz... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int a, i, temp; long long int sum = 0, n, fra; cin >> a; for (i = 2; i <= a - 1; i++) { temp = a; while (temp > 0) { sum += temp % i; ... |
// mbt 9-7-14
//
// bsg_sbox
//
// The switchbox concentrates working channel signals to reduce
// the complexity of downstream logic.
//
// the one_hot_p option selectively uses one-hot muxes,
// pipelining the mux decode logic at the expensive of
// energy and area.
//
// pipeline_indir_p and pipeline_outdir_p add
//... |
#include <bits/stdc++.h> using namespace std; long long int n, a[100] = {}, r = 0, s = 0, m; int main() { ios_base::sync_with_stdio(0); for (long long int i = 1; i <= 5; i++) { cin >> m; a[m]++; s += m; if (a[m] == 2 || a[m] == 3) r = max(r, m * a[m]); } cout << s - r; ... |
#include <bits/stdc++.h> using namespace std; const int nax = 2e5; int par[nax], dp[nax]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; map<int, int> prev; int ma = -1, mai; for (int i = 0; i < n; i++) { int a; cin >> a; dp[i] = 1; par[i] ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll inf = 1e18; const int N = 2 * 1e5 + 10; ll res; ll a[N]; void solve() { ll n, k; cin >> n >> k; if (n == 1) { cout << 0 << n ; return; } if (n == 2) { cout << k << n ; return; }... |
/*
* Copyright (c) 2014 CERN
* @author Maciej Suminski <>
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
... |
//-----------------------------------------------------------------------------
// Title : 10/100/1G Ethernet FIFO for 8-bit client I/F
// Project : Virtex-5 Embedded Tri-Mode Ethernet MAC Wrapper
// File : eth_fifo_8.v
// Version : 1.8
//----------------------------------------------------------------... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *)
(* \VV/ **************************************************************)
(* // * Th... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e9 + 7; map<long long, long long> factorize(long long n) { map<long long, long long> ans; for (long long i = 2; i * i <= n; i++) { while (n % i == 0) { ans[i]++; n /= i; } } if (n > 1) { ans[n]++; ... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// -------... |
#include <bits/stdc++.h> using namespace std; struct info { long long fs, sm, id; } bd[100001]; int cmp(info a, info b) { return a.fs < b.fs; } int main() { ios_base::sync_with_stdio(0); long long int i, j, x, n, cnt = 0, m, y, k, ans = 0, cf, cm, a, rr1 = 0, l, r, md... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, m, s[N], t[N], nxt[N]; int kmp() { for (int i = 1, j = 0; i < n; i++) { while (j && s[i] != s[j]) j = nxt[j]; nxt[i + 1] = s[i] == s[j] ? ++j : 0; } int cnt = 0; for (int i = 0, j = 0; i < m; i++) { wh... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int T; cin>>T; while(T--) { string S; cin>>S; long long int A[100]; long long int x=0; long long int val=0; long long int N=S.length(); ... |
#include <bits/stdc++.h> using namespace std; const int sz = 1e5 + 50; map<int, int> prime, mark; void init() { prime[2] = 1; int limit = sqrt(sz) + 1; for (int i = 3; i <= sz; i += 2) { if (!mark[i]) { prime[i] = 1; if (i <= limit) { for (int j = i * i; j <= sz; j +=... |
#include <bits/stdc++.h> using namespace std; int n, a[25], d[25][25], f[1 << 25], ans = INT_MAX; int popcnt(int x) { int cnt = 0; while (x > 0) cnt += (x & 1), x >>= 1; return cnt; } int main() { cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; for (int j = 0; j < i; ++j) ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; cin >> n >> k; string str; cin >> str; int overlap = -1; int max = -1; for (int i = 1; i < n; ++i) { if (str[i] == str[0]) { int j = 0; for (j = 0; i + j < n; ++j) { if (str[i + j] ... |
/*
* This is a post-synthesis test for the blif_shift.v test. Run this
* simulation in these steps:
*
* $ iverilog -tblif -o foo.blif blif_shift.v
* $ abc
* abc 01> read_blif foo.blif
* abc 02> write_verilog foo.v
* abc 03> quit
* $ iverilog -g2009 -o foo.vvp blif_shift_tb.v foo.v
* $ vvp foo.v... |
#include <bits/stdc++.h> using namespace std; long double dp[4005][4005]; long double absf(long double a) { if (a < 0) return a * (-1); return a; } long double solve(vector<long double> &a, long long idx, long long left) { if (idx >= a.size()) return left == 0 ? 0 : 100000; if (dp[idx][left] !... |
#include <bits/stdc++.h> using namespace std; int cnt[1 << 14]; signed main() { ios_base ::sync_with_stdio(false); cin.tie(0); int n, k, maxn = 0; cin >> n >> k; for (int i = 0; i < n; ++i) { int a; cin >> a; maxn = max(maxn, a); ++cnt[a]; } long long ans = 0; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k = 0; cin >> n; vector<int> adj[n]; for (int i = 1, u, v; i < n; i++) { cin >> u >> v; u--; v--; adj[u].push_back(v); adj[v].push_back(u); k = max(k, max((int)adj[u].size(), (int)adj[v].size()) + 1... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int sl = s.length(); pair<int, int> a[26] = {}; for (int i = 0; i < 26; i++) a[i].second = i + a ; for (int i = 0; i < sl; i++) a[s[i] - a ].first++; sort(a, a + 26, greater<pair<int, int> >()); string a... |
#include <bits/stdc++.h> using namespace std; void split(string &s, vector<string> &v, string &sep) { int current, previous = 0; current = s.find_first_of(sep); while (current != string::npos) { v.push_back(s.substr(previous, current - previous)); previous = current + 1; current = s.fi... |
#include <bits/stdc++.h> using namespace std; int mult(int a, int b, int p = 1000000007) { return ((a % p) * (b % p)) % p; } int multbig(int a, int b, int mod) { if (a == 0 or b == 0) return 0; if (a == 1 or b == 1) return (a * b) % mod; int cur = multbig(a, b / 2, mod); cur = (2 * cur) % mod; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 07:56:48 06/02/2013
// Design Name:
// Module Name: rom
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Rev... |
`timescale 1 ns / 1 ps
module sample_generator_v1_0_M_AXIS #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Width of S_AXIS address bus. The slave accepts the read and write addresses of width C_M_AXIS_TDATA_WIDTH.
parameter integer C_M_AXIS... |
`default_nettype none
module pic(
//System
input wire iCLOCK,
input wire inRESET,
/****************************************
System Infomation
****************************************/
output wire oSYSINFO_IOSR_VALID,
output wire [31:0] oSYSINFO_IOSR, //IO Start Address
/**************************... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int d = 0, tot = 0, c; bool flag = false; for (int i = 0; i < n; i++) { cin >> c; tot = tot + c; if (tot >= 8 && flag == false) { k = k - 8; tot = tot - 8; d++; i... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; char s; int rock[4][2]; int k = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { cin >> s; if (s == * ) { rock[k][0] = i; rock[k][1] = j; k++; ... |
#include <bits/stdc++.h> using namespace std; int a[20][5000 + 5]; vector<pair<int, int> > e[20][5000 + 5]; int vis[20][5000 + 5]; int n[5000 + 5]; long long sum[20]; vector<pair<int, int> > cycle[5000 * 15 + 5]; int N; vector<int> bit[(1 << 15) + 5]; pair<int, int> sta[5000 * 15 + 5]; int top; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; cin >> a >> b; long long ans = 0; while (true) { if (!a || !b) { cout << ans; return 0; } if (a == b || (a % b == 0)) { cout << (a / b + ans); return 0; } if (a > ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; string ans = ; int f; if (a > b) { ans += 0 ; a--; f = 0; } else { ans += 1 ; f = 1; b--; } for (int i = 1; i < c; i++) { if (f) { ans += ... |
/* Top level module for button demo without debouncing
(not a good way of doing things!)
This uses button 1 of the keypad when installed correctly.
*/
module top (
// input hardware clock (12 MHz)
hwclk,
// LED
led1,
// Keypad lines
keypad_r1,
keypad_c1,
);
/* Clock input ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; const long long mod = 1e9 + 7; int n, c[505], d[505][505], fa[505], a[505]; long long dp[505][505], comb[505][505]; int Find(int x) { return x == fa[x] ? x : fa[x] = Find(fa[x]); } void Union(int u, int v) { int x = Find(u); i... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; string rotate(string s) { for (int i = 1; i <= 3; i++) { swap(s[i - 1], s[i]); } return s; } string rotate2(string s) { swap(s[0], s[4]); swap(s[2], s[4]); swap(s[2], s[5]); return s; } string solve(string s) { string ans = ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:13:25 03/11/2015
// Design Name: counter
// Module Name: C:/Users/omicronns/Workspaces/webpack-ise/counter/tb_counter.v
// Project Name: counter
// Targ... |
module note2dds(clk, note, adder);
input wire clk;
input wire [8:0] note; // запас 2 бита. то есть нота не до 127, а до 512!
output [31:0] adder;
reg [31:0] adder_tbl [15:0];
reg [3:0] addr;
reg [3:0] divider;
// note div 12 ( * 0,08333333333333333333333333333333)
//; Add input / 16 to accumulator
//; Add input / 64... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: rep_jbi_sc0_2.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and... |
//-----------------------------------------------------------------
//
// The original verilog code provided by Clifford E. Cummings,
// Sunburst Design, Inc.
//
//
//----------------------------------------------------------------
module small_async_fifo
#(
parameter DSIZE = 8,
parameter ... |
#include <bits/stdc++.h> using namespace std; const int N = 600 + 5; const int M = 2e5 + 5; template <class T> inline void getin(T& num) { char c; bool flag = 0; num = 0; while ((c = getchar()) < 0 || c > 9 ) if (c == - ) flag = 1; while (c >= 0 && c <= 9 ) { num = num *... |
// $Id: //acds/main/ip/sopc/components/primitives/altera_std_synchronizer/altera_std_synchronizer.v#8 $
// $Revision: #8 $
// $Date: 2009/02/18 $
// $Author: pscheidt $
//-----------------------------------------------------------------------------
//
// File: altera_std_synchronizer_nocut.v
//
// Abstract: Sin... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; double dot(complex<double> a, complex<double> b) { return (conj(a) * b).real(); } double cross(complex<double> a, complex<double> b) { return (conj(a) * b).imag(); } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long doub... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; namespace io { template <typename T> inline void read(T &x) { bool flag = false; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = getchar(); c == - ? flag = true, x = 0 : x = c - 0 ; c = getchar(); while (c >= 0 && c <= ... |
module marsohod_3(
input CLK100MHZ,
input KEY0,
input KEY1,
output [7:0] LED,
output [12:1] IO
);
// wires & inputs
wire clk;
wire clkIn = CLK100MHZ;
wire rst_n = KEY0;
wire clkEnable = ... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ninja_life.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 1000; const long long INF64 = 1e18; const int N = 1001000; const int MOD = 1e9 + 7; const double EPS = 1E-9; long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); } int add(int first, int second, int m) { firs... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n; cin >> n; if (n & 1) cout << n / 2 << n ; else { long long int p = 1; for (long long int i = 1; 2 * p <= n; i++) p = 1 << i; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { double n, x; cin >> n >> x; vector<double> a(n); for (__typeof(n) i = 0; i < n; i++) { cin >> a[i]; } sort(a.rbegin(), a.rend()); a.push_back(0); double... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (win64) Build 881834 Fri Apr 4 14:15:54 MDT 2014
// Date : Thu Jul 24 13:45:39 2014
// Host : CE-2013-124 running 64-bit Service Pa... |
#include <bits/stdc++.h> using namespace std; int n; bool vis[400]; set<int> sub[400]; vector<int> ga[400]; vector<int> path; vector<int> ord; int curr; void DFS(int a) { sub[a].insert(a); for (int i = 0; i < ga[a].size(); i++) { int b = ga[a][i]; if (vis[b]) continue; vis[b]... |
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; long long MAX = 1e17; bool b[1000]; int main() { ios_base::sync_with_stdio(0); ; int m, t, r, ans = 0; cin >> m >> t >> r; int w[m]; for (int i = 0; i < m; i++) cin >> w[i]; if (r > t) { cout << -1 << endl... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; const int maxn5 = 3e5 + 10; const int maxn3 = 1e3 + 10; const long long mod = 1e9 + 7; const long long inf = 2e18; int a[maxn5], righ[24][maxn5], lef[24][maxn5]; int mn[18][maxn5], mx[18][maxn5], n, ans[maxn5], l[maxn5], r[maxn5]; ... |
#include <bits/stdc++.h> using namespace std; int r1, c1, r2, c2; int CB[10][10]; int dr[8] = {1, -1, 1, -1, -2, -2, 2, 2}; int dc[8] = {2, 2, -2, -2, -1, 1, -1, 1}; int main() { char s[10]; scanf( %s , s); r1 = s[0] - a + 1; c1 = s[1] - 0 ; scanf( %s , s); r2 = s[0] - a + 1; ... |
#include <bits/stdc++.h> using namespace std; template <class T> void inc(T& a, const T& b) { if (a < b) a = b; } template <class T> void dec(T& a, const T& b) { if (a > b) a = b; } const int N = 100010; int n; int a[N]; struct node { int lf, len; bool operator<(const node& rhs) co... |
`timescale 1 ps / 1 ps
//-----------------------------------------------------------------------------
// Title : PCI Express BFM Shmem Module
// Project : PCI Express MegaCore function
//-----------------------------------------------------------------------------
// File : altpcietb_bfm_shmem_c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.