text
stringlengths
59
71.4k
/* * Copyright 2012, Homer Hsing <> * * 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 by applicable law or agreed to ...
#include <bits/stdc++.h> using namespace std; long long read() { long long k = 1, x = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) k = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 3) + (x << 1) + (c - 48); c = getchar(); } ret...
#include <bits/stdc++.h> using namespace std; int a[2000], b[2000]; int main() { int n; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i] >> b[i]; } int k = 0; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; j++) { if (j != i) { if (a[i] == b[j]) { ...
/** * 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; int main() { string n, r; cin >> n; r = n; reverse(r.begin(), r.end()); cout << n << r << n ; return 0; }
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2011 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 100, inF = 1e6 + 10; int n, k, u, v, c, maxi, a[N], sz[N]; bool ok; vector<int> nei[N]; int get_sz(int v, int par = -1) { for (int u : nei[v]) if (u != par) sz[v] += get_sz(u, v); return ++sz[v]; } int dfs(int v, int par = -...
/** * 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 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:36777216 ) template <class T> inline void RD(T &); template <class T> inline void OT(const T &); template <class T> inline T &_RD(T &x) { RD(x); return x; } inline int RD() { int x; return _RD(x); } inl...
#include <bits/stdc++.h> using namespace std; long long dp[1001][1001]; long long mem(int sz, int rem) { if (rem == 0) return 1; if (dp[sz][rem] != -1) return dp[sz][rem]; long long& ref = dp[sz][rem]; ref = 0; for (int i = 1; i <= sz - 2; i++) { long long t = (sz - 1 - i) * mem(i, rem -...
/** * 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; int main() { int a[112]; int i; for (i = 0; i < 4; i++) cin >> a[i]; sort(a, a + 4); int tr = 0, seg = 0, im = 0; if (a[1] + a[2] > a[3]) { tr++; } else if (a[0] + a[1] > a[3]) { tr++; } else if (a[0] + a[2] > a[3]) { tr...
#include <bits/stdc++.h> using namespace std; const int N = (1 << 20) + 1000; const int INF = 1000000000; const int Mod = 1000000007; void update(int tree[], int k, int v) { while (k < N) { tree[k] += v; k += k & (-k); } } int get(int tree[], int k) { int ret = 0; while (k) { ...
#include <bits/stdc++.h> using namespace std; int n; int p[4][4]; int a[(1 << 16)]; int sum1[4]; int sum2[4]; int dio1, dio2; bool ok; int mask; void dfs(int x) { int i, j; if (x == n * n) { if (dio1 == dio2 && dio1 == sum1[0] && sum1[1] == dio1 && sum1[2] == dio1 && sum2[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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:16:05 04/24/2015 // Design Name: // Module Name: StartCastle // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: /...
// DESCRIPTION: Verilator: System Verilog test of array querying functions. // // This code instantiates a module that calls the various array querying // functions. // // This file ONLY is placed into the Public Domain, for any use, without // warranty. // Contributed 2012 by Jeremy Bennett, Embecosm. module t (/*AU...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2013 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 // Very simple test for interface pathclearing `ifdef VCS `define UNSUPPORTED_MOD_IN_GENS `endif `ifdef ...
// // Copyright 2011 Ettus Research LLC // // 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 program is dis...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ...
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool smin(T &a, const T &b) { return b < a ? a = b, 1 : 0; } template <typename T> inline bool smax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const long long N = (long long)1e6 + 10; long long n, ar[N], m, bl[N...
/* * 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; #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) bool check(string pattern, string text) { int j = 0; int i = 0; while (i < text.size()) { if (pattern[j] == text[i]) { j++; } i...
#include <bits/stdc++.h> using namespace std; int func(int a) { int cnt = 0; while (a) { cnt++; a /= 10; } return cnt; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, k; cin >> n >> k; vector<long long> v(n); map<int, int> m[11]; long...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: California State University, Fullerton // Engineer: Lucas Magasweran, Alan Nguyen // // Create Date: 17:31:25 11/16/2011 // Design Name: 8x8 Robertson's Multiplier // Module Name: ...
`include "timescale.v" module fb_slave_counters (MRxClk, Clk_100MHz, Reset, MRxDV, RxValid, MRxDEqDataSoC, MTxEn_TxSync2, StateIdle, StatePreamble, StateNumb, StateSlaveID, StateDist, StateDelay, StateDelayMeas, StateDelayDist, StateData, StateSlaveData, StateSlav...
// (C) 2001-2015 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 long long N = 5e5 + 55, INF = 5e5 + 55; const double Eps = 1e-5; long long n, m, k, Fa[N], Vis[N], flag; struct Node { long long first, second, Num; double val; Node() { first = second = val = 0; } bool operator<(const Node &X) const { ...
// Copyright (C) 2009 Onno Kortmann <> // // 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 your option) any later version. // // This program is ...
#include <bits/stdc++.h> using namespace std; long long n, mi, mx; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; long long a[n]; for (int i = 0; i < n && cin >> a[i]; i++) ; cout << abs(a[0] - a[1]) << << abs(a[0] - a[n - 1]) << endl; for (int i...
#include <bits/stdc++.h> using namespace std; int main() { long long a[100], b[100], i, n, m, r; cin >> n >> m >> r; long long ans = r; for (i = 0; i < n; ++i) { cin >> a[i]; } for (i = 0; i < m; ++i) { cin >> b[i]; } long long minn = *min_element(a, a + n); long long...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int a[t]; for (int i = 0; i < t; i++) { cin >> a[i]; if (360 % (180 - a[i]) == 0) cout << YES << endl; else cout << NO << endl; } return 0; }
/* * 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> int n, m, i, j, w[2001][3], v[2001], ct, a, b, c, t, tt, r[2001][3]; int min(int a, int b) { if (a > b) return b; return a; } int main() { scanf( %d%d , &n, &m); for (i = 0; i < m; i++) { scanf( %d%d%d , &a, &b, &c); w[a][0] = b, w[b][1] = a, w[a][2] = c; ...
/** * 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...
module premuat1_16( enable, inverse, i_0, i_1, i_2, i_3, i_4, i_5, i_6, i_7, i_8, i_9, i_10, i_11, i_...
module main; reg clk, rst, done; wire [31:0] x; reg [3:0] a; reg [23:0] in, out; reg [2:0] a_fifo_cam_indices[3:0], lt_fifo_cam_indices[3:0]; // Debug signals to see 'em under signalscan // -- iverilog generates a warning here wire [2:0] db0_a_fifo_cam_indices = a_fifo_cam_indices[0]; //...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; template <typename... Args> void writeln(Args... args) { ((cout << args << ), ...); cout << endl; } template <typename... Args> void _db(Args... args) { ((cerr << args << ;; ), ...); ...
/** * 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() { #ifndef ONLINE_JUDGE freopen( input.txt , r , stdin); freopen( output.txt , w , stdout); #endif ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout.precision(10); int t; cin >> t; while (t--) { in...
module elink_monitor(/*AUTOARG*/ // Inputs frame, clk, din ); parameter AW = 32; parameter PW = 2*AW+40; input frame; input clk; input [7:0] din; reg [3:0] cycle; reg read; reg [31:0] dstaddr; reg [31:0] srcaddr; reg [31:0] data; reg [3:0] ctrlm...
#include <bits/stdc++.h> using namespace std; vector<int> a[2000007]; vector<int> deg(2000007, 0); vector<pair<int, int>> ans; int n, m; void bfs(int node) { vector<bool> used(n); used[node] = true; queue<int> q; q.push(node); while (!q.empty()) { int currnode = q.front(); q....
#include <bits/stdc++.h> using namespace std; vector<int> set1; vector<int> set2; int col[100004], vis[100004]; int flag = 1; class Graph { int V; list<int> *adj; public: Graph(int V); void addEdge(int v, int w); void BFS(int s); }; Graph::Graph(int V) { this->V = V; ad...
// NeoGeo logic definition (simulation only) // Copyright (C) 2018 Sean Gonsalves // // 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) an...
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; const int N = 100100; int n, a[N], q; int main() { int t; scanf( %d , &t); while (t--) { scanf( %d , &n); set<int> se; for (int i = 1; i <= n; i++) { scanf( %d , a + i); se.insert(a[i]); ...
#include <bits/stdc++.h> using namespace std; struct point { double x; double y; }; int compare(const void *a, const void *b) { point *aa, *bb; aa = (point *)a; bb = (point *)b; if (aa->x > bb->x) return 1; else if (aa->x < bb->x) return -1; else return aa->y > ...
/* * 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...
/* * 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...
//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...
#include <bits/stdc++.h> using namespace std; struct Student { int number; int cost; int com; }; bool comp1(Student a, Student b) { if (a.cost < b.cost) return true; return false; } bool comp2(Student a, Student b) { if (a.number < b.number) return true; return false; } int m...
// tuner_slice_1k.v - one leg of real->complex tuner with 4k sine cycle // 07-18-16 E. Brombaugh module tuner_slice_1k #( parameter dsz = 10, psz = 12 ) ( input clk, reset, shf_90, input signed [dsz-1:0] in, input [psz-1:0] phs, output reg signed [dsz-1:0] out ); // split acc into...
#include <bits/stdc++.h> using namespace std; const int N = 1e2 + 5, M = 2e4 + 5; int a[105], b[300]; int dp[105][M]; int main() { int t; cin >> t; while (t--) { memset(dp, 0, sizeof(dp)); int n, k, l; scanf( %d %d %d , &n, &k, &l); for (int i = 1; i <= n; i++) cin >> a[i];...
#include <bits/stdc++.h> using namespace std; long long ans; int F[500005][19 + 1], i, j, m, n, p, k, a[500005], nn, G[500005], Log[500005]; int ST[19 + 1][500005]; void get_ST() { for (i = 1; i <= nn; ++i) ST[0][i] = i; for (i = 1; i <= 19; ++i) for (j = 1; j + (1 << i) - 1 <= nn; ++j) ...
#include <bits/stdc++.h> using namespace std; vector<int> v; int n, x; char s[3]; int main() { cin >> n; while (n--) { cin >> s; if (s[0] == a ) { cin >> x; v.insert(lower_bound(v.begin(), v.end(), x), x); } if (s[0] == d ) { cin >> x; v.erase(...
#include <bits/stdc++.h> const int INF = 0x3f3f3f3f; const std::string str = ATGC ; int main() { int n, m; std::vector<std::string> s; std::vector<std::string> tmp; std::vector<std::string> ans; int min_ans = INF, pos; std::cin >> n >> m; for (int i = 0; i < n; ++i) { std::strin...
/** * 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 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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
#include <bits/stdc++.h> using namespace std; const bool print = false; const int N = 5e5 + 7; int n, m; vector<int> gr[N]; int cyk[N], odl[N], par[N]; vector<int> mycyk[N]; bool odw[N]; int ans[N]; vector<int> child[N]; int dpd[N], dpu[N]; void dfs1(int v) { odw[v] = 1; for (int i : gr[...
#include <bits/stdc++.h> using namespace std; template <class T> inline void input(T &x) { register char c = getchar(); x = 0; int neg = 0; for (; ((c < 48 || c > 57) && c != - ); c = getchar()) ; if (c == - ) { neg = 1; c = getchar(); } for (; c > 47 && c < 58; c =...
#include <bits/stdc++.h> int adjL[201][210]; int visited[201]; int broken[201][201]; int edge[200][2]; int R[200][2]; int fine[201]; int dfs(int v, int c) { int i; int a; visited[v] = c; for (i = 1; i <= adjL[v][0]; i++) { a = adjL[v][i]; if (visited[a] != 0 || broken[v][a]) co...
#include <bits/stdc++.h> using namespace std; struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << ; return *this; } } dbg; int main() { int T; cin >> T; while (T--) { char c; int x1 = -1, y1 = -1, x2 = -1, y2 = -1; for (...
`default_nettype none module ddr3_fb( input wire clk, // clk491520 input wire rst, // MIG interface input wire mig_ready_i, output wire mig_cmd_clk, output wire mig_cmd_en, output wire [2:0] mig_cmd_instr, output wire [5:0] mig_cmd_bl, output wire [29:0] mig_cmd_byte_addr, input...
#include <bits/stdc++.h> using namespace std; int n, m; const int MAXN = 1e6 + 10; pair<int, pair<int, int> > A[MAXN]; int HX[MAXN], HY[MAXN]; int fa[MAXN]; int X[MAXN], Y[MAXN]; int ans[MAXN]; int Find(int x) { return fa[x] == x ? x : fa[x] = Find(fa[x]); } void uni(int x, int y) { int fx = Fin...
// -- (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 // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not a...
#include <bits/stdc++.h> using namespace std; struct node { unsigned long int val; long int index; unsigned long int other; }; bool cmp(node& a, node& b) { if (a.val != b.val) return a.val < b.val; else return a.other > b.other; } struct node2 { bool operator()(const node...
#include <bits/stdc++.h> using namespace std; const int mm = 2e5 + 30; long long a1, a2, a3, a4, a5, a6, a7, a8, a9, ez1, ans, n, m, k, sum; string s, s1, s2, s3; int flag[mm]; bool y = 0; bool omm(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } void input() { c...
//Legal Notice: (C)2010 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> using namespace std; int main() { int n; cin >> n; int ns = 0; bool ok = true; for (int i = 0; i < n; i++) { int val; cin >> val; string type; cin >> type; if (type == South ) { if (ns + val > 20000) ok &= false; e...
/////////////////////////////////////////////////////////////////////////////// /// Andrew Mattheisen /// Zhiyang Ong /// /// EE-577b 2007 fall /// VITERBI DECODER /// pmsm module (Path Metric State Memory) /// /// Need to add normilization circuit. /// ///////////////////////////////////////////////////////////////...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > a[5001]; int n, t; int main() { int m, u, v, w; cin >> n >> m >> t; vector<vector<int> > f(n + 1, vector<int>(2, 0)); vector<vector<int> > p(n + 1, vector<int>(2, 2e9 + 1)); vector<vector<int> > track(n + 1, vector<int>(n ...
#include<iostream> using namespace std; int query(int a, int b) { cout << ? << a << << b << endl; cout.flush(); int ret; cin >> ret; return ret; } int main() { int n; cin >> n; int lt = 1, rt = n; int sec = query(1, n); while (rt - lt > 0) { int mid; if (rt + l...
#include <bits/stdc++.h> using namespace std; int a0, a1, n, ans, table[500]; int getans(int); int main() { scanf( %d%d%d , &a0, &a1, &n); printf( %d n , getans(n)); return 0; } int getans(int an) { if (an == 0) return a0; if (an == 1) return a1; return getans(an - 1) + getans(an - 2...
/******************************************************************************* * 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 ...
#include <bits/stdc++.h> using namespace std; const int Maxn = 55; long long dp[Maxn][10]; int main() { string k; cin >> k; int n = k.length(); for (int i = 0; i < 10; i++) { dp[0][i] = 1; } for (int i = 1; i < n; i++) { int t = k[i] - 0 ; for (int j = 0; j < 10; j++) ...
`timescale 1ns/1ps `include "cpu_constants.vh" module dma_controller_tb; /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire dma_status; // From dma of dma_controller.v wire [23:0] dram_addr; // From dma of dma_co...
// Copyright 2020-2022 F4PGA 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
module edma (/*AUTOARG*/ // Outputs mi_dout, edma_access, edma_packet, // Inputs reset, clk, mi_en, mi_we, mi_addr, mi_din, edma_wait ); /******************************/ /*Compile Time Parameters */ /******************************/ parameter RFAW = 6; parameter AW ...
#include <bits/stdc++.h> int main() { int n, i, b; while (scanf( %d , &n) != EOF) { int j = 0, str[10001] = {0}, total = 0; for (i = 0; i < n; i++) { scanf( %d , &b); if (str[b] == 0) ++total; ++str[b]; if (str[b] > j) j = str[b]; } printf( %d %d n , j, ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty. // SPDX-License-Identifier: CC0-1.0 // bug998 interface intf #(parameter PARAM = 0) (); logic val; function integer func (); return 5; endfunction endinterface module t1(...
module TestBench_Lab2 ( output reg clk, output reg [8:0] key_input ); initial begin clk = 0; key_input = 9'b0; end always begin #5 clk = ~clk; end // For the test case assigned below, the LED output should be 5'b00001 // There is an initial ...
// 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 : Wed Feb 01 18:22:40 2017 // Host : TheMosass-PC running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; const int mo = 1e9 + 7; const int N = 1000010; const int inf = 0x3f3f3f3f; using namespace std; int n, m, q, tot, ans[N], fa[N], mark[N], pa[N], tmp; struct node { int a, b, c; bool operator<(const node &x) const { return c < x.c; } } e[N], ed[N]; ...
/** * 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; vector<vector<pair<int, int> > > AdjList; priority_queue<pair<int, pair<int, int> > > Edgelist; int n, j, k, m, l, t, i; string s, ss; int a[1050][1050]; int main() { cin >> n; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { scanf( %d...
module nios ( altmemddr_0_auxfull_clk, altmemddr_0_auxhalf_clk, clk50_clk, io_ack, io_rdata, io_read, io_wdata, io_write, io_address, io_irq, mem32_address, mem32_direction, mem32_byte_en, mem32_wdata, mem32_request, mem32_tag, mem32_dack_tag, mem32_rdata, mem32_rack, mem32_rack_tag, mem_external_...
/** * 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: sparc_exu_alulogic.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 i...
`timescale 1ns / 1ps module uart_tx #( parameter DBIT = 8, // Number of data bits to receive SB_TICK = 16 // Number of ticks for the stop bit. 16 ticks=1 stop bit, 24=1.5 and 32=2. ) ( input wire clk, input wire reset, input wire [7:0] data_in, input wire s_tick, input wire tx_...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long n; cin >> n; vector<pair<long long, long long>> a(n); for (long long i = 0; i < n; ++i) { cin >> a[i].first >> a[i].second; a[i].first *= 2; a[i].second *= 2; } if (n % 2) { cout << NO ; r...
/* * 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 h, g, c, n, m, k, l, a[140] = {}; string s; cin >> s; n = s.length(); for (int i = 0; i < s.length(); i++) a[s[i]]++; int res = 0; for (int i = 0; i <= 139; i++) if (a[i] > 0) { res++; } if ((res < 2) ...
#include <bits/stdc++.h> using namespace std; multiset<int> st; multiset<int>::iterator it; int arr[200000]; int main() { int n, i, a, b, c, ans = 0, temp[3]; scanf( %d , &n); scanf( %d , &temp[0]); scanf( %d , &temp[1]); scanf( %d , &temp[2]); sort(temp, temp + 3); a = temp[0]; ...
// file: clk_wiz_0.v // // (c) Copyright 2008 - 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...
#include<bits/stdc++.h> using namespace std; #define int long long int #define intu unsigned long long int #define vi vector<int> #define ii pair<int,int> #define pb push_back #define ff first #define ss second #define fast_io ios::sync_with_stdio(0);cin.tie(NULL);std::cout.tie(NULL); # define PI ...
#include <bits/stdc++.h> using namespace std; int n; int main() { multiset<int> Q; scanf( %d , &n); long long ans = 0; for (int i = 0; i < n; i++) { int x; scanf( %d , &x); if (Q.size() == 0 || (*Q.begin()) > x) { Q.insert(x); } else { ans += x - *Q.begin();...
#include <bits/stdc++.h> using namespace std; int main() { int i, num = 0; for (i = 1; i <= 5; i++) { int temp; scanf( %d , &temp); num += temp; } if (num % 5 || num == 0) { printf( -1 n ); } else { printf( %d n , num / 5); } return 0; }