text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; unsigned long long arr[200000], cum[200000]; unsigned long long forone; unsigned long long n; unsigned long long make(unsigned long long st, unsigned long long mult, unsigned long long lim, unsigned long long level) { if (st > n) retu...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353, maxn = 5e5 + 79; void upd(int& a, const int& b) { a = (a + b) % mod; } int mul(const int& a, const int& b) { return (a * 1ll * b) % (long long)mod; } vector<vector<int> > dp(maxn, vector<int>(2, 0)); vector<vector<int> > g(maxn); vec...
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, k, root, col[N], sz[N]; vector<int> g[N], a[N]; int dfs(int v, int pr = -1) { int mx = col[v]; sz[v] = col[v]; for (auto& to : g[v]) { if (to == pr) continue; int root = dfs(to, v); if (root != -1) return ...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2007 Corgan Enterprises 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 2 of...
#include <bits/stdc++.h> using namespace std; int main() { int c[100], w[2000], q[2000]; int b[100]; for (int i = 0; i <= 20; i++) { q[i] = 0; b[i] = 0; c[i] = 0; } for (int i = 5; i <= 9; i++) { cin >> c[i]; } int n = 0; string a; cin >> n; for (int i...
`default_nettype none `timescale 1ns / 1ps `include "ipl_config.vh" // This core aims to implement a simple, reusable Wishbone B.4 compatible bus // master (currently in the form of a generic DMA controller). EMPHASIS ON // SIMPLE -- pipelined mode can get pretty complex if you're not careful. // // Masters and slave...
#include <bits/stdc++.h> using namespace std; int main() { long long(n), (m); scanf( %lld%lld , &(n), &(m)); ; vector<map<long long, long long>> vals(n); long long maxi = 1; for (long long i = 0; i < (m); i++) { long long(a), (b), (c); scanf( %lld%lld%lld , &(a), &(b), &(c)); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; int i = 0; vector<int> ans; ans.push_back(v[0]); ans.push_back(v[n - 1]); while (i < n - 3) { int k = v[i + 1]; int l = v[i + 2]; ...
//`#start header` -- edit after this line, do not edit this line // Copyright (C) 2013 Michael McMaster <> // // This file is part of SCSI2SD. // // SCSI2SD 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 Found...
#include <bits/stdc++.h> using namespace std; pair<long int, long int> p[500005]; bool cmp(pair<long int, long int> p1, pair<long int, long int> p2) { if (p1.second < p2.second) return true; else { if (p1.first < p2.first) return true; else return false; } } int m...
#include <bits/stdc++.h> using namespace std; int main() { int n, t = 0; string s; cin >> n; for (int i = 0; i < n; i++) { cin >> s; if (s[0] >= 0 && s[0] <= 9 ) { if (s.size() == 1 || (s.size() == 2 && s < 18 )) t++; } else if (s == ABSINTH || s == CHAMPAGNE || s =...
#include <bits/stdc++.h> using namespace std; int a[200000 + 5], b[10][200000 + 5]; int main() { int n, i; cin >> n; char c; c = getchar(); for (i = 1; i <= n; i++) { c = getchar(); if (c == R ) a[i] = 1; if (c == G ) a[i] = 2; if (c == B ) a[i] = 3; } b[1][1...
#include <bits/stdc++.h> using namespace std; using namespace std; int main() { int t; cin >> t; while (t--) { long long a, b, c, d; long long ar[6]; cin >> a >> b >> c; ar[0] = a; ar[1] = b; ar[2] = c; sort(ar, ar + 3); cout << ar[2] + 1 << endl; } ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; ++i) { int n, m, h; cin >> n >> m; long long int sum = 0; for (int j = 0; j < n; ++j) { int x; cin >> x; if (j != 0) sum = sum + x; if (j == 0) h = x...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; cout << min(max(2 * a, b) * max(2 * a, b), max(a, 2 * b) * max(a, 2 * b)) << endl; } return 0; }
`include "../rtl/adder_tree.v" `default_nettype none `timescale 1ms/1us module tb_adder_tree; parameter WORD_SIZE = 8; parameter BANK_SIZE = 4; reg clk; reg rst_n; reg [WORD_SIZE*BANK_SIZE-1:0] in; wire [(WORD_SIZE+1)*(BANK_SIZE/2)-1:0] out; adder_tree #( .WORD_SIZE(WORD_SIZE), .BANK_SIZE(BANK_SIZE) ) _a...
#include <bits/stdc++.h> using namespace std; const int N = 110000; char a[N]; int chk[N]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; cin >> a; if (n == 1) { cout << Yes << endl; return 0; } for (int i = 0; i < n; i++) chk[a[i]]++; bool flg = 1; ...
#include <bits/stdc++.h> int main() { int n, c = 0, i, s = 0, j, k = 0; scanf( %d , &n); for (i = 1; i <= n; i++) { for (j = 1; j <= i; j++) { s = s + j; if (s > n) { k = 1; break; } } c = c + 1; if (k == 1) { c--; break; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:22:01 06/14/2016 // Design Name: // Module Name: LZD_48bit // Project Name: // Target Devices: // Tool versions: // Description: // // Depen...
/* Copyright (c) 2015 Alex Forencich 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 rights to use, copy, modify, merge, publish, distribute,...
#include <bits/stdc++.h> using namespace std; inline void setmin(int &x, int y) { if (y < x) x = y; } inline void setmax(int &x, int y) { if (y > x) x = y; } inline void setmin(long long &x, long long y) { if (y < x) x = y; } inline void setmax(long long &x, long long y) { if (y > x) x =...
//Test Bench for Register File `define N 16 `define K 4 module regfile_tb; reg clk; wire [`N-1:0] a,b; reg [`N-1:0] x; reg [`K-1:0] sa, sb, d; reg ld; regfile #(.n(`N), .k(`K)) r1 (clk, x, ld, d, sa, sb, a, b); initial begin clk = 0; end initial begin $monitor("time:%t\tld: %b\tsa: %...
/* * 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 maxn = 10001; vector<int> g[maxn]; int res; int color[maxn]; int vis[maxn]; void solve(int root, int c) { vis[root] = 1; if (color[root] != c) res++; for (int i = 0; i < g[root].size(); i++) { int to = g[root][i]; if (vis[to])...
#include <bits/stdc++.h> using namespace std; int nextInt() { char c; int i; for (c = getchar(); c < 0 || c > 9 ; c = getchar()) ; for (i = c - 0 , c = getchar(); c >= 0 && c <= 9 ; i = i * 10 + c - 0 , c = getchar()) ; return i; } const int inf = 1 << 30; stru...
#include <bits/stdc++.h> template <typename T> struct ScanfSpecifier {}; template <> struct ScanfSpecifier<char*> { static constexpr const char* value = %s ; }; template <> struct ScanfSpecifier<int> { static constexpr const char* value = %d ; }; template <> struct ScanfSpecifier<double> {...
`timescale 1ns / 1ps module stackMachine #( parameter N=8, //bits parameter S=8 //stack size ) ( clk, rst, g_input, e_input, o ); input clk; input rst; input signed [N-1:0] g_input; input [2:0] e_input; output reg signed [N-1:0] o; reg signed [N-1:0] alu; reg...
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; const long long LINF = LLONG_MAX; const unsigned long long ULINF = ULLONG_MAX; const double EPS = 0.000001; char v[150][150], v_new[150][150]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int w, h; cin >> w >>...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 10:46:59 05/22/2014 // Design Name: // Module Name: pipeid // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // ...
// 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 : Sun Jan 22 23:53:58 2017 // Host : TheMosass-PC running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 998244353; int add(int x, int y) { return (x + y) % MOD; } int sub(int x, int y) { return (x + MOD - y) % MOD; } int mul(int x, int y) { return (1ll * x * y) % MOD; } int modpow(int base, int exp) { base %= MOD; in...
module wavepool_controller ( buff_wfid, buff_first, buff_ack, q_wr, reserve_slotid, reserve_valid, q_vtail_incr, halt_wfid, wf_halt, branch_wfid, branch_en, branch_taken, q_reset, feed_wfid, feed_valid, q_rd, valid_wf, decode_wfid, decode_instr_valid, clk, rst ); input [5:0] b...
/** * 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 = 2, x; cin >> x; cout << a; for (int i = 2; i < x; i++) { a += i; if (a > x) { a -= x; } cout << << a; } cout << endl; return 0; }
#include <bits/stdc++.h> using namespace std; bool isprime(int n) { if (n == 2) return 1; for (int i = 2; i < n; i++) { if (n % i == 0) return 0; } return 1; } int main() { int n, m; cin >> n >> m; int flag = 1; if (isprime(n) && isprime(m)) { for (int i = n + 1; i < ...
// // bsg_wormhole_concentrator_out.v // // 08/2019 // // This is an adapter between 1 concentrated wormhole link and N unconcentrated wormhole links. // Extra bits (cid) are used in wormhole header to indicate wormhole packet destination. // // From implementation perspective this is a simplified version bsg_wormhole...
#include <bits/stdc++.h> using namespace std; char buff[100000], *pb; int readInt() { int num = 0; while (*pb && isdigit(*pb)) { num = num * 10 + (*pb - 0 ); ++pb; } return num; } int nextChar() { int c = 0 ; if (*pb) { c = *pb; pb++; } return c; } ...
// // Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24) // // // // // Ports: // Name I/O size props // mv_read O 64 // mav_write O 64 // CLK I 1 clock // RST_N ...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: ccx_spc_rpt.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/o...
#include <bits/stdc++.h> using namespace std; const int N = 5e3 + 9; const int M = 5e4 + 9; long long read() { long long x = 0, op = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) op = -1; c = getchar(); } while (isdigit(c)) x = x * 10 + c - 48, c = getchar(); ret...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distributed in ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5; int vl[N + 2], tim, st[N + 2]; int par[N + 2], level[N + 2]; int sp[N + 2][22], n, ed[N + 2]; long long seg[5 * N], lazy[5 * N]; vector<int> adj[N + 2]; void too_lazy(int node, int lo, int hi) { seg[node] += (lazy[node] * 1LL * (hi - l...
#include <bits/stdc++.h> using namespace std; const int N = int(1e5) + 10, mod = int(1e9) + 7; const long long inf = (long long)(2e18); int n, q; vector<int> g[N]; int first[N], c[N]; long long t[N], a[N], b[N], add[N]; set<pair<long long, int> > all; multiset<long long> st[N]; set<pair<long long, 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...
module testbench(); `include "bsg_noc_links.vh" import bsg_noc_pkg::*; // Sync with trace gen localparam hdr_width_p = 32; localparam cord_width_p = 2; localparam len_width_p = 3; localparam flit_width_p = 8; localparam pr_data_width_p = 16; localparam wh_hdr_width_p = cord_width_p + len_width_p; ...
#include <bits/stdc++.h> using namespace std; int main() { int x, y, z, t1, t2, t3, ts, te; cin >> x >> y >> z >> t1 >> t2 >> t3; ts = abs(x - y) * t1; te = t3 * 2 + abs(x - z) * t2 + t3 + abs(x - y) * t2; if (ts >= te) cout << YES ; else cout << NO ; }
#include <bits/stdc++.h> #pragma GCC target( avx,avx2 ) using namespace std; using LF = double; using LL = long long; using basis = complex<LF>; const LF PI = acos(-1.0l); const int N = 125005; vector<int> rev; vector<basis> omega; inline void calc_rev(int n, int log_n) { omega.assign(n, 0); ...
/*`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:49:09 02/26/2016 // Design Name: // Module Name: dataMemory // Project Name: // Target Devices: // Tool versions: // Description: // // De...
#include <bits/stdc++.h> using namespace std; struct query { int t = 0, row = 0, col = 0; long long x = 0; }; int n, m; vector<vector<long long>> mat; void rotate_row(int row) { long long temp = mat[row][m]; for (int i = m; i > 1; i--) { mat[row][i] = mat[row][i - 1]; } mat[row...
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; while (cin >> n >> m) { long long num, sum = 0, minx = 1000000001; for (long long i = 0; i < n; i++) { cin >> num; sum += num; if (num < minx) minx = num; } if (sum < m) 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; int main() { int n, a, b, c; while (cin >> n >> a >> b >> c) { int s = a + b + c; double ans = (1.0 * n / s); if (a == 0 && b == 0 && c == 0) printf( %.1lf %.1lf %.1lf n , 0.0, 0.0, 0.0); else printf( %.16f %.16f %.16f 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...
/** * 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...
// synthesis verilog_version verilog_2001 `timescale 1 ps / 1 ps //----------------------------------------------------------------------------- // Title : PCI Express Reference Design Example Application // Project : PCI Express MegaCore function //------------------------------------------------------...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int q, n, m; cin >> q; while (q--) { cin >> n >> m; string s; cin >> s; long long int a[n + 1], b[n + 1], zero = 0, one = 0; a[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...
// ============================================================== // File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2016.2 // Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved. // // ============================================================== `timescale 1ns/1ps ...
#include <bits/stdc++.h> using namespace std; const int N = 400010; const int P = 10000007; int m, n; char str[N]; char ans[N]; int l[N], r[N]; int p[N]; bool ok(int i, int m) { if (++i < m) return 0; return (r[i] - r[i - m]) == ((l[i] - l[i - m] * p[m]) * p[i - m]); } int dfs(int i, int i...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:12:55 03/10/2015 // Design Name: counter_modN // Module Name: /home/vka/Programming/VHDL/workspace/test/tb_counter_modN.v // Project Name: test // Target Device: ...
// (c) Copyright 1995-2012 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 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...
/** * 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; long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; } enum dir { DOWN = 0, UP, RIGHT, LEFT, DOWN_RIGHT, DOWN_LEFT, UP_RIGHT, UP_LEFT }; i...
/* * Copyright 2013-2016 Colin Weltin-Wu () * UC San Diego Integrated Signal Processing Group * * Licensed under GNU General Public License 3.0 or later. * Some rights reserved. See LICENSE. * * spi_core.v * * General SPI interface * Services the 4 SPI modes defined as (CPOL,CPHA) * See: http://en.wikiped...
#include <bits/stdc++.h> using namespace std; void input(long long int n, long long int a[]) { for (long long int i = 0; i < n; ++i) cin >> a[i]; } long long int bin_expo(long long int A, long long int B, long long int M) { long long int result = 1ll; while (B > 0) { if (B % 2 == 1) { ...
// -- (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...
/** * 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...
#include <bits/stdc++.h> using namespace std; inline long long int c(long long int n, long long int i) { if (i == 0) return 1; else if (i == 1) return n; else if (i == 2) return (n * (n - 1)) / 2; else if (i == 3) return (n * (n - 1) * (n - 2)) / 6; else if (i == 4) ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 20; unsigned long long bit[N][20], ans, s; int main() { int n, k, a; cin >> n >> k; for (int x = 1; x < N; x += x & (-x)) bit[x][0]++; for (int i = 0; i < n; i++) { cin >> a; for (int j = k + 1; j > 0; j--) { s...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2000 + 10; const int MOD = (int)(1e9) + 7; vector<int> adj[MAXN]; int a[MAXN], f[MAXN]; bool visited[MAXN]; int d, n; void DFS(int u, int root) { visited[u] = true; f[u] = 1; for (int i = 0; i < adj[u].size(); i++) { int v ...
#include <bits/stdc++.h> using namespace std; long long n, m, b, mod, a[509], dp[509][509], ans; int main() { cin >> n >> m >> b >> mod; dp[0][0] = 1; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) { for (int j = 1; j <= m; j++) { for (int k = 0; k <= b - a[i]; ...
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v; int n, i, j, k, len, x, y, c, a[1020] = {0}; cin >> n; if (n == 1) { cout << 0 << endl; return 0; } a[1] = 1; for (i = 2; i <= 1000; i++) { c = 2; for (j = i * c; j <= 1000; j = i * c) { ...
#include <bits/stdc++.h> using namespace std; const int MAXPOW = 20; const int MAXA = 1048577; const int MAXN = 100009; int n; int k; vector<int> a; unordered_set<int> visited[MAXN]; bool used[MAXA]; void gen() { freopen( input.txt , w , stdout); n = 100000; printf( %d n , n); for (...
#include <bits/stdc++.h> using namespace std; const int N = 100100; const long long INF = 1000 * 1000 * 1000LL * 1000 * 1000; vector<pair<int, int> > adj1[N]; vector<pair<long long, pair<int, int> > > e; set<pair<long long, int> > s; long long d[N]; int p[N], par[N], sz[N], flag(1); void Dijkstra() { ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int a[1000]{}; for (int i = 0; i < t; i++) { int n, s, k; cin >> n >> s >> k; set<int> b; for (int j = 0; j < k; j++) { cin >> a[j]; b.insert(a[j]); } int ans = n; fo...
#include <bits/stdc++.h> using namespace std; using Int = long long; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << ( << a.first << , << a.second << ) ; }; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << ...
//////////////////////////////////////////////////////////////////////////////// module vga_dis( input clk, //50MHz input rst_n, //µÍµçƽ¸´Î» input[15:0] ZBcode, output valid, //ÓÐЧÏÔÊ¾Çø±êÖ¾ output[9:0] xpos,//ÓÐЧÏÔÊ¾Çø×ø±ê output[9:0] ypos, output hsync, //ÐÐͬ²½ÐźŠoutput vsync, //³¡Í¬²½ÐźŠoutput vga_r, output...
#include <bits/stdc++.h> using namespace std; const int d[][2] = {{1, -1}, {1, 1}, {-1, -1}, {-1, 1}}; const char* ds[] = { DL , DR , UL , UR }; int gdi(const char* s) { int i = -1; while (++i < 4) { if (!strcmp(s, ds[i])) return i; } } bool sv[4] = {false}; int fdi(const int dr, cons...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_never_unknown (clock, reset, enable, qualifier, test_expr, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter width = 1; param...
/* $Id: aemb2.v,v 1.3 2007/12/28 21:44:50 sybreon Exp $ ** ** AEMB2 TEST BENCH ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <> ** ** This file is part of AEMB. ** ** AEMB is free software: you can redistribute it and/or modify it ** under the terms of the GNU Lesser General Public License as ** published by the Fre...
#include <bits/stdc++.h> using namespace std; template <typename T> T abs(T x) { return x > 0 ? x : -x; } char a[2005][2005]; bool used[2005][2005]; queue<pair<int, int> > q; int nu() { puts( Not unique ); return 0; } bool impasse(int ic, int jc) { int cnt = 0; cnt += (a[ic][jc -...
//when there is a mis-prediction or jump, need to restore the PRs allocated for younger instructions //will consider this later module free_list_new( input [5:0] PR_old, //the previous physical register that needs to be freed when current instruction retires input RegDest_retire, input retire_reg, //from...
#include <bits/stdc++.h> using namespace std; const long long base = 1E9 + 7; const int N = 200100; const double ep = 0.0000001; int n; long long x[N], y[N]; long long cx = 0, cy = 0; void fail() { cout << NO ; exit(0); } bool symmetric(int i, int j) { long long x1 = cx - x[i] * n; ...
#include <bits/stdc++.h> using namespace std; const int maxn = 7 + 5; int n, a[maxn]; char str[maxn]; int main() { cin >> n; int ans = 0; while (n--) { cin >> str; for (int i = 0; i < 7; i++) { a[i] += str[i] - 0 ; ans = max(ans, a[i]); } } cout << ans <<...
/** * 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 maxn = 2e5 + 5; int a[maxn], b[maxn], ww[maxn], www[maxn]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &a[i]); ww[a[i]] = 1; } for (int i = 1; i <= n; i++) { scanf( %d , &b[i]); ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:33:46 01/07/2015 // Design Name: uart // Module Name: E:/Study/PentiumX/Hardware/PentiumX_OnSoC/test_uart.v // Project Name: PentiumX_OnSoC // Target Device: //...
#include <bits/stdc++.h> using namespace std; const long long N = 1e6; const long long mod = 1e9 + 7; vector<long long> primes; bool not_prime[N]; void sieve_of_eratosthenes(long long n) { for (long long i = 2; i < N; i++) { if (not_prime[i]) continue; primes.push_back(i); for (long lo...
/** * 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 (C) 2009-2012 Chris McClelland // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This ...
module top; reg [1:0] a, b, c, d, e; reg passed; initial begin a = 2'b00; b = 2'b00; c = 2'b00; d = 2'b00; e = 2'b00; passed =1'b1; #2; // Check that only the first process has run so far. if (a !== 2'b01) begin $display("First process in named fork has not run: %b", a);...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 1111111; const int N = 105; const int M = 25; int cmp(int a, int b) { return a > b; } int n, m, s[N], c[M], t[M], dp[MAXN], st; void init() { memset(dp, INF, sizeof(dp)); scanf( %d , &n); for (int i = ...
`include "system.v" module hdmi_video ( input CLOCK_50_i, input reset_i, output hdmi_clk_o, output hdmi_de_o, output hdmi_vs_o, output hdmi_hs_o, output [23:0] hdmi_d_o, output [15:0] a_o, output vram_clk_o, input [23:0] color_dat_i, output [2:0] video_pixel_o, output border_o, input [15:0] video_offset_i...
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool upmin(T &x, T y) { return y < x ? x = y, 1 : 0; } template <typename T> inline bool upmax(T &x, T y) { return x < y ? x = y, 1 : 0; } const long double eps = 1e-11; const long double pi = acos(-1); const long lon...
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1}; int dy8[] = {1, -1, -1, 0, 1, -1, 0, 1}; int kx8[] = {1, 1, 2, 2, -1, -1, -2, -2}; int ky8[] = {...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_5_32.v // Megafunction Name(s): // scfifo // // Simulation Library Files(s): // altera_mf // =================================...
/** * 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...