text
stringlengths
59
71.4k
`include "assert.vh" module cpu_tb(); reg clk = 0; // // ROM // localparam MEM_ADDR = 4; localparam MEM_EXTRA = 4; reg [ MEM_ADDR :0] mem_addr; reg [ MEM_EXTRA-1:0] mem_extra; reg [ MEM_ADDR :0] rom_lower_bound = 0; reg [ MEM_ADDR :0] rom_upper_bound = ~0; wire [2...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; constexpr int N = 1e2 + 5; int n, m, k, g[N][N], ans = -1, id; unordered_set<int> dp[N][N]; char c; bool check(int i, int j, int val) { for (auto el : dp[i][j]) { if (ans == el + val) { ans ...
#include <bits/stdc++.h> using namespace std; const long double PI = 3.14159265358979323846264338327950288419716939937510, EPS = 1e-9; const int MAX = 1 << 17; struct prav { long double a, b, c; }; pair<int, int> sred; long double Sq(long double x) { return x * x; } long double D...
/** * 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; const int N = 1e5 + 7, mod = 1e9 + 7; int dp[N], sum[N], i, n, m, j, k, nxt[N], v[N]; char a[N], b[N]; int main() { for (scanf( %s%s , a + 1, b + 1), n = strlen(a + 1), m = strlen(b + 1), i = 2; i <= m; ++i) { while (b[j + 1] != b[i] && j) j = n...
#include <bits/stdc++.h> using namespace std; int n, m, x; void ans(int x1, int x2, int y1, int y2, int now) { if (x1 + 1 > x2 - 1 || y1 + 1 > y2 - 1) { cout << 0; return; } else { if (now + 1 == x) { if ((x2 - x1 - 1) == 1 || (y2 - y1 - 1) == 1) { if ((x2 - x1 - 1) == ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 05/30/2017 01:38:40 PM // Design Name: // Module Name: SHA1_core_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // ...
#include <bits/stdc++.h> using namespace std; const long long maxn = 100005; const long long p = 1e9 + 7; long long a[maxn], n, x, sum; long long st[maxn], top; vector<long long> v; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == -...
#include <bits/stdc++.h> using namespace std; int q; int cnt[1 << 20]; int trans(long long v) { int rt = 0; for (int i = 0; i < 18; i++, v /= 10) { if ((v % 10) & 1) { rt |= 1 << i; } } return rt; } void insert(long long v) { cnt[trans(v)]++; } void erase(long long v) {...
////////////////////////////////////////////////////////////////////// //// //// //// spi_shift.v //// //// //// //// This file is part of the SPI I...
#include <bits/stdc++.h> using namespace std; long long mult(long long a, long long b, long long p = 1000000007) { return ((a % p) * (b % p)) % p; } long long add(long long a, long long b, long long p = 1000000007) { return (a % p + b % p) % p; } long long fpow(long long n, long long k, long long p ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(NULL); int n, x; cin >> n; while (n--) { cin >> x; if (x < 3 || x == 4 || x == 5 || x == 8 || x == 11) cout << NO << endl; else cout << YES << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; const int MX = 35; bitset<MX * MX> bs[MX * MX]; int n, a[MX][MX], m, sz, h, res; void impr() { for (int k = 0; k < m; k++) { cout << k << : << n ; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) cout << bs[k][((i)*n + (j))] <...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Inverse_Clarke_Transform.v // Created: 2014-09-08 14:12:04 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // ----------------------------------------------------...
#include <bits/stdc++.h> using namespace std; template <typename T> void print1d(vector<T> &a) { for (long long int i = 0; i < a.size(); i++) { cout << a[i] << ; } cout << endl; } vector<long long int> divisor(long long int n) { vector<long long int> a; for (long long int i = 1; i...
//This defines a very simple testbench for the instruction cacher. //It is intended to work with "real world" access data in order to provide statistics for //hits, misses, and whether the cache actually flipping works. module instructioncache_tb(); reg [31:0] requestedAddresses [0:5000]; reg [31:0] addressCounter; w...
//---------------------------------------------------------------------------- // DCR_IF Controller - DCR Bus Interface //----------------------------------------------------------------------------- // // XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" // SOLELY FOR USE IN DEVELOPING PROGRAM...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: bg5.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ================================...
//------------------------------------------------------------------- //-- sectones_tb.v //-- Banco de pruebas para el secuenciador de 4 notas //------------------------------------------------------------------- //-- BQ August 2015. Written by Juan Gonzalez (Obijuan) //-------------------------------------------------...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, m, k, fa[N], cnt[N], vis[N]; vector<int> G[N]; vector<pair<int, int> > p, q[N]; int findset(int x) { return x == fa[x] ? x : fa[x] = findset(fa[x]); } void dfs(int x) { vis[x] = 1; for (auto it : G[x]) dfs(it); for (au...
`default_nettype none `include "core.h" module execute_logic_decode( input wire [4:0] iPREV_INST, output wire [4:0] oNEXT_INST ); function [4:0] func_logic_select; input [4:0] func_logic_select_cmd; begin case(func_logic_select_cmd) `EXE_LOGIC_BUFFER0 : func_logic_select = 5'h00; `EXE_LOGIC...
/*module spi_rcv(CLK, SCK, MOSI, MISO, SSEL, LED); input wire CLK, SCK, SSEL, MOSI; output wire MISO, LED; wire [7:0] MSG; spi_slave spi1(.CLK(CLK), .SCK(SCK), .MOSI(MOSI), .MISO(MISO), .SSEL(SSEL), .MSG(MSG)); assign LED = (MSG==8'b11111111);*/ module spi_rc...
#include <bits/stdc++.h> using namespace std; int main() { long long t1, t2, x1, x2, t0, y1, y2; cin >> t1 >> t2 >> x1 >> x2 >> t0; if (t1 == t2) cout << x1 << << x2 << endl; else if (t1 == t0) cout << x1 << << 0 << endl; else if (t2 == t0) cout << 0 << << x2 << end...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long N = 2e5 + 5; long long gcd(long long n, long long m) { if (n == 0) return m; else return gcd(m % n, n); } long long a[105], b[105]; vector<pair<long long, long long> > v1, v2; long long dp[10...
#include <bits/stdc++.h> using namespace std; string s, u; stack<char> t; vector<char> mins; int main() { cin >> s; u = ; int inicio = 0, tam = s.length(); char ant = z + 1; for (int i = tam - 1; i >= 0; i--) { ant = min(ant, s[i]); mins.push_back(ant); } reverse(mi...
(* Copyright © 2006-2008 Russell O’Connor Copyright © 2020 Vincent Semeria Permission is hereby granted, free of charge, to any person obtaining a copy of this proof and associated documentation files (the "Proof"), to deal in the Proof without restriction, including without limitation the rights to use, copy, modify,...
#include <bits/stdc++.h> using namespace std; int dfs(int n) {} int main() { int n, k, x, y, a[200200], b[200200]; cin >> n >> k; vector<vector<int> > v(n, vector<int>()); for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; } for (int i = 0; i < k; i++) { cin >> x >> ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int n; double res; double x[60006], v[60006]; bool ok(double t) { double l, r; l = 1e-9; r = 1e9; for (int i = 1; i <= n; ++i) { double m = t * v[i]; l = max(l, x[i] - m); r = min(r, x[i] + m); } ...
/** * 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 = 200005, P = 1e9 + 7; int dp[N][3], val[3], n; int add(int a, int b) { return (a += b) >= P ? a - P : a; } int qpow(int a, int b) { int res = 1; while (b) { if (b & 1) res = 1ll * res * a % P; a = 1ll * a * a % P; b >>= 1; ...
#include <bits/stdc++.h> using namespace std; const long long int N = 1e5; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int tc = 1; for (long long int T = 1; T <= tc; T++) { long long int n; cin >> n; string s; cin >> s; 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2015 by Varun Koyyalagunta. // bug1015 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Take CRC data a...
// This is the second part of a two-part test that checks that the argument to // a $signed or $unsigned function is treated as a self-determined expression. // This part performs tests where the argument is signed. module pr2922063b; reg signed [3:0] op1; reg signed [2:0] op2; reg [7:0] result; reg ...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } template <typename T> inline void gn(T &first) { char c, sg = 0; while (...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 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 distribut...
#include <bits/stdc++.h> using namespace std; int digit[32]; long long dp[32][32][2]; long long dfs(int p, int k, bool tag) { int i; long long ret = 0; if (p == -1) return 1; if (~dp[p][k][tag]) return dp[p][k][tag]; if (!k) ret = (ret + dfs(p - 1, k, tag && !digit[p])) % 1000000007; ...
#include <bits/stdc++.h> using namespace std; const long long inf = 1e16; const int maxn = 1e5; pair<long long, int> tree[4 * maxn + 11]; long long ans[maxn + 11]; long long minn[4 * maxn + 11], lazy[4 * maxn + 11]; set<pair<long long, int> > t; void push_up(int rt) { tree[rt] = min(tree[rt << 1], tree[...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: Tecnológico de Costa Rica // Engineer: Juan José Rojas Salazar // // Create Date: 30.07.2016 10:22:05 // Design Name: // Module Name: V_NORM_FLOAT_TO_FIXED // Project Name: // Target Devices: // Tool...
/* 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,...
// ============================================================================= // COPYRIGHT NOTICE // Copyright 2000-2001 (c) Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // This confidential and proprietary software may be used only as authorised by // a licensing agreement...
/* * 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...
// 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 May 29 20:15:21 2017 // Host : GILAMONSTER running 64-bit major release (...
/** * 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 // simplistic example, should choose 1st conditional generate and assign straight through // the tool also compiles the special case and determines an error (replication value is 0) // // This file ONLY is placed into the Public Domain, for any use, // without warranty...
#include <bits/stdc++.h> using namespace std; const long long inf = 0x3f3f3f3f3f3f3f3f; int n, m, a[100010]; int tot[100010], Lpos = 1, Rpos = 0; long long f[100010], g[100010], MO; inline int read() { int x = 0, w = 0; char ch = 0; while (!isdigit(ch)) { w |= ch == - ; ch = getchar...
module qa_contents #( parameter WIDTH = 32, parameter MWIDTH = 1 ) ( input wire clk, input wire rst_n, input wire [WIDTH-1:0] in_data, input wire in_nd, input wire [MWIDTH-1:0] in_m, // Takes input messages to set ...
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; bool a[100100]; void go() { long long int n; cin >> n; memset(a, true, sizeof(a)); for (int i = 2; i <= n; i++) { for (int j = i + 1; i * j <= n; j++) { if (j % i == 0) continue; a[j * i] = false; ...
#include <bits/stdc++.h> int main() { int n, m; scanf( %d %d , &n, &m); int msg1[n]; int msg2[m]; for (int i = 0; i < n; i++) { scanf( %d , &msg1[i]); } for (int i = 0; i < m; i++) { scanf( %d , &msg2[i]); } for (int i = 1; i < n; i++) { msg1[i] = msg1[i] + msg1[i...
#include <bits/stdc++.h> using namespace ::std; const long double PI = acos(-1); const long long MOD = 1000000000 + 7; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } int add(int a, int b, int m = MOD) { return (a + b + m + m) % m; } int mul(long long a, long long b, int m = M...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << 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; long long int n, h[100001], root[100001], par[100001][25], size[100001], dp_down_0[100001], dp_down_1[100001], dp_up_0[100001], dp_up_1[100001]; vector<pair<long long int, long long int> > v[100001]; long long int add(long long int x, long long int y) { re...
// MM_slave.v // This file was auto-generated as a prototype implementation of a module // created in component editor. It ties off all outputs to ground and // ignores all inputs. It needs to be edited to make it do something // useful. // // This file will not be automatically regenerated. You should check it in...
#include <bits/stdc++.h> using namespace std; char getOtherValue(char val) { if (val == . ) return 0 ; if (val == 1 ) return 0 ; return 1 ; } int main() { int n, p; cin >> n >> p; string str; cin >> str; bool ok = false; for (int i = 0; i < n - p; ++i) { if (str[i]...
// -- (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 int MAXN = 200005; const int INFTY = 1 << 30; int D, N, M; pair<int, int> pos[MAXN]; vector<int> S; int nxt[MAXN]; int main() { scanf( %d %d %d , &D, &N, &M); for (int i = 0; i < M; i++) scanf( %d %d , &pos[i].first, &pos[i].second); sort(p...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string s; cin >> s; vector<int> A(91, 0); for (int i = 0; s[i]; i++) { A[(int)s[i]]++; } for (int i = 65; i < 65 + k; i++) if (A[i] == 0) { cout << 0 ; return 0; } ...
// Alt+C for commenting // Alt+Shift+C for uncommenting //============================================================================== // Copyright (C) John-Philip Taylor // // // This file is part of a library // // This file is free software: you can redistribute it and/or modify // it under the terms of t...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: i2c_buf.v // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. // // The above named program is free software; you can redistribute it and/or //...
#include <bits/stdc++.h> using namespace std; long long Pow[10005]; long long ans[10005]; int main() { long long N, X, now = 1, i, con = 0, t; Pow[0] = 1; for (i = 1; i <= 40; i++) Pow[i] = Pow[i - 1] * 2; scanf( %lld %lld , &X, &N); for (i = 40; i >= 0; i--) { while (X && X - (Pow[i] ...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: mast_new.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===============================...
// megafunction wizard: %LPM_CONSTANT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: lpm_constant // ============================================================ // File Name: lpm_constant4.v // Megafunction Name(s): // lpm_constant // // Simulation Library Files(s): // lpm // ===========================...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of inst_a_e // // Generated // by: wig // on: Mon Mar 22 12:42:23 2004 // cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../io.xls // // !!! Do not edit this file! Autogenerated by MIX !!! // $Au...
#include <bits/stdc++.h> using namespace std; string s; int cnt; int getdeal(long long c) { int ret = 0; while (c) { ret += c % 10; c /= 10; } return ret; } int main() { ios::sync_with_stdio(false); long long n; cin >> n; long long temp = 0; while (temp * 10 +...
/* This file is part of Fusion-Core-ISA. Fusion-Core-ISA 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. ...
/* * Milkymist VJ 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 ...
/** * 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...
// megafunction wizard: %LPM_MUX% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_MUX // ============================================================ // File Name: cntmux.v // Megafunction Name(s): // LPM_MUX // // Simulation Library Files(s): // lpm // =================================================...
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; int f = 1; char ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == - ) f = -f; for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); x *= f; } inline void print(int x) { ...
/** * 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; using ld = long double; using vi = vector<int>; using vll = vector<long long int>; using vd = vector<double>; using vvi = vector<vi>; int ctoi(char c) { return c - 0 ; } int slen(string s) { return s.length(); } int vsize(vi a) { return (int)a.size(); } ...
#include <bits/stdc++.h> using namespace std; bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; string direc = RDLU ; long long ln, lk, lm; void etp(bool f = 0) { puts(f ? YES : NO ); exit(0); } void addmod(int &x, int y, int mod = 1000000007) { assert(y >=...
module soc_system ( button_pio_external_connection_export, clk_clk, dipsw_pio_external_connection_export, hps_0_h2f_reset_reset_n, hps_0_hps_io_hps_io_emac1_inst_TX_CLK, hps_0_hps_io_hps_io_emac1_inst_TXD0, hps_0_hps_io_hps_io_emac1_inst_TXD1, hps_0_hps_io_hps_io_emac1_inst_TXD2, hps_0_hps_io_hps_io_emac1_ins...
// Copyright (c) 2000-2011 Bluespec, Inc. // 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, publ...
#include <bits/stdc++.h> using namespace std; long long int n, k, dp[2009][2009], cnt; long long int solve(int pos, int mx) { if (pos == k) return 1; long long int &res = dp[pos][mx]; if (res != -1) return res; res = 0; int lim = mx; if (lim == 0) lim = 1; if (mx == 0) { for (int...
/** * 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...
/* * University of Illinois/NCSA * Open Source License * * Copyright (c) 2007-2014,The Board of Trustees of the University of * Illinois. All rights reserved. * * Copyright (c) 2014 Matthew Hicks * * Developed by: * * Matthew Hicks in the Department of Computer Science * The University of Illinois at...
#include <bits/stdc++.h> using namespace std; class TaskD { public: void solve(std::istream &in, std::ostream &out) { long long n; in >> n; vector<long long> a(n), b(n), sa(n), sb(n); for (auto &i : a) in >> i; for (auto &i : b) in >> i; for (long long i = 0; i < n; ++i) {...
//////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. // // // // Redistribution and use in source and binary forms, w...
// (C) 1992-2014 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulati...
/***************************************************************************** * File : processing_system7_bfm_v2_0_5_arb_rd.v * * Date : 2012-11 * * Description : Module that arbitrates between 2 read requests from 2 ports. * *****************************************************************************/ `times...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 00:16:07 08/01/2015 // Design Name: samcoupe // Module Name: C:/Users/rodriguj/Documents/zxspectrum/zxuno/repositorio/cores/sam_coupe_spartan6/test1/tb_samcoupe.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 law...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5, inf = 998244353; long long n, k, i; long long A[N], B[N]; long long in[N], f[N]; inline long long expo(long long n, long long k, long long p = inf) { long long r = 1; for (; k; k >>= 1) { if (k & 1) r = r * n % p; ...
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9, maxn = (int)1e5 + 1; const double eps = (double)1e-8; const int mod = (int)1000000009; int n, a[1001], x, y, xx, yy, z, my, mx; vector<pair<int, bool> > b[3000]; string c, st; int main() { my = 1500; z = 1500; cin >> n; ...
#include<bits/stdc++.h> using namespace std; #define int long long const int maxn = 2000005; int tag[maxn],summ[maxn]; int len[maxn]; int n,k; void push_up(int p){ summ[p] = summ[p<<1] + summ[p<<1|1]; } void push_down(int p,int l,int r){ if(tag[p] == 0) return; int x = tag[p]; tag[p] = ...
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; vector<long long> v(100004); vector<long long> t(100004, 0); int n; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int bsearch(int r, int key) { int l = -1; while (r - l > 1) { int m = (r + l) / 2...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2008 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; wire [15:-16] sel2 = crc[31:0]; ...
// MBT 7/24/2014 // // This is a launch/synchronization complex. // The launch flop prevents combinational glitching. // The two sync flops reduce probability of metastability. // See MBT's note on async design and CDC. // // The three flops should be don't touched in synopsys // and abutted in physical design to reduc...
#include <bits/stdc++.h> using namespace std; int n; long long a, b, T; char s[500010]; long long pref[500010]; long long suff[500010]; int main() { cin >> n >> a >> b >> T; for (int i = 1; i <= n; ++i) { cin >> s[i]; } pref[1] = 0; for (int i = 2; i <= n; ++i) { pref[i] = ...
#include <bits/stdc++.h> #pragma GCC optimize(3) using namespace std; struct IO { char buf[(1 << 20)], *p1, *p2; char pbuf[(1 << 20)], *pp; IO() : p1(buf), p2(buf), pp(pbuf) {} ~IO() { fwrite(pbuf, 1, pp - pbuf, stdout); } inline char gc() { if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, ...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; template <typename T> T sqr(T a) { return a * a; } template <typename T> int sign(T a) { if (a == 0) return 0; return (a > 0 ? 1 : -1); } template <typename T1, typename T2> T2 sum_mod(T1 x, T2 MOD) { if (x <...
/** * 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> const int N = 2e4 + 42, M = 1e6 + 61, LN = 16; struct edge { int to, next, w; } e[M << 1]; int head[M], cnt = 1, nc; void addedge(int x, int y, int z) { if (!y) return; e[++cnt] = (edge){y, x[head], z}, x[head] = cnt; e[++cnt] = (edge){x, y[head], 0}, y[head] = cnt; ...
#include <bits/stdc++.h> using namespace std; int main() { int n, j = 0, i, s, t; cin >> n; int a[n + 1]; for (i = 1; i <= n; i++) cin >> a[i]; s = a[1] + 2 * n - 1; for (i = 1; i < n; i++) s += abs(a[i] - a[i + 1]); cout << s; return 0; }
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 02:15:59 05/09/2015 // Design Name: interrupt // Module Name: /media/BELGELER/Workspaces/Xilinx/processor/test_interrupt.v // Project Name: processor // Target Devic...
/*------------------------------------------------------------------------ Purpose Synchronous FIFO extended for hiding last 2 bytes (crc16 field of the usb data packet). ------------------------------------------------------------------------*/ module usb_fifo_rcv #( parameter ...
`include "assert.vh" module unpack_i64_tb (); reg [79:0] in; wire [63:0] out; wire [ 3:0] len; unpack_signed #(.N(64)) DUT(in, out, len); initial begin $dumpfile("unpack_i64_tb.vcd"); $dumpvars(0, unpack_i64_tb); // Ignore unset bits after value in = 80'h01xxxxxxxxxxxxxxxxxx; #1 ...