text
stringlengths
59
71.4k
`timescale 1ns / 1ps /////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 05.10.2017 12:05:16 // Design Name: // Module Name: memoria_intrucciones // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: //...
// ============================================================================ // Copyright (c) 2010 // ============================================================================ // // Permission: // // // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference ...
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const int maxn = 1e6; const int INF = 0x7fffffff; const int mod = 1e9 + 7; const double eps = 1e-7; const double Pi = acos(-1.0); inline int read_int() { char c; int ret = 0, sgn = 1; do { c = getchar(); } while ...
// -*- Mode: Verilog -*- // Filename : fw_interface_wb.v // Description : Firmware Testing Wishbone Bus Interface // Author : Philip Tracton // Created On : Wed Dec 21 14:05:32 2016 // Last Modified By: Philip Tracton // Last Modified On: Wed Dec 21 14:05:32 2016 //...
/** * 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() { map<long long, pair<long long, long long> > mpl; vector<long long> ml; long long n, q, xi, amyor = 0; scanf( %lld %lld , &n, &q); deque<long long> dq; for (int i = (0); i < int(n); i++) { scanf( %lld , &xi); amyor = max(a...
#include <bits/stdc++.h> using namespace std; int main() { int i, n, l, k = 0, maxi; scanf( %d , &n); long long int count = 0; int a[15]; l = n; while (l) { a[k] = l % 10; l = l / 10; k++; } while (k > 0) { maxi = 0; for (i = 0; i < k; i++) if (a...
/** * 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) 2001-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 doc...
#include <bits/stdc++.h> using namespace std; const double error = 1e-7; double v, r; bool puede(double t, double dist) { dist -= v * t; if (dist <= 0) return true; double tvuelta = r * 2 * M_PI / v; t -= int(t / tvuelta) * tvuelta; double a = t * v / r; return dist <= 2 * r * sin(a / 2....
#include <bits/stdc++.h> using namespace std; map<int, int> frontc; map<int, int> backc; int main() { int n, ans, a, b, x, i, x1; cin >> n; ans = n; for (i = 0; i < n; i++) { cin >> a >> b; if (a != b) backc[b]++; frontc[a]++; } map<int, int>::iterator it; for (it =...
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; cout << N << ; for (int i = 1; i < N; i++) cout << i << ; cout << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 1000000 + 5; int f[maxn], inv[maxn], finv[maxn]; void init() { inv[1] = 1; for (int i = 2; i < maxn; i++) inv[i] = (mod - mod / i) * 1ll * inv[mod % i] % mod; f[0] = finv[0] = 1; for (int i = 1; i < m...
/* * MBus Copyright 2015 Regents of the University of Michigan * * 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required ...
#include <bits/stdc++.h> using namespace std; bool compare(int a, int b) { return a > b; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for (long long int i = 0; i < n + 1; i++) { for (long long int j = 0; j < 2 * (n - i); j++) { cout << ; ...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:167772160 ) int comp(const void* a, const void* b) { return (*(long long*)a) - (*(long long*)b); } int main() { int n; long long mas[300000], ans(0); scanf( %d , &n); for (int i(0); i < n; ++i) scanf( %I64d , &ma...
/** * 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; long long POW(long long a, long long b, long long MMM = MOD) { long long ret = 1; for (; b; b >>= 1, a = (a * a) % MMM) if (b & 1) ret = (ret * a) % MMM; return ret; } long long gcd(long long a, long long b) { return b...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; //Simple debug: //wire [1:1] wir_a [3:3] [2:2]; //11 //logic [1:1] log_a [3:3] [2:2]; ...
#include <bits/stdc++.h> const int d = 998244353; using namespace std; int main() { int n, m, k; cin >> n >> m >> k; vector<vector<long long int>> t(n + 1); vector<long long int> init(k + 1, 0); for (int i = 0; i <= n; i++) { t[i] = init; } t[1][0] = m; t[1][1] = 0; for (...
//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...
/** * 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 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017 // Date : Tue Oct 17 02:50:13 2017 // Host : Juice-Laptop running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9; long double sqr(long double a) { return a * a; } long long gcd(long long a, long long b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.ti...
/** * 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 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 2 == 0) cout << NO << endl; else { cout << YES << endl; cout << 1 << ; for (int i = 4; i < 2 * n; i += 4) cout << i << << i + 1 << ; for (int i = 2; i < 2 * n; i += 4) cout...
#include <bits/stdc++.h> using namespace std; void solve() { int y, b, r; cin >> y >> b >> r; while (1) { if (r - 1 <= b && r - 2 <= y) { break; } --r; } cout << 3 * r - 3; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); ...
//------------------------------------------------------------------- // // COPYRIGHT (C) 2011, VIPcore Group, Fudan University // // THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI...
#include<bits/stdc++.h> #define int long long #define f first #define s second #define N 1010 #define M 1010 #define MOD 998244353 #define oo 1e18 using namespace std; typedef pair<int,int> ii; int v[N][N], estado[N]; set<int>freq[N][N]; int n; void eraseLine(int line, queue<int>&unique) { ...
/** * 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2004 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc; initial cyc=1; integer ...
#include <bits/stdc++.h> using namespace std; template <typename T> struct BIT { int n; vector<T> dat; BIT(int n = 0) { initialize(n); } void initialize(int nin) { n = nin; dat.resize(n, 0); } T sum(int i) { T s = 0; while (i >= 0) { s += dat[i]; 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; template <class T> bool uin(T &a, T b) { return a <= b ? true : false; } template <class T> bool uax(T &a, T b) { return a >= b ? true : false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(10); cout << ...
#include <bits/stdc++.h> using namespace std; int n, m; vector<vector<int>> p; bool is(int val) { int c = 0; vector<bool> pres(n, 0); bool flag = 0; for (int i = 0; i < m; i++) { c = 0; for (int j = 0; j < n; j++) { if (p[i][j] >= val) { pres[j] = true; c+...
#include <bits/stdc++.h> using namespace std; long long int MOD = 998244353; long long int INF = 1e18; long long int vv; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int i, j, k = 0, l = 0, r = 0, m = 0, n, c, p = 0, cnt = 0, c...
/* module tail_length (clk, reset_n); input clk; input reset_n; // declarations always @(l0, l1) begin l0 l1 end */ module tail_length (ir, len); input [3:0] ir; output [3:0] len; reg [3:0] len; reg ir32; /* ..00 ..01 ..10 ..11 00.. 1 0 0 0 01.. 1 ? ? 0 10.. ...
#include <bits/stdc++.h> using namespace std; vector<int> adj[100005]; bitset<100005> vis; int nodes = 0, edges = 0; void dfs(int v) { nodes++; vis[v] = true; for (auto nv : adj[v]) { if (!vis[nv]) dfs(nv); edges++; } } int main() { int n, k; scanf( %d%d , &n, &k); ...
/******************************************************************************* * 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 ...
//date:2016/3/16 //engineer: zhaishaomin //module function :test whether dc_download will behave as what i want it to do ,such as handling coming flit correctly /* // test examples //wbrep 11 flits long flits_d_m_areg={flits_in[140:139],1'b1,local_id,1'b0,wbrep_cmd,5'b00000,seled_addr,data_read}; //ATflurep ...
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8; const int mod = 1e9 + 7; const int N = 1e6 + 10; const long long INF = 1e18; long long power(long long x, long long y) { long long t = 1; while (y > 0) { if (y % 2) y -= 1, t = t * x % mod; else y /= 2...
#include<bits/stdc++.h> using namespace std; long long a[1000010]; bool cmp(long long a,long long b) { return a>b; } int main() { long long m,n,i,j,x,y,suma=0,sumb=0; cin>>n; while(n--) { cin>>m; for(i=0;i<m;i++) cin>>a[i]; sort(a,a+m,cmp); for(i=0;i<m;) { if(a[...
// $Id: router_wrap.v 1730 2009-12-13 08:39:16Z dub $ /* Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of so...
#include <bits/stdc++.h> using namespace std; vector<long long> v; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long a = 0, b = 0, c, d, e, f = 0, l, g, m, n, k, i, j, t, p, q; cin >> t; while (t--) { cin >> n; f = 0; v.clear(); ...
//rd0 - 128/64/32 bits wide (can be unaligned) //rd1 - 32 bits wide //rd2 - 32 bits wide //wr0 - 128/64/32 bits wide (4 bit enable) (can be unaligned) module reg_1024x32b_3r_1w (/*AUTOARG*/ // Outputs rd0_data, rd1_data, rd2_data, // Inputs rd0_addr, rd1_addr, rd2_addr, wr0_addr, wr0_en, wr0_d...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k, c, ans = 0; string s; cin >> s; bool sol = 1; for (int i = 0; i < s.length(); i++) { if (s[i] == 1 && s[i + 1] == 4 && s[i + 2] == 4 ) { i += 2; continue; } if (s[i] == 1 || (s[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...
// (C) 2001-2013 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 doc...
/** * 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 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; string multiply(string num1, string num2) { int len1 = num1.size(); int len2 = num2.size(); if (len1 == 0 || len2 == 0) return 0 ; vector<int> result(len1 + len2, 0); int i_n1 = 0; int i_n2 = 0; for (int i = len1 - 1; i >= 0; i--) { in...
//Legal Notice: (C)2018 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...
/* * 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...
/** * 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 N = 100010; const int M = 4; int now[2], dila[2]; int vis[N][4], n, m, cnt, ans_cnt; char s[4]; long long ans; int main() { int i, j, k, *p; bool lose = false; scanf( %d%d%d%d%s , &n, &m, &now[0], &now[1], s); if (s[0] == U ) ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); string s1, s2; cin >> s1 >> s2; int n = s1.size(); int m = s2.size(); pair<pair<int, int>, pair<int, char> > parent[n + 1][m + 1][205]; int dp[n + 5][m + 5][205]; for (int ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2011 by Jeremy Bennett. module t (/*AUTOARG*/ // Inputs clk ); input clk; wire [19:10] bitout; wire [29:24] short_bitout; wire [7:0] allbits; wire [15:0] tw...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:134217728 ) using namespace std; char buf[2]; vector<int> sign; int n; int main() { sign.push_back(1); scanf( %s , buf); while (1) { scanf( %s , buf); if (buf[0] == = ) break; sign.push_back(buf[0] == + ? 1 : -1); ...
/** * 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 long long K = 1000000000000000000; map<int, int> M; int q, mn, w[600005], nxt[600005], Q[600005], anc[600005], r; char opt[5], s[600005]; long long ans0, ans, g, ansx, ansy; int mask((1 << 30) - 1); int calc(int x) { return w[Q[lower_bound(Q + 1, Q + r...
// megafunction wizard: %FIFO%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: sfifo_65x128.v // Megafunction Name(s): // scfifo // ============================================================ // ***************...
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int N = 5002; constexpr int mod = 1e9 + 7; string x, y; int n, m; int cache[N][N]; int dp(int a, int b) { if (b == m) return 0; int &rv = cache[a][b]; if (~rv) return rv; rv = dp(a, b + 1); if (x[a] == y[b]...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const int N = 1000000 + 10; const int M = 1000; const string st2 = ABCDEFGHIJKLMNOPQRSTUVWXYZ ; const string s1 = abcdefghijklmnopqrstuvwxyz ; pair<int, int> a[N]; int b[N]; string ans[N], da[N]; int main() { cin >...
/* * 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; const int MAX = 5005; int n, T; int pp[MAX]; int t[MAX]; double p[MAX]; double ps[MAX]; double pl[MAX]; double dp[2][MAX]; int main(void) { scanf( %d%d , &n, &T); for (int i = (0); i < (n); ++i) scanf( %d%d , pp + i, t + i); for (int i = (0);...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); long long n; cin >> n; long long s = 0; for (int i = 0; i < n; ++i) { long long x; cin >> x; s += x; } long long add = (s - n * (n - 1) / 2) / n; long ...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; int k, n, fl = 0; cin >> n >> k; v.resize(n); for (int i = 0; i < n; ++i) { cin >> v[i]; if (v[i] == k) fl = 1; } int ct = 0; if (!fl) { v.push_back(k); ct++; ++n; } sort(v...
/** * 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...
/*! * <b>Module:</b>action_decoder * @file action_decoder.v * @date 2016-12-08 * @author auto-generated file, see ahci_fsm_sequence.py * @brief Decode sequencer code to 1-hot actions */ `timescale 1ns/1ps module action_decoder ( input clk, input enable, input [10:0] data, o...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Fri Jan 13 17:31:20 2017 // Host : KLight-PC running 64-bit major release (bu...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 50; const int mod = 1e9 + 7; const int inf = (1 << 30); vector<int> v[maxn][5], tpl; int ted[maxn], com[maxn], tmp = 1; bool visited[maxn]; bool dfs(int u, int d) { visited[u] = 1; bool rz = (ted[com[u]] == 1); if (d == 1) ...
`timescale 1ns / 1ps module crc #( parameter POLYNOMIAL = 5'b00101, parameter DATA_WIDTH = 8, parameter CRC_WIDTH = 5, parameter SEED = 0, parameter DEBUG = 0, parameter REVERSE = 1 )( input [DATA_WIDTH-1:0] data, input data_en...
#include <bits/stdc++.h> using namespace std; int mpow(int base, int exp); void ipgraph(int m); void dfs(int u, int par); const int mod = 1000000007; const int N = 1e6, M = N; const int LN = 1e9; long long dir[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; using namespace std; long long gcd(long long a...
//////////////////////////////////////////////////////////////////////////////////////////////////// // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at...
#pragma GCC optimize( Ofast ) #include <iostream> #include <fstream> #include <algorithm> #include <functional> #include <array> #include <chrono> #include <random> #include <vector> #include <string> #include <sstream> #include <cmath> #include <cstring> #include <bitset> #include <list>...
#include <bits/stdc++.h> using namespace std; char s[90]; void error() { cout << -1 << endl; exit(0); } int main() { int n, m, l = 1, r; scanf( %d%d n , &n, &m); r = n; while (m--) { int v; scanf( To the %s of %d n , s, &v); if (!strcmp(s, left )) { if (l >= ...
// // Copyright (c) 2001 Stephan Gehring // // (Modified by Stephan Williams to include PASS/FAIL messages.) // // 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 // Foun...
`timescale 1ns / 1ps `default_nettype none ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10/06/2015 11:20:11 PM // Design Name: // Module Name: bin_to_bcd_tb // Project Name: // Target Devices: // Tool Versions: // Description: // ...
#include <bits/stdc++.h> using namespace std; int a[1002][102]; int main() { int n, m, k, x; cin >> n >> m >> k; cout << m * (m - 1) / 2 << endl; for (int i = 0; i < m; i++) { for (int j = i + 1; j < m; j++) { if (!k) cout << i + 1 << << j + 1 << endl; else ...
#include <bits/stdc++.h> using namespace std; int x1, yy1, r1, R1; int x2, y2, r2, R2; int dis; inline bool inside(int r, int R) { double dist = sqrt((double)dis); if (dist <= double(R - r)) return true; return false; } inline bool outside(int r, int R) { double dist = sqrt((double)dis); ...
/* * Copyright (c) 2002 Stephen Williams () * * 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) * ...
#include <bits/stdc++.h> using namespace std; int n; long long int aib[15][100005]; inline void update(long long int aib[], int pos, long long int val) { for (; pos <= n; pos += ((pos) & (-(pos)))) aib[pos] += val; } inline long long int query(long long int aib[], int pos) { long long int ans = 0; ...
//oob_controller.v /* Distributed under the MIT license. Copyright (c) 2011 Dave McCoy () Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the righ...
//================================================================================================== // Filename : ceespu_regfile.v // Created On : 2018-07-21 21:13:53 // Last Modified : 2018-08-04 21:44:12 // Revision : // Author : Cees Wolfs // // Description : The register file for the c...
#include <bits/stdc++.h> using namespace std; const int N = 150005; int n, m; int a, b; vector<int> g[N]; bool pos[N]; vector<int> dsu; bool rez; bool proveri() { for (int u = 0; u < dsu.size(); u++) if (g[dsu[u]].size() != dsu.size() - 1) return false; return true; } void dfs(int cv...
// -------------------------------------------------------------------- // -------------------------------------------------------------------- // Module: WB_SPI_Flash.v // Description: Wishbone SPI Master core. // -------------------------------------------------------------------- // ----------------------------...
/** * 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; template <class T> void printvec(vector<T>& x, int a, int b) { for (int i = (a); i <= (b); i++) cout << x[i] << ; cout << n ; } const double PI = acos((double)-1); const double EPSILON = 1e-7; const int N = 1e6 + 1; const int NN = 1e3 + 1; con...
// (c) Copyright 1995-2017 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 ...
module decoder(input [1:0] op,input [5:0] funct,input [3:0]rd, output reg [1:0] flagw,output wire pcs,output wire regw, output wire memw,output wire memtoreg,output wire alusrc, output wire [1:0] immsrc,output wire [1:0] regsrc,output reg[1:0] alucontrol ,outp...
/* * 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() { long long n, i, j, k, m, t, x, y, sum; cin >> t; while (t > 0) { t = t - 1; cin >> n >> k; long long a[n], c[k]; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < k; i++) { cin >> c[i]; ...
module check (input unsigned [103:0] a, b, c); wire [103:0] int_AB; assign int_AB = ~(a & b); always @(a, b, int_AB, c) begin #1; if (int_AB !== c) begin $display("ERROR"); $finish; end end endmodule module stimulus (output reg unsigned [103:0] A, B); parameter S = 2000; int unsigned 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; vector<int> AL[100005]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n - 1; i++) { int u, v; scanf( %d , &u); scanf( %d , &v); AL[u].push_back(v); AL[v].push_back(u); } long long int l = 0; int fl = 0; ...
#include <bits/stdc++.h> using namespace std; long long int _sieve_size; bitset<10000010> bs; vector<int> primes; void sieve(long long int upperbound) { _sieve_size = upperbound + 1; bs.set(); bs[0] = bs[1] = 0; for (long long int i = 2; i <= _sieve_size; i++) if (bs[i]) { for (l...
/* * Copyright (C) 2011 Kiel Friedt * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This p...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 27 15:47:55 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 5, MOD = 998244353; int m, n, k; long long res; int free_Row, free_Col, line_vert, line_hori; int Num_Row[N], Num_Row2[N][2], Num_Col[N], Num_Col2[N][2]; int c[2][2]; map<pair<int, int>, int> M; long long power(long long x, int k)...