text
stringlengths
59
71.4k
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2018, Darryl Ring. // // 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...
#include <bits/stdc++.h> using namespace std; vector<int> vv[3001]; int graf[3001][3001]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int f, t; cin >> f >> t; vv[f].push_back(t); graf[f][t] = 1; } long long ans(0); for (int a = 1; a <= n; a...
`timescale 1ns / 1ps // Documented Verilog UART // Copyright (C) 2010 Timothy Goddard () // Distributed under the MIT licence. // // 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 re...
/***************************************************************************** * File : processing_system7_bfm_v2_0_fmsw_gp.v * * Date : 2012-11 * * Description : Mimics FMSW switch. * *****************************************************************************/ `timescale 1ns/1ps module processing_system7_bf...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 10; long long n, k; int main() { scanf( %I64d%I64d , &n, &k); long long x; x = sqrt(9 + 8 * (n + k)) - 3; x /= 2; printf( %I64d n , n - x); return 0; }
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016 // Date : Mon Sep 18 12:32:27 2017 // Host : vldmr-PC running 64-bit Service Pack 1 ...
module hvsync_generator(clk, vga_h_sync, vga_v_sync, inDisplayArea, CounterX, CounterY); input clk; output vga_h_sync, vga_v_sync; output inDisplayArea; output [10:0] CounterX; output [10:0] CounterY; //// VGA mode 800x600x75Hz ///// //// pixel freq: 49.5MHz (should be input clk) //// visible pixels: 800 //// visible ...
//bug844 module device( input clk, output logic [7:0] Q, out0, output logic pass, fail input [7:0] D, in0,in1 ); enum logic [2:0] {IDLE, START, RUN, PASS, FAIL } state, next_state; logic ready, next_ready; logic next_pass, n...
#include <bits/stdc++.h> using namespace std; const int N = 1e5; int type[N], n, p[N], out[N]; int go(int u, bool print = false) { int res = p[u] == -1 || out[p[u]] > 1 ? 1 : go(p[u], print) + 1; if (print) cout << u + 1 << ; return res; } int main() { cin >> n; for (int i = 0; i < n;...
// // Generated by Bluespec Compiler, version 2018.10.beta1 (build e1df8052c, 2018-10-17) // // // // // Ports: // Name I/O size props // RDY_mem_server_request_put O 1 reg // mem_server_response_get O 256 reg // RDY_mem_server_response_get O 1 reg // CLK ...
/****************************************************************************** * License Agreement * * * * Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. * ...
#include <bits/stdc++.h> template <class T> T _diff(T a, T b) { return (a < b ? b - a : a - b); } template <class T> T _abs(T a) { return (a < 0 ? -a : a); } template <class T> T _max(T a, T b) { return (a > b ? a : b); } template <class T> T _min(T a, T b) { return (a < b ? a : 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 law...
// Simple 8-bit UART receiver // Author: Ross MacArthur (https://github.com/rossmacarthur) // Description: // - Samples input line at 16 time the baudrate // - Receives data in 8-bit chunks, LSB first // - No parity // - Single start and stop bit module UART_RX ( input clk, // 16 * baudrate input rst, ...
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-7; const int inf = 1000000010; const int mod = 1000000007; const int MAXN = 1010; int n, m, t, x, y, xx, yy, ans, v, u, q, a, b, c, cnt; string A[MAXN]; int dist[MAXN][MAXN]; int main() { ios_base::sync_with_stdio(false); ...
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); } int lcm(int a, int b) { return a * (b / gcd(a, b)); } const int maxSize = 100000 + 5; int main() { int n, k; cin >> n >> k; vector<long long int> arr(n); for (int i = 0; i < n; i++) { ...
//------------------------------------------------------------------------------ // // Copyright 2011, Benjamin Gelb. All Rights Reserved. // See LICENSE file for copying permission. // //------------------------------------------------------------------------------ // // Author: Ben Gelb () // // Brief Description: //...
/** * 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: Adam LLC // Engineer: Adam Michael // // Create Date: 18:41:38 09/19/2015 // Design Name: hw2problem3 // Module Name: C:/Users/adam/Documents/GitHub/Digital Systems/hw2problem3/hw2problem3Test.v // P...
/*============================================================================ This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point Arithmetic Package, Release 1, by John R. Hauser. Copyright 2019 The Regents of the University of California. All rights reserved. Redistribution an...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( tune=native ) #pragma GCC optimize( fast-math ) using namespace std; const int DEBUG = 0; mt19937 gen( (unsigned)chrono::high_resolution_clock::now().time_since_epoch().count()); #pragma comment(linker, /STACK:16777216 ) void...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int tichnas; cin >> tichnas; while (tichnas--) { long long n, c, m, maxs = 1e9, temp, ans; map<long long, long long> type; bool possible; cin >> n; for (int i...
//----------------------------------------------------------------------------- // // (c) Copyright 2009-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...
#include <bits/stdc++.h> using namespace std; struct __timestamper {}; const int MAXN = 100100; int val[MAXN]; long long dp[MAXN][4]; vector<int> g[MAXN]; void dfs(int v, int p) { for (int u : g[v]) if (u != p) dfs(u, v); long long max0 = 0, smax0 = 0, tmax0 = 0; int max0v = -1, smax0v =...
#include <bits/stdc++.h> using namespace std; int n, b, i, rez, a[2013], minn[2013], maxx[2013]; int main() { minn[0] = 123456890; cin >> n >> b; for (i = 1; i <= n; ++i) { cin >> a[i]; minn[i] = min(minn[i - 1], a[i]); } for (i = n; i >= 1; --i) { maxx[i] = max(maxx[i + 1], ...
#include <bits/stdc++.h> using namespace std; int n, d; string s, t; map<pair<char, char>, vector<int> > M; map<char, vector<int> > N; int main() { ios_base::sync_with_stdio(false); cin >> n >> s >> t; d = 0; for (int i = 0; i < n; ++i) { if (s[i] != t[i]) { M[make_pair(s[i], t...
/** * 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[3], b[3]; for (int i = 0; i < 3; i++) cin >> a[i] >> b[i]; bool flag = false; for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int p = 0; p < 2; p++) { if (max(a[1], a[2]) <= a[0] && b[1] + b[2] ...
#include <bits/stdc++.h> using namespace std; constexpr int64_t P0 = 2000003; constexpr int64_t P1 = 2000017; constexpr int64_t M0 = 3000000000013; constexpr int64_t M1 = 2000000000003; class TaskC { public: struct Class { int id; int cnt; }; struct Hash { int64_t a, b; ...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Tue Sep 19 09:38:42 2017 // Host : DarkCube running 64-bit major release ...
////////////////////////////////////////////////////////////////////////////////// // AutoFIFOPopControl for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Kibin Park <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD. // // Cosmos OpenSSD is free software...
#include <bits/stdc++.h> using namespace std; int n, t; int dp[21][5][11][11][2]; int solve(int pos, int h, int mn, int mx, bool w) { if (mn > t - 1 || mx > t) return 0; if (pos == n) return mx == t && mn == t - 1; int &ref = dp[pos][h][mn][mx][w]; if (ref != -1) return ref; ref = 0; for...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<long long> vec(n + 1); for (int i = 1; i <= n; i++) cin >> vec[i]; vector<long long> a; for (int i = 1; i < n; i++) { if (i & 1) a.pu...
// DEFINES `define BITS 8 // Bit width of the operands `define B2TS 16 // Bit width of the operands `define SWITCH 0 // No available documentation provides for macros without values so we use 0 `define NEST 0 module bm_base_multiply(clock, reset_n, a_in, b_in, c_in, d_in, e_in, f_in, o...
/* * The nice thing about defines that are not possible with parameters is that * you can pull defines to an external file and have all the defines in one * place. This can be accomplished with parameters and UCF files but that * would be vendor specific */ `define FX3_READ_START_LATENCY 1 `define FX3_WRITE_FU...
#include <bits/stdc++.h> using namespace std; void populate(string& s, char c, int n) { for (int i = 0; i < n; ++i) s[s.find_first_of( ? )] = c; } int main() { ios::sync_with_stdio(0); int n; cin >> n; string s; cin >> s; auto na = count(s.begin(), s.end(), A ); auto nc = count(...
#include <bits/stdc++.h> using namespace std; #define all(cont) cont.begin(), cont.end() #define rall(cont) cont.end(), cont.begin() #define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++) #define IN(A, B, C) assert(B <= A && A <= C) #define SORT(v) sort(v.begin(), v.end()) #define MP ma...
#include <bits/stdc++.h> using namespace std; const int MAXN = 200005; int v[MAXN], l[MAXN], r[MAXN]; int ST[4 * MAXN]; int L[4 * MAXN]; int n; void _update(int node, int lo, int hi, int i, int j, int val) { if (L[node]) { ST[node] = max(ST[node], L[node]); if (hi != lo) { L[2 * no...
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<std::vector<int>> a(n, std::vector<int>(n)); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { a[i][j] = 4 * (i % (n / 2) * (n / 2) + j ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> adj[n], in[n]; int ot[n]; for (int i = 0; i < n; i++) ot[i] = 0; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; x--; y--; adj[x].push_back(y); in[y].pus...
#include <bits/stdc++.h> using namespace std; vector<long long> sieve(long long n) { long long *arr = new long long[n + 1](); vector<long long> vect; for (long long i = 2; i <= n; i++) if (arr[i] == 0) { vect.push_back(i); for (long long j = 2 * i; j <= n; j += i) arr[j] = 1; ...
#include <bits/stdc++.h> using namespace std; void solve(const int &test_id) { int n, p, k; cin >> n >> p >> k; vector<pair<long long, int> > aud(n); for (int i = 0; i < n; i++) cin >> aud[i].first, aud[i].second = i; sort(aud.rbegin(), aud.rend()); vector<int> twos(p + 1); for (int i = ...
#include <bits/stdc++.h> int luckyDigits(long long int *a) { int count1 = 0, dig; while (*a != 0) { dig = *a % 10; if (dig == 4 || dig == 7) { count1++; } *a = *a / 10; } return count1; } int main() { long long int i, j, k, n, a, count = 0; scanf( %lld%lld ,...
// $Id: c_wf_alloc_rep.v 1534 2009-09-16 16:10:23Z 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...
#include <bits/stdc++.h> using namespace std; void Freopen() { freopen( title .in , r , stdin); freopen( title .out , w , stdout); } int read() { int g = 0, f = 1; char ch = getchar(); while (ch < 0 || 9 < ch) { if (ch == - )...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5, M = 2e4 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7; void Print(int *a, int n) { for (int i = 1; i < n; i++) printf( %d , a[i]); printf( %d n , a[n]); } int e[N], nt[N]; void Gnt(string a, int *nt) { int k = 0, p = 0, n = (int)a.size...
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; for (int i = 0; i < q; i++) { int n; cin >> n; int gnum; while (1) { gnum = n; while (gnum > 0) { if (gnum % 3 == 2) { break; } gnum = gnum / 3; ...
// // Copyright (c) 1999 Steven Wilson () // // 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) // ...
// ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // // Revision Control Information // // $RCSfile: altera_tse_gxb_gige_inst.v,v $ // $Source: /ipbu/cvs/sio/projects/TriSpeedEthernet/src/RTL/Top_level_modules/...
#include <bits/stdc++.h> using namespace std; int poww(int a, int b) { for (int i = 0; i < b; i++) a *= a; return a; } int main() { int n, t; cin >> n; if (n < 10) { cout << n << endl; return 0; } long long i = 2; long long sum = 9; long long x = 10, v[] = {999999...
#include <bits/stdc++.h> using namespace std; int a, b, k, t, suan, d[1100002], f[1110000]; int main() { cin >> a >> b >> k >> t; int shu = k * 2 * t; d[shu] = 1; int y = d[0]; for (int i = 1; i <= t * 2; i++) { f[0] = y; for (int j = 1; j <= shu * 2 + k; j++) { f[j] = (f[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...
/** * 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 <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } 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; const long double EPS = 1e-8; const long double INF = 1e12; const long double PI = acos(-1); struct L : array<complex<long double>, 2> { L(const complex<long double>& a, const complex<long double>& b) { at(0) = a; at(1) = b; } L() {} }; ...
/* * CameraOneFrame architecture * * Copyright (c) 2014, * Luca Maggiani <>, * Scuola Superiore Sant'Anna (http://www.sssup.it) and * Consorzio Nazionale Interuniversitario per le Telecomunicazioni * (http://www.cnit.it). * * All rights reserved. * * Redistribution and use in source and binary forms, ...
// megafunction wizard: %LPM_COUNTER% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_COUNTER // ============================================================ // File Name: coincidence_counter.v // Megafunction Name(s): // LPM_COUNTER // // Simulation Library Files(s): // lpm // ========================...
/* * Copyright (c) 2003 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 "../include/tune.v" // Pentevo project (c) NedoPC 2011 // // fetches video data for renderer module video_fetch( input wire clk, // 28 MHz clock input wire cend, // general input wire pre_cend, // synchronization input wire vpix, // vertical wi...
/* * 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; long long read() { long long sign = 1, x = 0; char s = getchar(); while (s > 9 || s < 0 ) { if (s == - ) sign = -1; s = getchar(); } while (s >= 0 && s <= 9 ) { x = (x << 3) + (x << 1) + s - 0 ; s = getchar(); } ...
#include <bits/stdc++.h> using namespace std; int a[100001]; int main() { ios::sync_with_stdio(0); int n, mn = 1e9; cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; mn = min(mn, a[i]); } int last = -1; int ans = n + 1e1; for (int i = 1; i <= n; ++i) { if (a[i...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long power(long long a, long long b, long long m = mod) { long long x = 1; while (b) { if (b & 1) { x = 1ll * x * a % m; } a = 1ll * a * a % m; b /= 2; } return x; } const int N = ...
#include <bits/stdc++.h> int main() { char a[1000005]; scanf( %s , a); int i; long long ans = 0, b = 0; for (i = strlen(a) - 1; i >= 0; i--) { if (a[i] == b ) b++; else if (a[i] == a ) { ans += b; b <<= 1; } ans %= 1000000007; b %= 1000000007...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e18; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, x, y, s1, s2, i, j, a, b, c, r = 0; cin >> n >> s1 >> s2; long long x1[n + 1], x2[n + 1], y1[n + 1], y2[n + 1]; for (i = 1; 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; const int DIM = 1e5 + 5; int szt[DIM], ans[DIM]; vector<int> edg[DIM]; map<int, int> son, par, out; void dfs1(int x, int sz) { szt[x] = 1; for (int y : edg[x]) { dfs1(y, sz); szt[x] += szt[y]; } out[szt[x]]++; ans[x] = sz - 1; ...
#include <bits/stdc++.h> using namespace std; struct point { int x, y; } a[200005]; bool cmp(struct point A, struct point B) { if (A.x != B.x) return A.x < B.x; return A.y < B.y; } int m; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { scanf( %d , &a[i].x); ...
#include <bits/stdc++.h> using namespace std; long long int powe(long long int d, long long int s) { if (s == 1) return d; else if (s == 0) return 1; else { long long int u, v = d; for (u = 1; u < s; u++) { d = d * v; } return d; } } bool isprime(long ...
// (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 ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long INFL = 0x3f3f3f3f3f3f3f3fLL; struct Edge { int src, dst; int weight; Edge(int src_, int dst_, int weight_) : src(src_), dst(dst_), weight(weight_) {} Edge(int dst_, int weight_) : src(-2), dst(dst_)...
/* 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,...
module ADT7310P32S16 ( (* intersynth_port="Reset_n_i" *) input Reset_n_i, (* intersynth_port="Clk_i" *) input Clk_i, (* intersynth_port="ReconfModuleIn_s", intersynth_conntype="Bit" *) input Enable_i, (* intersynth_port="ReconfModuleIRQs_s", intersynth_conntype="Bit" *) output CpuIntr_o, (* inters...
////////////////////////////////////////////////////////////////////// //// //// //// uart_sync_flops.v //// //// //// //// ...
// 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:54:06 2017 // Host : TheMosass-PC running 64-bit major release ...
/*------------------------------------------------------------------------------ * This code was generated by Spiral Multiplier Block Generator, www.spiral.net * Copyright (c) 2006, Carnegie Mellon University * All rights reserved. * The code is distributed under a BSD style license * (see http://www.opensource.or...
#include <bits/stdc++.h> using namespace std; int t, s, p; int main() { scanf( %d %d %d , &t, &s, &p); int l = t; int x1 = 0, x2 = s; int co = 1; while (x1 < l) { x1 = x1 + p; x2 = x2 + p - 1; if (x1 >= l && x2 >= l) break; else if (x1 >= x2) { x1 = 0; ...
#include <bits/stdc++.h> const int base = 1000000000; const int base_digits = 9; struct bigint { std::vector<int> z; int sign; bigint() : sign(1) {} bigint(long long v) { *this = v; } bigint(const std::string &s) { read(s); } void operator=(const bigint &v) { sign = v.sign; z =...
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c...
#include <bits/stdc++.h> using namespace std; const int N = 203600; pair<pair<int, int>, int> p[N]; int n; vector<int> ans; int main() { cin >> n; for (int i = (0); i < (int)(n); i++) { cin >> p[i].first.first >> p[i].first.second; p[i].second = i + 1; } sort(p, p + n); for (...
// megafunction wizard: %LPM_CONSTANT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_constant // ============================================================ // File Name: lpm_constant2.v // Megafunction Name(s): // lpm_constant // // Simulation Library Files(s): // lpm // =======================...
`include "../lib/mux_2to1.v" module mux32bit_2to1(input [31:0] i0, i1, input s, output [31:0] z); mux_2to1 mux0 (.i0(i0[0 ]), .i1(i1[0 ]), .z(z[0 ]), .s(s)); mux_2to1 mux1 (.i0(i0[1 ]), .i1(i1[1 ]), .z(z[1 ]), .s(s)); mux_2to1 mux2 (.i0(i0[2 ]), .i1(i1[2 ]), .z(z[2 ]), .s...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n < 998) cout << n + 2; else cout << n - 2; }
/* * 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 law...
//TODO: make memory do... something... when given an address not in range 0x80020000 -> (0x80020000 + Memory Size) module mips_memory (clk, addr, din, dout, access_size, rw, busy, enable); parameter MEMSIZE = 1024; parameter START_ADDR = 32'h8002_0000; // h80020000 // input input clk; input [31:0] addr;...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: sparc_ifu_thrcmpl.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...
/** * 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 2011-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 g...
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2014 Francis Bruno, All Rights Reserved // // 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 Found...
// Quartus Prime Verilog Template // Single port RAM with single read/write address and initial contents // specified with an initial block module phyIniCommand0_and #(parameter DATA_WIDTH=16, parameter ADDR_WIDTH=4) ( input [(DATA_WIDTH-1):0] data, input [(ADDR_WIDTH-1):0] addr, input we, clk, ...
#include <bits/stdc++.h> using namespace std; const int N = 100010; vector<int> vec[N], fenw[N]; int n, k, x[N], r[N], f[N], id[N], rev[N]; void update(int who, int p, int v) { while (p < fenw[who].size()) fenw[who][p] += v, p += p & -p; } int pref(int who, int p) { int ret = 0; while (p) ret ...
/** * 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 i, n, k, s = 0, m; vector<pair<int, int> > v(110); scanf( %d , &n); scanf( %d , &k); for (i = 0; i < n; ++i) { scanf( %d , &v[i].first); v[i].second = i + 1; } sort(v.begin(), v.begin() + n); for (i = 0; s <= ...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) constexpr auto INF = 9223372036854775807; using namespace std; struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; ...
////////////////////////////////////////////////////////////////////////////////// // d_KES_PE_ELU_MINodr.v for Cosmos OpenSSD // Copyright (c) 2015 Hanyang University ENC Lab. // Contributed by Jinwoo Jeong <> // Ilyong Jung <> // Yong Ho Song <> // // This file is part of Cosmos OpenSSD....
module FSM_Ctrol ( input RST, // Reset maestro input CLK, // Reloj maestro input STM, // Iniciar multiplicacion output reg[7:0] ENa, // Habilitaciones Ra output reg[7:0] ENb, // Habilitaciones Rb output reg[7:0] ENc, // Habilitaciones Rc output reg[7:0] SEL, // Selectores Mux output reg ...
Require Import JMeq ProofIrrelevance FunctionalExtensionality. Require Export Notations SpecializedCategory Category. Require Import Common StructureEquality FEqualDep. Set Implicit Arguments. Generalizable All Variables. Set Asymmetric Patterns. Set Universe Polymorphism. Local Infix "==" := JMeq. Section Specia...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = n - 1; i >= 0; --i) { int temp = i % 2 != 0 ? -a[i] : a[i]; cout << t...