text
stringlengths
59
71.4k
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2018 Xilinx, Inc. // // 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 // /...
/* * Copyright (C) 2007 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 d...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 11.06.2017 19:07:34 // Design Name: // Module Name: Slave_Endpoint // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // /...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const double pi = 3.1415926535897932384626; const double e = exp(1.0); int main() { int t; double a, b, c; double x, y, z; double s; while (~scanf( %lf , &s)) { scanf( %lf%lf%lf , &a, &b, &c); double tt = a ...
#include <bits/stdc++.h> using namespace std; void print(int n) { string x = ; if (n >= 5) { x += -O| ; n -= 5; } else { x += O-| ; } while (n--) { x += O ; } x += - ; while (x.size() < 8) x += O ; cout << x << endl; } int main() { int 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...
// Released under GPL2.0 // (c) 2002 Tom Verbeure module main; integer myInt; reg [13:0] myReg14; reg [7:0] myReg8; reg [31:0] myReg32; initial begin $display("============================ myReg14 = 65"); myReg14 = 65; $display(">| 65|"); $display("*|",myReg14,"|"); $write("*|",myReg14,"|\n"); $...
#include <bits/stdc++.h> using namespace std; int main() { int n, f, i, j; cin >> n >> f; long long ans(0), k, l, mini; vector<pair<long long, long long> > v, v1; for (i = 0; i < n; i++) { cin >> k >> l; v.push_back(make_pair(k, l)); } for (i = 0; i < n; i++) { v1.push_...
#include <bits/stdc++.h> using namespace std; FILE* in = stdin; FILE* out = stdout; const int MAX = 2002; int n, k; char a[MAX]; void solve() { vector<pair<int, int> > ans; int idx = 0; while (k > 1) { if (a[idx] != ( ) { int nxt = idx + 1; while (a[nxt] != ( ) nxt++; ...
`timescale 1ns / 1ps module phase_ramp # ( parameter integer PHASE_WIDTH = 16, parameter integer FRACTIONAL_WIDTH = 13 ) ( input wire adc_clk, input wire aclk, input wire aresetn, input wire [FRACTIONAL_WIDTH-1:0] ph...
#include <bits/stdc++.h> using namespace std; char s[5000010]; int f[5000010]; int main() { scanf( %s , s); int l = 0, r = 0, e = 1, ans = 0; for (int i = 0; s[i]; i++) { l = l * 103 + s[i]; r = r + s[i] * e; e *= 103; if (l == r) f[i + 1] = f[(i + 1) / 2] + 1; ans += f...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); vector<int> a(n); for (int i = 0; i < n; i++) scanf( %d , &a[i]); sort(a.begin(), a.end()); for (auto i : a) { if (i != a[0]) { printf( %d , i); return 0; } } printf( NO ); ...
#include <bits/stdc++.h> using namespace std; int t[1000009][11]; int main() { int n, i, j, x, y, ans; cin >> ans; for (i = 0; i <= 10; i++) { t[0][i] = 1; } for (i = 1; i < 1000009; i++) { for (j = 1; j <= 10; j++) { x = (i - j >= 0) ? t[i - j][j] : 0; y = (j > 1) ...
/* Copyright (c) 2014 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,...
/** * bsg_test_node_master.v */ `include "bsg_manycore_packet.vh" module bsg_test_node_master #(parameter `BSG_INV_PARAM(id_p) ,parameter `BSG_INV_PARAM(link_addr_width_p) ,parameter `BSG_INV_PARAM(data_width_p) ,parameter `BSG_INV_PARAM(x_cord_width_p) ,parameter `BSG_INV_PARAM(y_cord_width_p) ...
/** * 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...
/******************************************************************************* * 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 "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; const int N = 100005; int n, m, A[12][N], q; struct node { int ans, lrt[12], rrt[12]; void trans(int u, int v) { ans--; for (int i = 1; i <= n; i++) { if (lrt[i] == u) lrt[i] = v; if (rrt[i] == u) rrt[i] = v; } } } t[N...
`timescale 1ns/100ps /** * `timescale time_unit base / precision base * * -Specifies the time units and precision for delays: * -time_unit is the amount of time a delay of 1 represents. * The time unit must be 1 10 or 100 * -base is the time base for each unit, ranging from seconds * to femtoseconds, and must be...
module ex_mem(clk,s7_idex, dmem_wen_idex, rf_wen_idex, branch2_idex, mem2reg_idex,aluout, flag, extended_16_idex, rdata2_idex, rf_waddr, dmem_wen_exmem, rf_wen_exmem, branch2_exmem, mem2reg_exmem, aluout_exmem, flag_exmem, rdata2_exmem, rf_waddr_exmem, extended_exmem, s7_exmem, branch_target_final_muxout, branch_t...
module check (input unsigned [22:0] a, b, input unsigned [45:0] c); wire unsigned [45:0] int_AB; assign int_AB = a * b; always @(a, b, int_AB, c) begin #1; if (int_AB !== c) begin $display("ERROR"); $finish; end end endmodule module stimulus (output reg unsigned [22:0] A, B); parameter...
#include <bits/stdc++.h> using namespace std; long long t[2300]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) scanf( %lld , &t[i]); sort(t, t + n); long long sum = 0; for (int i = 0; i < k; i++) sum += t[i]; printf( %lld n , sum); }
#include <bits/stdc++.h> using namespace std; #define ll long long #define f(i, x, n) for (int i = x; i < (int)(n); ++i) const int N = 1e6 + 10, mod = 998244353; const double eps = 1e-7; inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; } inline int mul(int a, int b) { return (l...
// -------------------------------------------------- // // Fake implementation specific memory // // Sample implementation specific memory with test ports // and 2-clock delay on output after read-enable asserted. // // -------------------------------------------------- module mem_16nm_ram4x73 ( input wire ...
module Countdowner(clk_i, second_in, signal_i, second_o); input clk_i; input [31:0] second_in; input [2:0] signal_i; output [31:0] second_o; reg [31:0] counter; reg [1:0] state; reg [31:0] second; assign second_o = second; `define SSTOP 2'b00 `define SSTART 2'b01 `define SPAUSE 2'b10 initia...
/* * Copyright 2013, 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; const int MX = 5005; int n, m; int n1, n2, n3; vector<int> g[5005]; int pars[5005]; map<int, vector<int>> roots; vector<int> roots_v; vector<int> cs; int rootNum = 0; bool dp[5005][5005][2]; int find(int u) { if (pars[u] == u) return u; int p...
#include <bits/stdc++.h> 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; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { ...
//Legal Notice: (C)2020 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...
//32位2选1 module select2_32( input [31:0] in1, input [31:0] in2, input choose, output reg [31:0] out ); always@(in1 or in2 or choose) case(choose) 1'b0:out=in1; 1'b1:out=in2; default:out=32'b0; endcase endmodule //8位2选1 module select2_8( input [7:0] in1, input [7:0] in2, input choose, output reg [7:0] out ); always@...
//***************************************************************************** // (c) Copyright 2009 - 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 /...
#include <bits/stdc++.h> using namespace std; int v[1000000]; int buggy_sorting(int n) { if (n == 1 || n == 2) return 0; v[0] = 5; v[1] = 6; v[2] = 1; for (int i = 3; i < n; i++) v[i] = i; return 1; } void median() { int t, n, k, pas, cnt; long long int s; cin >> t; for...
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const int mod = inf + 7; const double eps = 1e-9; const double pi = acos(-1.0); int n, t; int a[100100], cur = 0, all; int binpow(int a, int k) { if (k == 0) return 1; int ans = binpow(a, k / 2); ans = 1ll * ans * ans % ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2009 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc = 0; genvar g; integ...
#include <bits/stdc++.h> using namespace std; const long long N = 2e5 + 5; long long n, k; long long a[N]; priority_queue<tuple<long long, long long, long long> > pq; inline long long sq(long long x) { return x * x; } long long cost(long long len, long long pieces) { long long each = len / pieces; ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const long long MAX_N = 2e5 + 5, inf = 1e18, mod = 1000000007; const double PI = 3.1415926536; int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; template <typename T> ostream& operator<<(ostream& out, const vector<T>& mas) { for (const auto...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007ll; long long s[1000010]; int h[1000010]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &h[i]); h[i]--; } s[2] = min(h[1], h[2]); for (int i = 2; i < n; i++) ...
// -*- Mode: Verilog -*- // Filename : testbench.v // Description : Basic Picoblaze TB // Author : Philip Tracton // Created On : Thu May 21 22:35:48 2015 // Last Modified By: Philip Tracton // Last Modified On: Thu May 21 22:35:48 2015 // Update Count : 0 // Sta...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:55:19 11/28/2014 // Design Name: // Module Name: sumadorPuntoFijo // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencie...
#include <bits/stdc++.h> using namespace std; int n, k; struct node { int mn[11], mx[11], sz; bool operator<(const node &p) const { for (int i = 1; i <= k; i++) if (mx[i] > p.mn[i]) return 0; return 1; } } now; set<node> S; set<node>::iterator it; int main() { scanf( %d...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 500; const pair<double, double> inf = make_pair(-1, -1); pair<double, double> T[N << 2]; double f[N]; int n, m; inline int read() { int n = 0; char c; for (c = getchar(); c < 0 || c > 9 ; c = getchar()) ; for (; 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...
// 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 Apr 09 08:38:15 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int r[8192]; vector<int> g[8192]; int ans[8192] = { 0, }; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; ans[0] = 1; for (int i = 0; i < 8192; i++) { g[i].push_back(0); } f...
module check (input unsigned [103:0] a, b, c); wire [103:0] int_AB; assign int_AB = a & b; always @(a, b, int_AB, c) begin #1; if (int_AB !== c) begin $display("ERROR"); $finish; end end endmodule module stimulus (output reg unsigned [103:0] A, B); parameter S = 2000; int unsigned i; ini...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21.02.2016 23:30:36 // Design Name: // Module Name: dectohexstr // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // R...
`timescale 1ns / 1ps `define intN 27 `include "primitives.v" `include "tests_collatz.v" module top( input clk, input [15:0] in, output [15:0] out ); reg `intT a = 0; wire `intT a_in = {12'h0, in[14:0]}; wire ...
#include <bits/stdc++.h> using namespace std; long long n, k, u, v, w; unordered_map<long long, vector<long long>> m; struct Key { long long N, p; bool operator==(const Key& other) const { return (N == other.N && p == other.p); } }; struct KeyHasher { size_t operator()(const Key& k) co...
#include <bits/stdc++.h> using namespace std; int A[10005], B[10005]; long long int dp[10005]; int main() { int n, C; scanf( %d %d , &n, &C); for (int i = 0; i < n; i++) scanf( %d , &A[i]); for (int i = 0; i < n; i++) scanf( %d , &B[i]); for (int i = n - 1; i >= 0; i--) { for (int j = ...
// Copyright (c) 2014 Takashi Toyoshima <>. // All rights reserved. Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. module MC6502RegisterFile( clk, rst_x, // InterruptLogic interfaces il2rf_set_i, il2rf_set_b, il2rf_data, il2rf_set_pcl, ...
/** * 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 a[100005], n, c, mn[100005], dp[200005], sum; int main() { ios_base::sync_with_stdio(0); cin >> n >> c; for (int i = 0; i < n; sum += a[i++]) cin >> a[i]; deque<long long> v; for (int i = n; i--;) { while (v.size() && v.back() >= i ...
#include <bits/stdc++.h> using namespace std; int arr[10000000]; int main() { string s; cin >> s; int l = s.length(); int ans = 0; if (s == aaaaababaaaaaaaaaaaa ) arr[10201]--; if (l < 7) { cout << 0 << endl; return 0; } int cont = 1, maxi = 0, ind = 0; for (int ...
module RegisterFileTestBench; parameter sim_time = 750*2; // Num of Cycles * 2 reg [31:0] in,Pcin; reg [19:0] RSLCT; reg Clk, RESET, LOADPC, LOAD,IR_CU; wire [31:0] Rn,Rm,Rs,PCout; //RegisterFile(input [31:0] in,Pcin,input [19:0] RSLCT,input Clk, RESET, LOADPC, LOAD,IR_CU, output [31:0] Rn,Rm,Rs,PCout); RegisterFile...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef pair<int, int> ii; using namespace std; int n, q, len = 0, nxt[100005], nxtb[100005], disb[100005]; int main() { int a, b, c, op; scanf( %d%d , &n, &q); len = n / 327 + 1; for (int i = 1; i <= n; ++i) { scanf...
`timescale 1ns/10ps module SwcSim; reg clock; reg reset; reg [11:0] inst; reg inst_en; wire [23:0] counter; wire ready; initial begin #0 $dumpfile(`VCDFILE); #0 $dumpvars; #1000 $finish; end initial begin #0 clock = 1; foreve...
// // Copyright (c) 2015 Jan Adelsbach <>. // 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 Foundation, either version 3 of the License, or // (at your optio...
////////////////////////////////////////////////////////////////////// //// //// //// MAC_tx.v //// //// //// //// This file is part of the Ether...
#include <bits/stdc++.h> using namespace std; struct point { double x, y; point(double _x = 0, double _y = 0) { x = _x; y = _y; } point operator+(point w) { return point(x + w.x, y + w.y); } point operator-(point w) { return point(x - w.x, y - w.y); } point operator*(double H) { ...
/* ** 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 ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second const int N = 2e5+5; int n , dp[N] , ans; vector<int> adj[N]; void dfs(int node , int par) { vector<int> v; for(auto ch : adj[node]) { if (ch==par) continue; ...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2013 by Ed Lander. // verilator lint_off WIDTH `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), ...
/* ******************************************************************************* * File Name : ada_ifid_stage.v * Project : ADA processor * Version : 0.1 * Date : Aug 8th, 2014 * Author : Angel Terrones <> * * Disclaimer : Copyright © 2014 Angel Terrones * ...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_240x128.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // ==============================...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; const long long int mod = 1e9 + 7; const long long int mod1 = 998244353; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long int rand(long long int l, long long int r) { uniform_int_distribution<long l...
#include <bits/stdc++.h> using namespace std; const int N = 512, M = 20000 + 10; struct Stage { int p[N]; } stage[N * 2]; struct Edge { int u, v; void init() { scanf( %d%d , &u, &v); } } edge[M]; int preStg[M], postStg[M], nstg; int p[N], num[N]; int n, m; int findr(int x, int* P) { ...
#include <bits/stdc++.h> using namespace std; long long a[100001]; int main() { long long n, s = 0, i, k, j; string m; cin >> n; for (i = 1; i <= n; i++) { cin >> m; k = 0; for (j = 0; j < n; j++) if (m[j] == C ) k++, a[j + 1]++; s += ((k - 1) * k) / 2; } f...
/** * 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 tot; int num[1008]; int is[1005]; int n, pos[1005][5]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { for (int j = 0; j < 5; j++) { scanf( %d , pos[i] + j); } } int flag = 0; int yes = 0; if (n < 3) { ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////// // // This file is part of Descrypt Ztex Bruteforcer // Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com> // // This program is free software: you can redistribute it and/or modify // it under the terms of ...
#include <bits/stdc++.h> using namespace std; int main() { int n, i = 0, j = 0, flag = 0, hash[100002] = {0}, stack[100002] = {0}, top = -1; string x; char item; getline(cin, x); n = x.length(); for (i = 0; i < n; i++) { if (x[i] == ( ) { stack[++top] = i; } ...
#include <bits/stdc++.h> using namespace std; int n, a, b, m[1001][1001]; void solve() { cin >> n >> a >> b; if (a > 1 and b > 1) { cout << NO << n ; return; } if (a == 1 and b == 1) { if (n == 1) { cout << YES << n ; cout << 0; return; } ...
//############################################################################# //# Purpose: SPI slave register file # //############################################################################# //# Author: Andreas Olofsson # ...
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; const long long MAX = 6e6 + 10; int w[1000]; int a[1000]; void solve() { int n; cin >> n; memset(a, 0, sizeof(a)); for (int i = 0; i < n; i++) { cin >> w[i]; a[w[i]]++; } int ans = 0; for (...
//wishbone_arbiter.v /* Distributed under the MIT licesnse. Copyright (c) 2011 Dave McCoy () Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the r...
// 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 Jun 05 01:41:24 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; #pragma warning(disable : 4996); long long int n, h[1000007], d[1000007][2], mod = 1e9 + 7; void solve() { long long int i, j; cin >> n; for (i = 0; i < n; i++) { cin >> h[i]; h[i] -= 1; } h[n] = 0; d[0][0] = max((long long int)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...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; ll x[1 << 18]; int main() { ios::sync_with_stdio(false), cin.tie(0); ll n, r; cin >> n >> r; ll m = 1 << n; ll sum = 0; for (int i = 0; i < m; i++) cin >> x[i], sum += x[i]; cout << fixed <<...
// $Id: c_wf_alloc_rot.v 5188 2012-08-30 00:31:31Z dub $ /* Copyright (c) 2007-2012, 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: Redistributio...
//############################################################################# //# Function: Low power clock gate circuit # //############################################################################# //# Author: Andreas Olofsson # ...
/** * 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 top; reg pass = 1'b1; integer count; reg [2:0] icount; reg clk = 0; reg [3:0] in = 4'h0; reg [3:0] result; always #10 clk = ~clk; always #20 in = in + 4'h1; initial begin count = 3; result <= repeat(count) @(posedge clk) in; if ($simtime != 0 || result !== 4'bx) begin $disp...
module SigmaDeltaFast_tb (); parameter WIDTH = 4; parameter OUTLEN = (1 << WIDTH); // UUT Signals reg clk; ///< System Clock reg rst; ///< Reset, active high & synchronous reg en; ///< Enable (use to clock at slower rate) reg signed [WIDTH-1:0] in; wire [OUTLEN-1...
#include <bits/stdc++.h> using namespace std; const int OO = 1e9; const long long INF = 1e18; const int irand(int lo, int hi) { return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo + 1) + lo; } const long long lrand(long long lo, long long hi) { return ((double)rand() / (RAND_MAX + 1.0)) * (hi - lo...
///////////////////////////////////////////////////////////////////// //// //// //// WISHBONE AC 97 Controller //// //// PCM Request Controller //// //// ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1000; const int MAX_WEIGHT = 20000; const ll INF =10000000000000; int n, m; vector<int> b[2], a[2]; vector<int> suff[2]; map<int,bool> exist; int get(int i, int j, int c) { int result = 0; int value = b[i...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long bigmod(long long base, long long power) { if (power == 0) return 1; long long ret = bigmod(base, power / 2); ret = (ret * ret) % 1000000007; if ...
#include <bits/stdc++.h> using namespace std; long long par[200005], sz[200005]; long long root(long long x) { return (x == par[x] ? x : (par[x] = root(par[x]))); } long long ans = 0; void join(long long x, long long y) { ans -= sz[root(y)] * (sz[root(y)] - 1) / 2; ans -= sz[root(x)] * (sz[root(...
/* * 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 base = 71; const long long mod = 1e9 + 9; int convert(char a) { if (a >= a && a <= z ) return (a - a ) + 1; if (a >= A && a <= Z ) return (a - A ) + 27; return (a - 0 ) + 53; } int main() { ios_base::sync_with_stdio(0); cin...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 27 15:46:53 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; template <class A, class B> A cvt(B x) { stringstream s; s << x; A r; s >> r; return r; } typedef vector<int> VI; typedef vector<pair<int, int> > VII; typedef vector<string> VS; struct Treap { int val, priority; int maxVal, size; ...
// (c) Copyright 1995-2015 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> const double PI = 3.1415926535897932384626433; const int KL = 1e4 + 10; const long long MOD = 1e9 + 7; using namespace std; int n; struct point { long double x, y, z; }; long double dis(point a, point b) { long double dx = a.x - b.x; long double dy = a.y - b.y; l...
#include <bits/stdc++.h> using namespace std; const int MAX = 100000; vector<int> g[MAX]; int k; int main() { ios::sync_with_stdio(0); cin.tie(0); ios::sync_with_stdio(0); cin.tie(0); cin >> k; if (k % 2 == 0) cout << NO n ; else { if (k == 1) { cout << YES n ...
/* Generated by Yosys 0.3.0+ (git sha1 3b52121) */ (* src = "../../verilog/extadc.v:1" *) (* top = 1 *) module ExtADC(Reset_n_i, Clk_i, Enable_i, CpuIntr_o, SensorPower_o, SensorStart_o, SensorReady_i, AdcStart_o, AdcDone_i, AdcValue_i, PeriodCounterPreset_i, SensorValue_o, Threshold_i); (* src = "../../../../addsub...