text
stringlengths
59
71.4k
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2005 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/ // Inputs clk ); input clk; reg [83:4] from; reg [83:4] to; ...
//Legal Notice: (C)2013 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...
#include <bits/stdc++.h> using namespace std; int a[1000005]; int main() { int n; while (cin >> n) { for (int i = n; i >= 0; i--) if (!a[i]) { int mm = (1 << ((int)(log2(i) + 1))) - 1; a[i] = mm ^ i; a[mm ^ i] = i; } long long int ans = 0; fo...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); int n, k; cin >> n >> k; if ((n - 1) / 2 < k) cout << -1 << n ; else { cout << (n * k) << 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 law...
module DDS( clk, reset, key_s4, clk_25M, out_wave, choose ); parameter WIDTH = 8; parameter N = 16; input [2:0] choose; input key_s4; reg [N-1:0] data; input clk; input reset; output [WIDTH-1:0] out_wave; reg [WIDTH-1:0] sine; reg [WIDTH-1:0] AM; reg [WIDTH-1:0] FM; reg [WIDTH-1:0] ASK; reg [WIDTH-1:0] FSK; re...
#include <bits/stdc++.h> using namespace std; int N, K; vector<int> tabs; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> N >> K; tabs.resize(N); for (int i = 0; i < N; i++) cin >> tabs[i]; int most = 0; for (int b = 0; b < N; b++) { int sum = 0; for ...
/////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2009 Xilinx, Inc. // This design is confidential and proprietary of Xilinx, All Rights Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ /...
/** * 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: University at Buffalo // Engineer: Mahalakshmi Venkataraman // // Create Date: 12:34:32 06/12/2015 // Design Name: CSE 590 Proj 1 // Module Name: pa1 // Project Name: SSD // Target Devices: ...
#include <bits/stdc++.h> using namespace std; char a[1005]; int f[1005], flag[1005], prime[1005], g[1005]; int n, num, ok[1005], k, i, id, ans, cnt, j; int main() { scanf( %s , a + 1); n = strlen(a + 1); num = 1; ok[1] = 1; for (i = 1; a[i]; i++) g[a[i] - a ]++; for (i = 2; i <= n; i+...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; int main() { ios_base::sync_with_stdio(false); int n, m; cin >> n >> m; int t[m], l[m], r[m]; int a[n + 1]; fill_n(a, n + 1, -1); a[0] = 1e5; for (int i = 0; i < m; i++) { cin >> t[i] >> l[i] >> r[i]; ...
#include <bits/stdc++.h> using namespace std; const long long Mod = 1e9 + 7; 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; } long long gcd(long long a, long long 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...
// Copyright 2021 The CFU-Playground 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 ...
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a; cin >> b; std::reverse(a.begin(), a.end()); if (a == b) cout << YES << endl; else cout << NO << endl; return 0; }
#include <bits/stdc++.h> int n, h; int dynamics[1001][2][31][31][31]; int progress(int a) { return (a == 0 || a == h - 1) ? 0 : a + 1; } inline void add(int& a, int b, int mod) { a = (a + b) % mod; } int main(int argc, char* argv[]) { std::cin >> n >> h; if (h == 1) dynamics[1][1][0][0][0] = 4; ...
#include <bits/stdc++.h> int main() { static int vv[100][100], tt[100][100], kk[100]; int n, s, h, i, j, k, t, t_, d1, d2, cnt, lead; scanf( %d%d , &n, &s); for (i = 0; i < n; i++) { scanf( %d , &kk[i]); for (j = 0; j < kk[i]; j++) scanf( %d%d , &vv[i][j], &tt[i][j]); for (j = 1; j <...
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 10; long long h[N], e[2 * N], ne[2 * N], idx; void add(long long a, long long b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; } struct node { long long sum, add; }; node tr[N << 2]; long long arr[N]; long long f[N][20]; long ...
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 7; const long long mod = 1e9 + 7; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } map<long long, long long> mp; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie...
/** * 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; void speed() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } void convertString(string &s, char t) { if (t == L ) { for (int i = 0; s[i] != 0 ; i++) if (s[i] >= 65 && s[i] <= 90) s[i] += 32; } else { for (int i = 0; s...
module rom8kx16 ( input [12 : 0] addr, input clk, output [15 : 0] dout); // // Generate 8 blocks of memory 8k x 2. // Initialize memory contents from rom-init-*.v files. // RAMB16_S2 #(.INIT (2'b00), .SRVAL (2'b00), .WRITE_MODE ("WRITE_FIRST"), `include "rom-init-a.v" ) rom_1_0 (.DO (dout[1:0]), ...
//---------------------------------------------------------------------------- `timescale 1 ns / 100 ps module fifo_TB; //---------------------------------------------------------------------------- // Parameter (may differ for physical synthesis) //-------------------------------------------------------------...
/* * 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; int main() { long long n, k; cin >> n >> k; if (k == 1) { if (n > 1) cout << n; else cout << -1 ; return 0; } int i; vector<int> res; for (i = 2; i * i <= n; i++) { while (n % i == 0 && k != 1) { ...
/** * 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 namespace chrono; template <class T> void Swap(T& a, T& b) { a ^= b; b ^= a; a ^= b; } template <class type> void show(type name) { for (auto& nm : name) cerr << nm << ; cerr << n ; } using lng = long long; using ivec = vec...
module dut(/*AUTOARG*/ // Outputs dut_active, wait_out, access_out, packet_out, // Inputs clk, nreset, vdd, vss, access_in, packet_in, wait_in ); parameter AW = 32; parameter DW = 32; parameter CW = 2; parameter IDW = 12; parameter M_IDW = 6; parameter S_IDW = 12; parame...
/* Copyright (c) 2015 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
#include <bits/stdc++.h> using namespace std; long long x2, y2; long long euler(long long a, long long b) { if (b == 0) { x2 = 1; y2 = 0; return a; } else { long long res = euler(b, a % b); long long temp = x2; x2 = y2; y2 = temp - (a / b) * y2; return res; ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:32:05 03/25/2015 // Design Name: // Module Name: RF // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revi...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const long long int MOD = 1e9 + 7; const int N = 1e6 + 6; int sum[N][3], prv[N][3]; int main() { int n; string s; cin >> n >> s; s = * + s; prv[0][0] = prv[0][1] = -1; for (int i = 1; i <= n; i++) { sum[i][0] ...
// test case generated from IWLS 2005 usb_phy core // (triggered a bug in opt_muxtree pass) module usb_tx_phy(clk, rst, DataOut_i, TxValid_i, hold_reg); input clk; input rst; input DataOut_i; input TxValid_i; output reg hold_reg; reg state, next_state; reg ld_sop_d; reg ld_data_d; always @(posedge clk) if(...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: jbi_sctrdq_fifo.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 a...
//date:2016/8/02 //engineer:ZhaiShaoMin //module name :regflie //version: test bench module tb_core_rf(); //input reg clk; reg rst; reg [4:0] raddr1; reg [4:0] raddr2; reg rf_write; reg [4:0] waddr; reg [31:0] data; //output wire [31:0] rd_data1; wire ...
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x * f; } ...
#include <bits/stdc++.h> using namespace std; int main() { int n, t; cin >> t; while (t--) { int count = 0; int ans; cin >> n; for (int i = 1; i <= 1666; i++) { if ((i % 10 != 3) && i % 3 != 0) { count++; } if (count == n) { ans = i; ...
#include <bits/stdc++.h> using namespace std; int n, m, i, j, k, res[200500], st1[200500][20], st2[200500][20]; int l2(int n) { int r = 0; while (n - 1) { r++; n >>= 1; } return r; } int chk1(int l, int r) { int k = l2(r - l + 1); return max(st1[l][k], st1[r - (1 << k) + 1]...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) { int k; cin >> k; bool ok = true; int pa = 0, pb = 0; for (int j = 0; j < k; ++j) { int a, b; cin >> a >> b; if (a < pa || b < pb) ok = false; ...
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, c, d, x, y, v, ans = 0; cin >> n >> a >> b >> c >> d; for (long long i = 1; i <= n; i++) { x = a - d + i; v = b - c + i; y = a + b - c - d + i; if ((x > 0 && x <= n) && (y > 0 && y <= n) && (v > 0 && v ...
/* * 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 ...
/** # CordicRectToPolar - CORDIC Algorithm for Rectangular to Polar Coordinates # Implements the CORDIC algorithm for the purpose of converting rectangular coordinates to polar coordinates. It takes N cycles, where `N = min(IN_WIDTH, ANGLE_WIDTH-1)`. ## Algorithm ## The algorithm is based on doing iterative rotat...
#include <bits/stdc++.h> using namespace std; int cnt[200005]; int calc(int t) { int res = 0; for (int i = 1; i <= 200000; i++) { res += cnt[i] / t; } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; for (int i = 0; i <...
/*************************************************************************************************** ** fpga_nes/hw/src/cmn/block_ram/block_ram.v * * Copyright (c) 2012, Brian Bennett * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided...
#include <bits/stdc++.h> struct Node { int sum, value; Node *ch[2], *p; __inline Node(int value = 0) : value(value) { sum = 1; ch[0] = ch[1] = p = NULL; } __inline void update() { sum = 1 + (ch[0] ? ch[0]->sum : 0) + (ch[1] ? ch[1]->sum : 0); } } pool[211111], *cur = pool; ...
#include <bits/stdc++.h> using namespace std::chrono; using namespace std; const int mod = 1e9 + 7; string s; int op[501], cl[501]; int sop[501], scl[501]; int n; void f() { memset(op, 0, sizeof(op)); memset(cl, 0, sizeof(cl)); if (s[0] == ( ) op[0]++; else cl[0]++; mems...
module inject_inst_net_case ( output logic [7:0] q2, input logic [7:0] d, input logic clk, rst_n /*AUTOARG*/); logic [7:0] Q1; register2 r2 (.q1(Q1), .ck(clk), /*AUTOINS...
`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> using namespace std; int main(void) { int n; cin >> n; int a, b; int s1 = 0; int s2 = 0; int flag = 0; while (n--) { cin >> a >> b; if ((a & 1) != (b & 1)) flag = 1; s1 += a; s2 += b; } cerr << s1 << << s2 << endl; int ans ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
/* DCPU16 Verilog Implementation Copyright (C) 2012 Shawn Tan <> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t--) { int n, g[105], sum = 0, s = 0; cin >> n; for (register int i = 0; i < n; i++) cin >> g[i], g[i] == 0 ? sum++, g[i]++...
module keyed_permutation #( parameter UNIT_WIDTH = 1 )( input wire i_clk, input wire [16*UNIT_WIDTH-1:0] i_dat, input wire [16*INDEX_WIDTH-1:0] i_key, input wire i_inverse, output reg [16*UNIT_WIDTH-1:0] o_dat ); localparam NUNITS = 16; localparam INDEX_WIDTH = 4; localparam KEY_WIDTH =...
//Legal Notice: (C)2016 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...
// ================================================================== // >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<< // ------------------------------------------------------------------ // Copyright (c) 2006-2011 by Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // -------...
#include <bits/stdc++.h> using namespace std; vector<long long int> v(26, 0); long long int n, m; bool myFun(string &a, string &s, long long int i, long long int j) { if (i >= n && j >= m) { return true; } if (j >= m) { return false; } if (i >= n) { while (j < m) { ...
`timescale 1ns / 1ps // nexys3MIPSSoC is a MIPS implementation originated from COAD projects // Copyright (C) 2014 @Wenri, @dtopn, @Speed // // 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, ...
//////////////////////////////////////////////////////////////////////////////// // Original Author: Schuyler Eldridge // Contact Point: Schuyler Eldridge () // t_sqrt_pipelined.v // Created: 4.2.2012 // Modified: 4.5.2012 // // Testbench for generic sqrt operation // // Copyright (C) 2012 Schuyler Eldridge, ...
#include <bits/stdc++.h> using namespace std; long long N, M, nn; long long a[300002]; long long suma[300002]; long long f[300002]; long long sumf[300002]; struct data { long long a, b; long long tot; } seg[1200002]; long long s, e; bool cross(long long x1, long long y1, long long x2, long l...
//Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2016.2 (lin64) Build Thu Jun 2 16:32:35 MDT 2016 //Date : Thu Jul 21 21:21:48 2016 //Host : andrewandrepowell2-desktop running 64-bit Ubuntu...
/* * Copyright (C) 2015-2016 Harmon Instruments, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This ...
/** * 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 nbElems, nbAuto; bitset<2000> autos[2000]; bitset<2000> inverse[2000]; int main() { scanf( %d%d , &nbElems, &nbAuto); vector<pair<int, int> > paires; for (int iPaire = 0; iPaire < nbAuto; iPaire++) { int pos, elem; scanf( %d%d , &pos, &...
#include <bits/stdc++.h> int main(void) { int n; while (scanf( %d , &n) != EOF) { int k = 0, flag = 0, su; for (int i = 9; i >= 0; i--) { if (i == n && i != 1) continue; if (n % i == 0) { k = n / i; su = i; break; } } if (flag == 0)...
//***************************************************************************** // (c) Copyright 2008 - 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; long long i, j = 0, k, sum = 0, ctr = 0, c = 0, ok = 0; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long a, b, c; cin >> a >> b >> c; for (i = a; i >= 0; i--) { if (c >= i * 4 && b >= i * 2) { ok = i; ...
#include <bits/stdc++.h> const int MAXN = 1e5 + 10; int n, m, k, p; int h[MAXN], a[MAXN]; namespace solver1 { long long fin[MAXN]; bool check(long long x) { long long need = 0; static long long t[MAXN]; for (int i = 1; i <= n; i++) { need += (t[i] = std::max(0ll, (fin[i] - x + p - 1) / 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 law...
/////////////////////////////////////////////////////////////////// //================================================================= // Copyright (c) Alorium Technology 2016 // ALL RIGHTS RESERVED // $Id: $ //================================================================= // // File name: : alorium_lfsr.v // ...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `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 ba...
#include <bits/stdc++.h> using namespace std; string str[51], temp; int main() { int t, f, a; int cnt = 0, ans = 0x3f3f3f3f; scanf( %d , &t); getchar(); for (int i = 0; i < t; i++) { cin >> str[i]; } for (int i = 0; i < t; i++) { cnt = 0; for (int j = 0; j < t; j++) {...
`timescale 1ns / 1ps `define intN 8 `define addrN 8 `include "primitives.v" `include "tests_three_writes.v" `include "array.v" module tests_three_writes_tb; `wire(Array, (`addrN, `intN), arr_in); `wire(Array, (`addrN, `intN), arr_out); `reg(simple, `addrN, addr1); `reg(simple, `addrN, addr2); `reg...
#include <bits/stdc++.h> using namespace std; int main() { long long int q = 1; while (q--) { long long int n, i, t, j, k = 0, maxm = 0, ans; cin >> n; vector<long long int> v(n), v1(30), v2; map<long long int, long long int> m; for (long long int i = 0; i < 30; i++) v1[i] = 0;...
/* * Milkymist VJ 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 distri...
/** * 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 gcd(int a, int b) { if (a > b) { swap(a, b); } if (a == 0) return b; return gcd(b % a, a); } int invertBits(int num) { int x = log2(num) + 1; for (int i = 0; i < x; i++) num = (num ^ (1 << i)); return num; } string add(strin...
/** * 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() { string s; cin >> s; int l = s.length(); int fc = 0; int sc = 0; for (int i = 0; i < l; i++) { if (s[i] == 4 ) fc++; if (s[i] == 7 ) sc++; } if (!fc && !sc) cout << -1 << endl; else if (sc > fc) ...
`timescale 1ns / 1ps module teclado_TB; reg Rx; reg clk; teclado uut(.clk(clk),.Rx(Rx)); parameter num=2*13'd7692; always begin clk =1'b1; #1; clk =1'b0; #1; end initial begin Rx=1; #num; Rx=0; #num; Rx=0;//1 #num; Rx=0; #num; Rx=0; #num; Rx=1; #num; Rx=1; #num; Rx=1;...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; printf( %d , ((a ^ b) & (c | d)) ^ ((b & c) | (a ^ d))); 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 la...
#include <bits/stdc++.h> using namespace std; const long long INF = 1LL << 61; int n, r; long long a[30], b[30], k[30], p[30]; long long dfs(int u, bool op1) { long long res = -INF; if (u % 2 == 0) res = max(res, inner_product(a, a + n, k, 0LL)); if (u == 0) return res; if (!op1) { for (...
// megafunction wizard: %LPM_DIVIDE% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: LPM_DIVIDE // ============================================================ // File Name: div.v // Megafunction Name(s): // LPM_DIVIDE // // Simulation Library Files(s): // lpm // ===========================================...
#include <bits/stdc++.h> using namespace std; const long long int N = 2e5 + 5; void solve() { long long int n; cin >> n; double ans, pi = 3.14159265358979323846; double rad = (2.0 * sin(pi / (2.0 * (double)n))); ans = (cos(pi / (4.0 * n))) / sin(pi / (2.0 * (double)n)); cout << fixed << se...
module cu_simulator (/*AUTOARG*/ // Outputs cu2dispatch_wf_done, cu2dispatch_wf_tag_done, // Inputs clk, rst, all_wf_dispatched, dispatch2cu_wf_dispatch, dispatch2cu_lds_base_dispatch, dispatch2cu_sgpr_base_dispatch, dispatch2cu_start_pc_dispatch, dispatch2cu_vgpr_base_dispatch, dispatch2cu_wf_size...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 23:23:22 10/18/2015 // Design Name: // Module Name: fifo // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Re...
/** * Instantiates a 9Kib block RAM for the VGA buffer, and * exposes an interface to write 32-bit blocks to 64 * addresses and read 8-bit blocks from 256 addresses. * We are only using 2Kib of memory, but the physical * hardware in the Spartan 6 only has two of these 9Kib * block RAM banks. * * @author Robert ...
/* * 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; int dd[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}}; vector<vector<int>> mat(1000, vector<int>(1000)); int n, m, si, sj; void bfs() { mat[si][sj] = 1; queue<pair<int, int>> q; q.push({si, sj}); while (!q.empty()) { auto p = q.front(); q.p...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long MAX = 200005; bool prime[MAX]; void sieve() { memset(prime, true, sizeof(prime)); prime[0] = prime[1] = false; for (long long p = 2; p * p <= MAX; p++) { if (prime[p] == true) { for (long ...
/* * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law...
#include <bits/stdc++.h> using namespace std; const int N = 15000001; int64_t primes[N]; int64_t gcd(int64_t a, int64_t b) { if (a == 0) return b; else return gcd(b % a, a); } int64_t Power(int64_t base, int64_t e) { if (e == 0) return 1; int64_t ans = base; e--; while (e...
//Legal Notice: (C)2018 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...
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const int INF = 0x3f3f3f3f; const long long inf = 0x3f3f3f3f3f3f3f3f; const int mod = 1e9 + 7; const int maxn = 1e3 + 5; int n, m, qq, s[maxn][maxn], f[maxn][maxn]; bool vis[maxn][maxn]; int a[4] = {0, 1, 0, -1}; int b[4] = {-1, 0...
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; const char choice[6][2] = {{ A , C }, { A , G }, { A , T }, { C , G }, { C , T }, { G , T }}; int n, m; string str[maxn]; int ord[2][maxn][6], cnt[2][maxn]; string out[maxn]; void print(int rc, int...
// DESCRIPTION: Verilator: Verilog Test module // // Copyright 2010 by Wilson Snyder. This program is free software; you can // redistribute it and/or modify it under the terms of either the GNU // Lesser General Public License Version 3 or the Perl Artistic License // Version 2.0. // SPDX-License-Identifier: LGPL-3.0-...
// // 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) // ...
#include <bits/stdc++.h> using namespace std; void checkDefine(); string x; string y; string z; int main() { cin >> x >> y; long long int n = x.size(); for (int i = (0), _b = (n - 1); i <= _b; i++) { if (x[i] < y[i]) { cout << -1; return 0; } } cout << y; ...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2.1 (win64) Build Wed Aug 9 16:32:24 MDT 2017 // Date : Fri Sep 22 17:41:02 2017 // Host : EffulgentTome running 64-bit major re...