text
stringlengths
59
71.4k
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: iobdg_1r1w_rf16x160.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 ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n, m; cin >> a >> b >> n >> m; if (max((3 * a) / 10, a - (a / 250) * n) > max((3 * b) / 10, b - (b / 250) * m)) cout << Misha ; if (max((3 * a) / 10, a - (a / 250) * n) < max((3 * b) / 10, b - (b / 250) * m))...
/* SPDX-License-Identifier: MIT */ /* (c) Copyright 2018 David M. Koltak, all rights reserved. */ // // Tawas Arithmetic Unit: // // Perform arithmetic on registers. // module tawas_au ( input clk, input rst, input [31:0] reg0, input [31:0] reg1, input [31:0] reg2, input [31:0] reg3, inpu...
#include <bits/stdc++.h> using namespace std; const int T = 31; const int mod = 1000000007; const long long oo = 1LL << 60; long long N; int K; long long B[T][T]; long long power[70]; long long dp[70][T][T]; bool bio[70]; long long rot[T][T][T]; long long mult(long long a, long long b) { if ...
#include <bits/stdc++.h> using namespace std; template <typename T> void r1(T &x) { x = 0; char c(getchar()); int f(1); for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); x *= f; } const int maxn = 100000...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int s[n]; int f[10] = {0}; for (int i = 0; i < n; i++) { cin >> s[i]; } int tmp; for (int j = 0; j < m; j++) { cin >> tmp; f[tmp] = 1; } int emp = 1; for (int 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 la...
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int flag = 0; int count = 0; if (isupper(s[0])) { flag = 1; count = 1; } for (int i = 1; i < s.length(); i++) { if (isupper(s[i])) count++; } if (count == s.length()) { for (int...
// -- (c) Copyright 2011-2016 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 l...
/* * 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...
/** \file "shoelace.v" Chain a bunch of inverters between VPI/VCS and prsim, shoelacing. $Id: shoelace.v,v 1.3 2010/04/06 00:08:37 fang Exp $ Thanks to Ilya Ganusov for contributing this test. */ `timescale 1ns/1ps `define inv_delay 0.010 `include "clkgen.v" /* the humble inverter */ module inverter (in, out);...
#include <bits/stdc++.h> using namespace std; long long n; long long l, val[205], cst[205]; char s[205]; long long ch[205][26], fail[205], cnt = 1; void Insert(char *s, long long w) { long long len = strlen(s), r = 0; for (long long i = 0; i < len; i++) { long long val = s[i] - a ; if (...
// File: SeqROMEx_TBV.v // Generated by MyHDL 0.10 // Date: Wed Jun 27 01:09:28 2018 `timescale 1ns/10ps module SeqROMEx_TBV ( ); // Verilog Only Testbench for `SeqROMEx` reg [3:0] dout = 0; reg clk = 0; wire rst; reg [2:0] SeqROMEx0_0_1_2_3_Count = 0; assign rst = 1'd0; always @(posedge clk) begin: SEQROMEX_...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int c[n + 1], e[n - 1][2]; for (int i = 0; i < n - 1; ++i) { cin >> e[i][0] >> e[i][1]; } for (int i = 1; i <= n; ++i) { cin >> c[i]; } vector<int> e1; vector<int> e2; for (int i = 0; i < ...
`timescale 1 ns / 1 ps `include "pmod_io_switch_v1_0_tb_include.vh" // lite_response Type Defines `define RESPONSE_OKAY 2'b00 `define RESPONSE_EXOKAY 2'b01 `define RESP_BUS_WIDTH 2 `define BURST_TYPE_INCR 2'b01 `define BURST_TYPE_WRAP 2'b10 // AMBA AXI4 Lite Range Constants `define S00_AXI_MAX_BURST_LENGTH 1 `def...
`define WIDTH_P ? // unused for now... module test_bsg; import bsg_tag_pkg::bsg_tag_s; // Enable VPD dump file // initial begin $vcdpluson; $vcdplusmemon; end logic TCK,TDI,TMS; localparam bsg_tag_els_lp = 4; wire [bsg_tag_els_lp-1:0] bsg_recv_clocks; genvar ...
#include <bits/stdc++.h> int main(void) { int a[5]; int Min; while (scanf( %d%d%d%d%d , a, a + 1, a + 2, a + 3, a + 4) != EOF) { Min = a[0]; if (a[1] < Min) Min = a[1]; if (a[2] / 2 < Min) Min = a[2] / 2; if (a[3] / 7 < Min) Min = a[3] / 7; if (a[4] / 4 < Min) Min = a[4] / 4;...
//Legal Notice: (C)2019 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 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 octal(); reg [5:0] var1; reg [4:0] var2; initial begin var1 = 6'o00; $displayo($signed(var1)); var1 = 6'o01; $displayo($signed(var1)); var1 = 6'o02; $displayo($signed(var1)); var1 = 6'o03; $displayo($signed(var1)); var1 = 6'o04; $displayo($signed(var1)); var1 = 6'o05; $displayo($signed(var1)); va...
//hardware top level module module sm_top ( input clkIn, input rst_n, input [ 3:0 ] clkDevide, input clkEnable, output clk, input [ 4:0 ] regAddr, output [31:0 ] regData, input [ 7:0 ] exData ); //metastability input filters wire ...
// (c) Copyright 1995-2014 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 ...
(************************************************************************) (* v * The Coq Proof Assistant / The Coq Development Team *) (* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *) (* \VV/ **************************************************************) (* // * Th...
//Legal Notice: (C)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 //simulation files), and any associated do...
// megafunction wizard: %ROM: 1-PORT%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: ADC.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // ================================...
#include <bits/stdc++.h> using namespace std; int main() { double n, a, d; cin >> n >> a >> d; vector<int> t; vector<int> v; double prev = 0; int bit = 1; for (int i = 0; i < n; i++) { double t1, v1; cin >> t1 >> v1; double t2 = 0, t3 = 0, tot = 0; double dis = 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; int n; char s[105]; string S; multiset<string> st; vector<string> v; inline bool cmp(string a, string b) { return a.length() < b.length(); } int cnt[26]; char ans[105]; int f[105][26]; int main() { scanf( %d , &n); if (n <= 3) { if (n == ...
/* Servo Controller test bench Author: Nathan Larson Date: 10/20/2016 */ `timescale 1 ns/ 1 ps module ServoController_vlg_tst(); // test vector input registers reg clk; reg enable; reg [7:0] pulse_in; // wires wire PWM_out; pwm_generator #(.PWM_DEPTH(8)) i1 // pwm0...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 14:55:04 12/14/2010 // Design Name: // Module Name: msu // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision: // R...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 09:26:07 09/22/2014 // Design Name: // Module Name: filter // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revi...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << (n / 2) + n; }
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const long long inf = 2e9 + 10; template <typename T1, typename T2> static void relax(T1 &x, T2 y) { if (x > y) x = y; } template <typename T1, typename T2> static void gain(T1 &x, T2 y) { if (x < y) x = y; } long long po...
/* * BCH Encode/Decoder Modules * * Copyright 2014 - Russ Dill <> * Distributed under 2-clause BSD license as contained in COPYING file. */ `timescale 1ns / 1ps `include "bch_defs.vh" `include "config.vh" /* Chien search, determines roots of a polynomial defined over a finite field */ module bch_chien_reg #( pa...
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10, M = (1 << 18); int n, a[N], fa[N], cnt; long long ans; pair<int, int> mx[M][2], cur[M]; int getfa(int x) { return fa[x] == x ? x : fa[x] = getfa(fa[x]); } bool merge(int x, int y) { x = getfa(x), y = getfa(y); if (x == y) return...
// megafunction wizard: %FIFO%VBB% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: asyn_256_139.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // // ===================================...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 22:46:47 09/23/2013 // Design Name: // Module Name: Comparador // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: //...
#include <bits/stdc++.h> using namespace std; struct Q { int l; int r; int num; Q(int _l, int _r, int _num) : l(_l), r(_r), num(_num) {} }; int cnt[100100]; int res[100100]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(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 law...
#include <bits/stdc++.h> using namespace std; int main() { int n, q; scanf( %d %d , &n, &q); string s; cin >> s; int size = s.size(); int cnt = 0; for (int i = 1; i < size; i++) { if (s[i] == . && s[i] == s[i - 1]) cnt++; } while (q--) { int n1; char x; ...
/**************************************************************\ * * WS2812 LED controll module * * Parameters: * CYCLES_SHORT clk cycles for the 400 ns duration * CYCLES_LONG clk cycles for the 800 ns duration * CYCLES_RET clk cycles for the wait time after * clocking the bits out * * i...
#include <bits/stdc++.h> using namespace std; int main() { char ar[1002][1002]; int n, m, i, j, count, ar1[1002]; scanf( %d%d , &n, &m); for (i = 0; i < n; i++) { scanf( %s , ar[i]); } for (i = 0; i < m; i++) { ar1[i] = 1; } for (i = 1; i < n; i++) { for (j = 0; j <...
#include <bits/stdc++.h> int A[50], B[50]; int main() { int N, M, i, j, Max, now, Cnt; while (scanf( %d , &N) != EOF) { for (i = 0; i < N; ++i) { scanf( %d , &A[i]); } scanf( %d , &M); for (i = 0; i < M; ++i) { scanf( %d , &B[i]); } for (Max = i = 0; i < N...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; bool flag[maxn]; int phi[maxn]; vector<int> prime; vector<int> fin[6][maxn]; int a[10][10], num; void get_prime_phi() { phi[1] = 1; for (int i = 2; i < 1e5; i++) { if (!flag[i]) { prime.push_back(i); p...
#include <bits/stdc++.h> using namespace std; inline long long rd() { register long long x = 0; register bool f = 0; register char c = getchar(); while (!isdigit(c)) { if (c == - ) f = 1; c = getchar(); } while (isdigit(c)) { x = x * 10 + (c ^ 48); c = getchar(); ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); if (n == 1) { cout << 0 << endl; return 0; } int a[n + 2], cnt = n - 1; for (int i = 2; i <= n; i++) { a[i] = i; } for (int i = 2; i < n; i++) { for (int j = i + 1; j <= n; j++)...
#include <bits/stdc++.h> using namespace std; int now[15][3], ans[15][3], nA, nB, nC, minN = 12, cnt, t[13]; void dfs(int a, int b, int c, int num, int jw, int cou, bool ifA, bool ifB) { if (!a && !b && !c && !jw) { minN = num; cnt = cou; memcpy(ans, now, sizeof(now)); return; } ...
module top_string(char, clk, new, btn1, string, completeOut, changeOut); input [6:0] char; input clk, new, btn1; output [76:0] string; output completeOut, changeOut; wire complete, change; wire wCenter, wCene, wCvirgul, wCdelete, wCnum, wDelete, wAdd, wCcounter, wAddEnhe, wLoad, wEnter, wVirgul, wchangeVirgul; wire [...
/** * 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...
/* * Milkymist VJ SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * added stress test by Zeus Gomez Marmolejo <> * * 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...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); printf( %d n , n / 2 - (n % 2 ? 0 : 1)); return 0; }
#include <bits/stdc++.h> using namespace std; auto SEED = chrono::steady_clock::now().time_since_epoch().count(); mt19937 rng(SEED); int main() { int n, k; cin >> n >> k; int dist[n][n]; for (int i = (0); i < (n); i++) { for (int j = (0); j < (n); j++) { cin >> dist[i][j]; } ...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
/* * 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-2015 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2015.1 (win64) Build Mon Apr 27 19:22:08 MDT 2015 // Date : Tue Mar 22 02:25:26 2016 // Host : DESKTOP-5FTSDRT running 64-bit major releas...
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved. // // This file contains confidential and proprietary information // of Xilinx, Inc. and is protected under U.S. and // international copyright and other intellectual property // laws. // // DISCLAIMER // This disclaimer is not a license and does not grant ...
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int a[25], b[25]; int dp[1 << 24]; int main() { int n, k; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &a[i]); scanf( %d , &k); for (int i = 1; i <= k; i++) scanf( %d , &b[i]); dp[0] = 1; for (int i ...
#include <bits/stdc++.h> using namespace std; string s; int main() { getline(cin, s); int n, flag = 0; n = s.length(); for (int i = n; i >= 0; i--) { if ((s[i] >= a && s[i] <= z ) || (s[i] >= A && s[i] <= Z )) { if (s[i] == a || s[i] == e || s[i] == i || s[i] == o || ...
// (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...
#include <bits/stdc++.h> using namespace std; template <typename T> void print(T a) { for (auto i = a.begin(); i != a.end(); i++) cout << *i << ; cout << endl; } bool isVowel(char c) { if (c == a || c == e || c == i || c == o || c == u ) return true; return false; } void sync()...
`timescale 1ns/10ps module soc_system_pll_stream( // interface 'refclk' input wire refclk, // interface 'reset' input wire rst, // interface 'outclk0' output wire outclk_0, // interface 'outclk1' output wire outclk_1, // interface 'locked' output wire locked ); altera_pll #( .fractional_vco_multipli...
#include <bits/stdc++.h> using namespace std; struct segtree { vector<vector<int>> t; vector<int> d; int h, n, sz; inline void build_node(const int& x) { for (int j = 0; j < 26; ++j) { t[x][j] = t[x << 1][j] + t[x << 1 | 1][j]; } } inline void build(int x) { for (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; long long N, M, x, y, K, ml, T, ans; long long f[1000000], s[1000000]; const long long md = 1e9 + 7; const long long MAXN = 1e5 + 2; string in; int main() { cin >> N >> K; f[0] = 1; for (int i = 1; i <= MAXN; i++) { f[i] = f[i - 1]; if ...
#include <bits/stdc++.h> using namespace std; const int64_t MOD = 1e9 + 7; void add(int64_t& a, int64_t b) { a = (a + b) % MOD; } int nth_bit(int64_t num, int n) { return (num >> n) & 1; } const int SZ = 14 * 16; void matmul(int64_t A[SZ][SZ], int64_t B[SZ][SZ]) { int64_t ret[SZ][SZ] = {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 law...
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2014.4 // Copyright (C) 2014 Xilinx Inc. All rights reserved. // // =========================================================== `timescale 1 ns / 1 ps (* CO...
#include <bits/stdc++.h> using namespace std; using lld = signed long long int; lld solve() { lld n, m, k; cin >> n >> m >> k; lld x = n / k; if (m <= x) return m; if (m <= x + (k - 1)) return x - 1; return x - ceil((m - x) / (k - 1.0)); } int main() { ios_base::sync_with_stdio(fal...
#include <bits/stdc++.h> using namespace std; int main() { int n; string colours; cin >> n >> colours; string collec[] = { RGB , RBG , BRG , BGR , GRB , GBR }; int index; int max = INT_MAX; for (int i = 0; i < 6; i++) { int count = 0; for (int j = 0; j < n; j++) { ...
//TODO: make memory do... something... when given an address not in range 0x80020000 -> (0x80020000 + Memory Size) module mips_memory2 (clk, addr, din, dout, pc, access_size, rw, busy, enable); parameter MEMSIZE = 1024; parameter START_ADDR = 32'h8002_0000; // input input clk; input [31:0] addr; input...
/* * 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...
// $Header: $ /////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995/2004 Xilinx, Inc. // All Right Reserved. /////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor : Xilinx // \ \ \/ ...
#include <bits/stdc++.h> using namespace std; vector<int> cost[4]; vector<vector<int> > G; void solve() { long long n, p, w, d; cin >> n >> p >> w >> d; for (long long y = 0; y < w; y++) { if (p < y * d) continue; long long wx = p - y * d; if (wx % w) continue; long long x = ...
`timescale 1ns / 1ps module Board232 ( input mclk, input [3:0] btn, input [7:0] sw, output [7:0] led, output reg [6:0] seg, output reg [3:0] an, output dp, output [2:1] OutBlue, output [2:0] OutGreen, output [2:0] OutRed, output HS, output VS ); assign dp = 1'b1; //assign led[7:2]=0; initial be...
#include <bits/stdc++.h> using namespace std; int ask(string s) { cout << ? << s << endl; fflush(stdout); int x; cin >> x; return x; } int main() { int n; scanf( %d , &n); string s(n, 0 ); int c = ask(s); s[0] = 1 ; int a0; int d = ask(s); int pos1 = -1, ...
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b) { long long ans = 1; while (b > 0) { if (b & 1) { ans = (ans * a); } a = (a * a); b >>= 1; } return ans; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL);...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:31:59 04/23/2016 // Design Name: // Module Name: cuckooRinging // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; map<int, int> m; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; m[a[i]] = i; } long long int b[n]; map<int, int> freq; for (int i...
`timescale 1ns / 1ps /* -- Module Name: output_block -- Description: Bloque de salida de la interfaz de red. Se encarga de la interaccion entre el elemento de procesamiento y el router. Este modulo toma el resultado del elemento de procesamiento y lo empaquete en flits para su transporte a tra...
/** * 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) 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...
module jump_addr( input [25:0] inst, input [3:0] pc_4, output[31:0] j_addr); buf (j_addr[0 ] ,inst[0 ]); buf (j_addr[1 ] ,inst[1 ]); buf (j_addr[2 ] ,inst[2 ]); buf (j_addr[3 ] ,inst[3 ]); buf (j_addr[4 ] ,inst[4 ]); buf (j_addr[5 ] ,inst[5 ]); buf (j_addr[6 ] ,inst[6 ]); buf (j_addr[7 ] ,inst[7 ...
#include <bits/stdc++.h> using namespace std; bool h[1000009]; int main() { int n, m, k, tmp, tmp1, pos = 1; cin >> n >> m >> k; for (int i = 0; i < m; ++i) { cin >> tmp; h[tmp] = true; } if (h[1]) { cout << pos << endl; return 0; } for (int i = 0; i < k; ++i) {...
// *************************************************************************** // *************************************************************************** // Copyright 2011(c) Analog Devices, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without modification, // a...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, arr[26]; string s; memset(&arr, -1, sizeof(arr)); cin >> s; int l = s.length(); if (l < 26) { cout << -1; return 0; } i = 0; j = 0; while (j < l) { if (j - i == 26) break; if (s[j]...
#include <bits/stdc++.h> using namespace std; bool solve() { int n; bool ret = false; int m = 0; scanf( %d , &n); int a; scanf( %d , &a); while ((a & 1) == 0) a >>= 1; while (a % 3 == 0) a /= 3; m = a; for (int i = 1; i < n; i++) { int a; scanf( %d , &a); wh...
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int n, arr[N], arr2[N], seg[4 * N], lazy[4 * N]; inline void fix(int s, int e, int idx) { seg[idx] += lazy[idx]; if (s != e) { lazy[(idx << 1)] += lazy[idx]; lazy[(idx << 1) + 1] += lazy[idx]; } lazy[idx] = 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...
/* Verilog model created from schematic section3_schematic.sch -- May 07, 2014 14:52 */ module section3_schematic( A, B, C, D, LED, SegA, SegB, SegC, SegD, SegE, SegF, SegG ); input A; input B; input C; input D; output LED; output SegA; output SegB; output SegC; output SegD; output SegE;...
#include <bits/stdc++.h> using namespace std; template <typename T> bool chmax(T& a, const T& b) { return a < b ? (a = b, true) : false; } template <typename T> bool chmin(T& a, const T& b) { return b < a ? (a = b, true) : false; } int N; string S; int main() { cin >> S; N = S.size()...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; while (cin >> a >> b >> c) { if (b == a / 2 && c == a / 2) cout << NO << endl; else if (b == a / 2 && c == a / 2 + 1) cout << NO << endl; else if (b == a / 2 + 1 && c == a / 2 + 1) cout << ...
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, q; cin >> n >> q; vector<long long> a(n); for (long long i = 0; i < n; i++) { cin >> a[i]; } long long x = 0, y = 0; for (long long i = 0; i < n;...
#include <bits/stdc++.h> using namespace std; long double n, l, k, v1, v2; int main() { cout << fixed << setprecision(10); cin >> n >> l >> v1 >> v2 >> k; if (v2 <= v1) { cout << l / (v1 * 1.0) << endl; return 0; } if (n <= k) { cout << l / (v2 * 1.0) << endl; return 0;...
`timescale 1ns / 1ps `define SIMULATION module peripheral_audio_TB; reg clk; reg rst; reg reset; reg start; reg [15:0]d_in; reg cs; reg [1:0]addr; reg rd; reg wr; wire [15:0]d_out; reg micData; peripheral_audio uut (.clk(clk) , .rst(reset) , .d_in(d_in) , .cs(cs) , .addr(addr) ...
#include <bits/stdc++.h> using namespace std; void sf(int &x) { scanf( %d , &x); } void sf(long long &x) { scanf( %lld , &x); } void sf(float &x) { scanf( %f , &x); } void sf(double &x) { scanf( %lf , &x); } void sf(int &x, int &y) { scanf( %d%d , &x, &y); } void sf(long long &x, long long &y) { scanf( %l...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); int i, j, k; int ag[101], a[101][101]; int g = 0, dr[101], dl[101]; for (i = 1; i <= n; i++) { scanf( %d , &ag[i]); g += ag[i]; dl[i] = 1; dr[i] = ag[i]; for (j = 1; j <= ag[i]; j...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, c, d; cin >> a >> b >> c >> d; cout << b << << c << << c << n ; } return 0; }
#include <bits/stdc++.h> using namespace std; vector<long long> primer; long long mul(long long x, long long y, long long mod) { long long s = 0; for (; y; y /= 2, x = (x + x) % mod) if (y & 1) s = (s + x) % mod; return s; } long long gcd(long long x, long long y) { return y ? gcd(y, x % y) ...
/** \file "unstable-dequeue.v" Bug-fix test case to show that next_event_time() returns only the next non-killed event time. copy-modified from "inverters.v" Chain a bunch of inverters between VPI/VCS and prsim, shoelacing. $Id: unstable-dequeue.v,v 1.1 2010/06/14 00:22:35 fang Exp $ */ `timescale 1ps/1ps `in...