text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; const int M = 7002; const int N = 100010; int n, q; bitset<M> num[M]; bitset<M> sq[M]; bitset<M> a[N]; vector<int> squareFree; int main() { cin >> n >> q; for (int i = 1; i < M; ++i) { int good = 1; for (int j = 2; j * j <= i; ++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 law...
#include <bits/stdc++.h> using namespace std; const long long MAXN = 10000 + 10; int n, m; int second[200], a[200]; bool vis[200]; int main() { scanf( %d %d , &n, &m); for (int i = 0; i < m; i++) scanf( %d , &second[i]); for (int i = 0; i < m; i++) second[i]--; bool win = true; for (in...
/* * 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...
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.2 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // =========================================================== `timescale 1 ns /...
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { long long ax, ay, bx, by, cx, cy, ab, bc; double slopeAB, slopeBC; cin >> ax >> ay >> bx >> by >> cx >> cy; if (ax == cx && ay == cy) { cout << Yes n ; } else { ab = (ax - bx) * (ax - bx) + (ay - by) * ...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string intial, code; cin >> intial >> code; int res = 0; for (int i = 0; i < n; i++) { int a = (((intial[i] - 0 ) - (code[i] - 0 )) + 10) % 10; int b = (((code[i] - 0 ) - (intial[i] - 0 )) + 10) % 10;...
#include <bits/stdc++.h> using namespace std; int main() { long long int h, l, i; cin >> h >> l; long double x; x = (long double)(l * l - h * h) / (long double)(2 * h); std::cout << std::setprecision(9) << x << n ; }
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( unroll-loops ) using namespace std; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long n, m, p; cin >> n >> m >>...
/* * Copyright 2018-2022 F4PGA Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
// -- (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 = 100100; long double a[maxn]; int main() { int n, s; long long k, b; while (~scanf( %d , &n)) { s = 0; for (int i = 0; i < n; i++) { scanf( %I64d %I64d , &k, &b); if (k != 0) { a[s++] = -(double)(b * ...
`timescale 1ns / 1ps `define NUM_CH 2 `define NUM_CH_LOG2 1 // `define TEST_32_48 // `define TEST_96192 `define PRELOAD `define NODUMP module resampler_t; parameter DATALEN = 100000; reg [15:0] testdata [DATALEN-1:0]; reg [16:0] testdata_iter; wire [15:0] testdata_curr = testdata[testdata_iter]; wire [23:0] testdat...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003 Matt Ettus // // 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...
`include "../defined.vh" module Bus_Mux ( imm_in, reg_source, a_mux, a_out, reg_target, b_mux, b_out, c_bus, c_memory, c_pc, c_pc_plus4, c_mux, reg_dest_out, branch_func, take_branch ); input [15:0] imm_in; input [31:0] reg_source; input [1:0] a_mux; output [31:0] a_out; reg [31:0] a_out; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; constexpr ll INF = (1LL << 30) - 1LL; constexpr ll LINF = (1LL << 60) - 1LL; constexpr ll MOD = 1e9 + 7; template <typename T> void chmin(T &a, T b) { a = min(a, b); } template <typename T> void chmax...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t; cin >> t; while (t) { t--; long long int n, k; cin >> n >> k; long long int a[k]; map<long long int, long long int> m; for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; int n, last; struct rec { int s, t; } da[50100]; bool cmp(rec a, rec b) { if (a.s < b.s) return true; if (a.s > b.s) return false; if (a.t < b.t) return true; return false; } int main() { scanf( %d , &n); for (int i = 1; i <= n; 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...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 20:52:26 09/08/2014 // Design Name: lab5dpath // Module Name: C:/ece4743/projects/lab5_solution/tb_lab5dpath.v // Project Name: lab5_solution // Target Device: // ...
#include <bits/stdc++.h> using namespace std; const int N = 5001; int n, tmp[N]; vector<int> g[N]; bool vst[N]; void dfs(int c, int p) { bool dp[N]; fill(dp, dp + n + 1, false); dp[0] = true; tmp[c] = 1; for (int ch : g[c]) { if (ch != p) { dfs(ch, c); tmp[c] += tmp...
#include <bits/stdc++.h> int main() { int x, y, z; while (scanf( %d%d , &x, &y) == 2) { z = abs(x) + abs(y); if (x > 0) { if (y > 0) printf( 0 %d %d 0 n , z, z); else printf( 0 -%d %d 0 n , z, z); } else { if (y > 0) printf( -%d 0 0 %d 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...
//Legal Notice: (C)2015 Altera Corporation. All rights reserved. Your //use of Altera Corporation's design tools, logic functions and other //software and tools, and its AMPP partner logic functions, and any //output files any of the foregoing (including device programming or //simulation files), and any associate...
#include <bits/stdc++.h> using namespace std; vector<long long int> factors(long long int n) { vector<long long int> v; for (long long int i = 1; i * i <= n; i++) { if (n % i == 0) { if (i * i == n) v.push_back(i); else { v.push_back(i); v.push_back(n / i)...
`timescale 1ns / 1ps module ControlUnit (clk,OPCODE,BOpCode,Zero,BSelector,MemRD,MemWD,RegWrite,RegSelector,PCSelect,Enable1,Enable2,Enable3,Enable4); input wire clk; input [4:0] OPCODE; input [0:0] Zero; input [4:0] BOpCode; output reg[0:0] BSelector; output reg[0:0] MemRD; output reg[0:0] MemWD; output reg...
`include "SVGA_DEFINES.v" module CLOCK_GEN ( SYSTEM_CLOCK, system_clock_buffered, pixel_clock, reset ); input SYSTEM_CLOCK; // 100MHz LVTTL SYSTEM CLOCK output system_clock_buffered; // buffered SYSTEM_CLOCK output pixel_clock; // adjusted SYSTEM_CLOCK output reset; // reset asserted when DCMs are...
module top ( fpga_clk_50, fpga_reset_n, fpga_led_output, memory_mem_a, memory_mem_ba, memory_mem_ck, memory_mem_ck_n, memory_mem_cke, memory_mem_cs_n, memory_mem_ras_n, memory_mem_cas_n, memory_mem_we_n, memory_mem_reset_n, memory_mem_dq, memory_mem_dqs, ...
#include <bits/stdc++.h> using namespace std; int main() { int sum = 0, n, a[120], x, y, i; cin >> n; for (i = 0; i < n - 1; ++i) { cin >> a[i]; } cin >> x >> y; for (i = x - 1; i < y - 1; ++i) { sum += a[i]; } cout << sum << n ; }
#include <bits/stdc++.h> using namespace std; struct node { long long x; bool s; node(long long a, bool b) { x = a, s = b; } }; bool operator<(node a, node b) { return a.x > b.x; } priority_queue<node> pq; int main() { int n; long long temp; cin >> n; long long ans = 0; for (...
#include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define ll long long int #define pb push_back #define pob pop_back #define ub upper_bound #define lb lower_bound #define mp make_pair #define f0(i,n) for(i=0;i<n;i++) #define rf0(i,n) for(i=n-1;i>=0;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 law...
//See README and tcl for more info `include "defines.v" module roi(input clk, input [DIN_N-1:0] din, output [DOUT_N-1:0] dout); parameter DIN_N = `DIN_N; parameter DOUT_N = `DOUT_N; wire div_clk; wire clk_IBUF_BUFG; BUFR #( .BUFR_DIVIDE(2) ) clock_divider ( .I(clk), ...
// DESCRIPTION: Verilator: Verilog Test module // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2009 by Wilson Snyder. module t (/*AUTOARG*/ // Inputs clk ); input clk; integer cyc=0; reg [63:0] crc; reg [63:0] sum; // Take CRC data and apply to testblo...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 03/29/2016 05:57:16 AM // Design Name: // Module Name: Testbench_FPU_Add_Subt // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // /...
#include<bits/stdc++.h> #define ll long long #define R return #define pb push_back #define SI size() using namespace std; long long t,n,a[100030],ans,w[5030]; int main(){ cin >> t; while(t--){ ans = 0; memset(w,0,sizeof w); cin >> n; for(int i=0...
#include <bits/stdc++.h> using namespace std; int abs(int x) { return x >= 0 ? x : -x; } int main() { int n; cin >> n; while (n--) { vector<int> x; vector<int> y; char tmp; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { cin >> tmp; if (t...
#include <bits/stdc++.h> using namespace std; vector<int> months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const int MAX = 1e5 + 55; const int inf = 1e9 + 77; const int MOD = 1e9 + 7; const double PI = acos(-1.0); const double eps = 1e-7; int main() { long long n; scanf( %I64d , &n)...
#include <bits/stdc++.h> using namespace std; int n, m, ans, dp[8][8]; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { int l, r; cin >> l >> r; dp[l][r] = dp[r][l] = 1; } if (n <= 6) cout << m; else { for (int i = 1; i <= n; i++) for (int j = i ...
/* 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,...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; vector<int> c; vector<bool> used; void dfs(int u, vector<vector<int>>& v) { used[u] = 1; for (int i = 0; i < v[u].size(); i++) { if (c[u] == c[v[u][i]] && !used[v[u][i]]) { dfs(v[u][i], v); } } } int main() { int n; cin >>...
/** * ------------------------------------------------------------ * Copyright (c) All rights reserved * SiLab, Institute of Physics, University of Bonn * ------------------------------------------------------------ */ `timescale 1ps / 1ps `include "utils/bus_to_ip.v" `include "pulse_gen/pulse_gen.v"...
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)1e12; const int maxn = 100050; struct STU { int b, c, id; bool operator<(const STU &s) const { return c < s.c || (c == s.c && id < s.id); } }; map<STU, int> mp; bool cmp(const STU &a, const STU &b) { return a....
#include <bits/stdc++.h> const int N = 500054; const double eps = 3e-10; inline void up(double &x, const double y) { x < y ? x = y : 0.; } inline void down(double &x, const double y) { x > y ? x = y : 0.; } inline double max(const double x, const double y) { return x < y ? y : x; } struct quadratic { do...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2014 by Wilson Snyder. `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while...
#include <bits/stdc++.h> using namespace std; long long pre[2010000]; int n, i, m, j, vis[2010000], la[2010000], lr[2010000], s[2010000], q[2010000], tr[2010000], a[2010000], tim, jid; inline int gi() { int s = 0; char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); while (c >= 0...
#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); } int main() { long long n; cin >> n; set<long long> st; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { long long a = n / gcd(n, i...
#include <bits/stdc++.h> using namespace std; pair<long long, long long> a[200]; int n; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i].second; long long tmp = a[i].second; while (tmp % 3 == 0) { a[i].first--; tmp /= 3; } } sort(a + 1, a ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int vs, ve; int t, d; cin >> vs >> ve >> t >> d; int cur = vs; int sm = vs; int pre = vs; for (int i = 2; i <= t; i++) { while (cur < ve && abs(pre - cur) <...
`timescale 1 ns / 1 ps module axis_keyer # ( parameter integer AXIS_TDATA_WIDTH = 32, parameter integer BRAM_DATA_WIDTH = 32, parameter integer BRAM_ADDR_WIDTH = 10 ) ( // System signals input wire aclk, input wire aresetn, input wire [BRAM_ADDR_WIDTH-1:...
#include <bits/stdc++.h> using namespace std; int main(int argc, char** argv) { ios::sync_with_stdio(false); cin.tie(NULL); unordered_map<int, int> idx; int N, x; cin >> N; while (N--) { cin >> x; if (x) idx[x] = 1; } cout << idx.size() << endl; return 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 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; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { long long n, m; cin >> n >> m; vector<pair<long long, long long>> ar(m); for (int i = 0; i < m; ++i) { cin >> ar[i].first ...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> A; vector<pair<int, int> > M; vector<int> PP; int turn; set<int> Go; int ans(int x) { cout << x + 1 << endl; if (Go.empty()) exit(0); cin >> x; return x - 1; } signed main() { ; cin >> n >> m; A.resize(n ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 7, MAXM = 1e5 + 5, MOD = 1e9 + 7, bit_one = (1 << MAXN) - 1; int n, ans; int w[MAXN]; int pre_process[MAXN][(1 << MAXN)][(1 << MAXN)]; int add(int a, int b) { int c = a + b; while (c >= MOD) c -= MOD; return c; } int mul(int a, i...
#include <bits/stdc++.h> using namespace std; char ss[1002][1002]; int ak = -1, p = 0; int main() { while (gets(ss[p])) { if ((int)strlen(ss[p]) > ak) ak = (int)strlen(ss[p]); p++; } for (int i = 0; i <= ak + 1; i++) printf( * ); printf( n ); bool k = false; for (int i = 0; ...
// Test bench for our 6 bit shift register. module main; reg clk, rst_n, in; wire [5:0] q; wire d; strober st (clk, rst_n, d); shift sh (clk, rst_n, d, q); always #10 clk = ~clk; task assert(input condition); if(!condition) $finish(2); endtask // assert initial begi...
#include <bits/stdc++.h> using namespace std; long long d[25]; int main() { long long t; cin >> t; while (t--) { long long n, s; cin >> n >> s; long long len = 0, sum = 0, num = n; fill(d, d + 25, 0); while (num > 0) { d[++len] = num % 10; sum += d[len]; ...
// megafunction wizard: %ROM: 1-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: vga_font_rom.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ===============...
#include <bits/stdc++.h> using namespace std; int a[105]; int main() { int i, n, j = 0, k, l; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; } sort(a + 1, a + n); while (a[0] <= a[n - 1]) { j++; a[n - 1]--; a[0]++; sort(a + 1, a + n); } cout << j << ...
/******************************************************************************* * This file is owned and controlled by Xilinx and must be used solely * * for design, simulation, implementation and creation of design files * * limited to Xilinx devices or technologies. Use with non-Xilinx ...
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { return x > 0 ? x : -x; } int n; int m; vector<pair<int, int> > w[5000]; pair<int, int> v[5000]; int p[5000], u[5000], pc[5000], px[5000], res[5000]; int go(int x, int p) { for (int i = 0; i < ((int)(w[x]).size()); ...
#include <bits/stdc++.h> using namespace std; int n; set<pair<int, int> > s; vector<int> od; int p[512]; vector<int> v[512]; inline void dfs(int b, int pr = -1) { od.push_back(b); p[b] = pr; auto it = s.lower_bound(make_pair(b, -1)); while (it != s.end() && (*it).first == b) { if (it...
#include <bits/stdc++.h> using namespace std; long long n, h; long long r(long long l, long long s, long long e, long long d) { if (s + 1 == e) return 0; long long m = 1 + (s + e) >> 1; long long k = (n < m ? (d ? (1ll << (h - l)) : 1) : (d ? 1 : (1ll << (h - l)))); if (n < m) return r(l +...
#include <bits/stdc++.h> template <typename T> T pow(T a, T b, long long m) { T ans = 1; while (b > 0) { if (b % 2 == 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans % m; } using namespace std; bool B[100], G[100]; int main() { int n, m; cin >> n >> 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 long long mod = 1000000007; long long powmod(long long a, long long b) { long long res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } const int N = 1010000; int nxt[N], f...
module test; reg [0:0] io_in_valid; reg [31:0] io_in_bits; reg [0:0] io_out_ready; reg [0:0] io_pcIn_valid; reg [0:0] io_pcIn_bits_request; reg [15:0] io_pcIn_bits_moduleId; reg [7:0] io_pcIn_bits_portId; reg [15:0] io_pcIn_bits_pcValue; reg [3:0] io_pcIn_bits_pcType; wire [0:0]...
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> g[100001]; bool is_centroid[100001]; int centroid_parent[100001]; int mn[100001]; int sz[100001]; int level[100001]; int centroid_root; map<pair<int, int>, int> dist; void dfs(int nd, int p, int c) { sz[nd] = 1; if (p == c...
// (C) 2001-2011 Altera Corporation. All rights reserved. // Your use of Altera Corporation's design tools, logic functions and other // software and tools, and its AMPP partner logic functions, and any output // files any of the foregoing (including device programming or simulation // files), and any associated doc...
// chris_pipelined.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 chec...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2014 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 // //...
#include <bits/stdc++.h> using namespace std; int dx[4] = {-1, 1, 0, 0}; int dy[4] = {0, 0, -1, 1}; const int inf = 0x7f7f7f7f; const int mod = 1000000007; const double eps = 1e-8; int n, m; set<int> v; vector<pair<int, int> > ans; vector<int> vc[100007]; bool isok(int u, int v) { for (size_t ...
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > v; int n, m, vis[100005], in[100005], d[100005]; vector<int> e[100005]; int dfs(int i) { vis[i] = 1; int ans = 0; for (auto first : e[i]) { if (vis[first]) { ans = max(ans, d[first]); continue; } ...
// Bidirectional registers module bidir_reg ( inout wire [15:0] tristate, input wire [15:0] oe, input wire [15:0] reg_val ); // This would be much cleaner if all the tools // supported "for generate"........ assign tristate[0] = oe[0] ? reg_val[0] : 1'bz; assign tristate[1] = oe[1] ? reg_va...
#include <bits/stdc++.h> struct itv { int s1; int e1; int s2; int e2; int gr; void up() { gr = (e2 - s2) + 1; if (e1) { gr += (e1 - s1) + 1; }; }; }; std::vector<std::pair<int, int> > aus; void merge(int s1, int s2, int sz) { for (int i = 0; i < sz; i++)...
// Generic 32-bit Xilinx Spartan-6 (true) dual-port BRAM module `timescale 1ns / 1ps `default_nettype none `include "mm_defines.vh" module bram #( parameter size = 16384, // bytes, valid range: 2048, 4096, 8192, 16384, 32768, 65536 parameter name = "irom" // only for BMM generation ) ( input wire ClockA, ClockB, in...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: Img_RAM.v // Megafunction Name(s): // altsyncram // ============================================================ // *******************...
/** * 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) 2007 by Terasic Technologies Inc. // -------------------------------------------------------------------- // // Permission: // // Terasic grants permission to use and modify this code for use // in synthesis for all Terasic De...
#include <bits/stdc++.h> using namespace std; vector<string> m; int main() { int n, k; cin >> n >> k; int e = 0; for (int i = 1; i < k; i++) { string t = ; t += char( A + e / 26); t += char( a + e % 26); e++; m.push_back(t); } for (int i = k; i <= n; i++) ...
// Copyright 2020-2022 F4PGA Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
module ALUControl(ALUOp, Funct, ALUCtl, Sign); input [3:0] ALUOp; input [5:0] Funct; output reg [4:0] ALUCtl; output Sign; parameter aluAND = 5'b00000; parameter aluOR = 5'b00001; parameter aluADD = 5'b00010; parameter aluSUB = 5'b00110; parameter aluSLT = 5'b00111; parameter aluNOR = 5'b01100; parameter ...
/* * 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...
`timescale 1ns / 100ps // File name : p2hw3latches2015fall.v // ECE333 Homework #3 Problem 2 //check if this circuit has latches. Show where latches are on its schematic, //and propose fixes to remove all latches. module p2hw3latches2015fall(X, Z, RESET, CLOCK, CurrentState); input X, RESET, CLOCK; output reg Z; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using uint = unsigned int; using rl = double; const int MAXN = 5 * 100009; const int modd = 998244353; int n; struct Vertex { vector<int> to; int pm, answ, thisansw; } v[MAXN]; int ndiv2; int mult(int a, int b) { ll re...
#include <bits/stdc++.h> using namespace std; const int P = 1e9 + 7, INF = 0x3f3f3f3f; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long qpow(long long a, long long n) { long long r = 1 % P; for (a %= P; n; a = a * a % P, n >>= 1) if (n & 1) r = r * a % P; ret...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; const int p = 1e9 + 7; struct edge { int l, r, uk; }; edge a[MAXN]; int dp[4 * MAXN]; int b[MAXN]; int n, m; void update(int k) { dp[k] = (dp[k * 2] + dp[k * 2 + 1]) % p; if (k > 1) update(k / 2); } long long ge...
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)1e9; long long max(long long a, long long b, long long c) { return max(a, max(b, c)); } long long n; long long house[200011]; long long mn[200011][2][2]; long long mx[200011][2][2]; long long f(long long i, long long j,...
#include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; using std::pair; using std::string; using std::swap; using std::vector; void doit(int& xk, int& yk, int w, int h, int x, int y, int z) { for (int i = 0; i < x; ++i) { swap(xk, yk); swap(w, h); xk = w - xk + ...
/** * 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...
// $Id: c_incr.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 source ...
////////////////////////////////////////////////////////////////////// //// //// //// OR1200's DC RAMs //// //// //// //// This file is part of the Open...
#include <bits/stdc++.h> using namespace std; long long int t[4000005]; void update(long long int v, long long int tl, long long int tr, long long int pos) { if (tl == tr) { t[v]++; return; } long long int tm = (tl + tr) / 2; if (pos <= tm) update(2 * v, tl, tm, pos...
#include <bits/stdc++.h> using namespace std; int main() { long long int t, i, oo = 0, oz = 0, zo = 0, zz = 0; char s1[2000005], s2[2000005]; cin >> t; cin >> s1; cin >> s2; t = 2 * t; for (i = 0; i < t; i++) { if (s1[i] == 1 && s2[i] == 1 ) oo++; else if (s1[i] ==...
#include <bits/stdc++.h> using namespace std; const int OO = 0x3f3f3f3f, N = 1e5 + 5, mod = 1e9 + 7; const double pi = acos(-1), EPS = 1e-8; int n, x, y, idx[N]; int main() { memset(idx, -1, sizeof idx); scanf( %d , &n); for (int t = 1; t <= n; ++t) { scanf( %d%d , &x, &y); int cnt = 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...