text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int x[100100], y[100100], id[100100]; bool cmp(int i, int j) { if (y[i] >= 0 && y[j] < 0) return true; else if (y[i] < 0 && y[j] >= 0) return false; if (y[i] == 0 && y[j] == 0) { return x[j] < 0; } return x[i] * y[j] >= x[j] * y[i... |
#include <bits/stdc++.h> using namespace std; int dx[4] = {-1, 1, 0, 0}; int dy[4] = {0, 0, -1, 1}; int sx, sy; char m[1005][1005]; int vis[1005][1005][4]; int flag; int n, k; void bfs(int x, int y, int l, int c) { if (x < 0 || x >= n || y < 0 || y >= k) return; if (m[x][y] == * ) return; ... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { if (a == 0) return b; if (b == 0) return a; if (a == b) return a; if (a > b) return gcd(a - b, b); return gcd(a, b - a); } void sol() { long long int L, v, l, r, count = 0; cin >> L >> v >> l >> r; long long in... |
/* This module converts a user specified coordinates into a memory address.
* The output of the module depends on the resolution set by the user.
*/
module vga_address_translator(x, y, mem_address);
parameter RESOLUTION = "320x240";
/* Set this parameter to "160x120" or "320x240". It will cause the VGA adapter to ... |
#include <bits/stdc++.h> using namespace std; long long nMod = 1e9 + 7; inline long long GCD(long long a, long long b) { while (b != 0) { long long c = a % b; a = b; b = c; } return a; }; inline long long LCM(long long a, long long b) { return (a / GCD(a, b)) * b; }; void vietn... |
module ControlUnit(
output [CNTRL_WIDTH-1:0] CNTRL_out,
output [WORD_WIDTH-1:0] PC_out,
output [WORD_WIDTH-1:0] CONST_out,
input [INSTR_WIDTH-1:0] JMPADDR_in,
input [WORD_WIDTH-1:0] INSTRM_in,
input [3:0] FLAG_in,
input RST_in,
input CLK_in
);
parameter WORD_WIDTH = 16;
parameter DR_WIDTH = 3;
parameter OPCOD... |
// iverilog -y .. -o tb-Fork2.vvp tb-Fork2.v
// vvp tb-Fork2.vvp
`timescale 1ns/1ns
module tb;
localparam W = 8;
localparam CYC = 10;
reg clk, rst;
reg idata_vld;
wire idata_rdy;
reg [W-1:0] idata;
wire odata0_vld, odata1_vld;
reg odata0_rdy, odata1_rdy;
wire [W-1:0] odata0, odata1;... |
`include "constants.vh"
`include "rv32_opcodes.vh"
`include "alu_ops.vh"
`default_nettype none
module mux_4x1(
input wire [1:0] sel,
input wire [2*`DATA_LEN-1:0] dat0,
input wire [2*`DATA_LEN-1:0] dat1,
input wire [2*`DATA_LEN-1:0] dat2,
input wire [2*`DATA_LEN-1:0] dat3,
... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Mon Sep 18 12:17:34 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 6; struct Edge { int next, en; } edge[maxn]; int head[maxn], cnt; void init() { memset(head, -1, sizeof(head)); cnt = 0; } void add(int x, int y) { edge[cnt].en = y; edge[cnt].next = head[x]; head[x] = cnt++; ... |
/*
* In this example, the set and clr are both synchronous. This checks
* that this complex case is handled correctly.
*/
module main;
reg Q, clk, rst, set, clr;
(* ivl_synthesis_on *)
always@(posedge clk or posedge rst)
begin
if (rst)
Q <= 1'b0;
else if (set)
Q <= 1'b1;
else if (clr)
... |
`include "constants.vh"
`include "rv32_opcodes.vh"
`include "alu_ops.vh"
//Implement this decoder ISSUE_NUM
/*
refactoring
wr_reg_unkilled_DX -> wr_reg
*/
module decoder(
input [31:0] inst,
output reg [`IMM_TYPE_WIDTH-1:0] imm_type,
output wire [`REG_SEL-1:0] rs1,
output wi... |
// file: sdram_clk_gen_exdes.v
//
// (c) Copyright 2008 - 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... |
//--------------------------------------------------------------------------------
// rle_enc.vhd
//
// Copyright (C) 2007 Jonas Diemer
//
// 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 Foundati... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin... |
#include <bits/stdc++.h> using namespace std; vector<int> p; vector<int> cor; int total; void dfs_visit(vector<vector<int>>& adj, int i) { cor[i] = 1; for (int j : adj[i]) { if (cor[j] == 1) { total++; } if (cor[j] == 0) { p[j] = i; dfs_visit(adj, 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 int maxn = 1234567; int query(vector<long long> a) { int n = a.size(); for (int i = 2; i * i <= n; i++) { if (n % i == 0) { if (n % (i * i) != 0) { for (int j = 0; j < n; j += i) { long long d = a[j]; int k... |
module UAdder (out,carry_out,overflow,A,B,C_in);
output [31:0]out;
output carry_out,overflow;
input [31:0] A,B;
input C_in;
wire [6:0] carry;
CLA_4bit cc1(out[3:0],carry[0],A[3:0],B[3:0],C_in);
CLA_4bit cc2(out[7:4],carry[1],A[7:4],B[7:4],carry[0]);
CLA_4bit cc3(out[11:8... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MAX = 105; vector<int> adj[MAX]; string s[MAX]; int mark[MAX]; bool cycle; string ans = ; void dfs(int v) { mark[v] = 1; for (int i = 0; i < adj[v].size(); i++) { int u = adj[v][i]; if (mark[u] == 1) cycle = true; if (!m... |
#include <bits/stdc++.h> using namespace std; int solve(string second, char cur) { if (second.size() == 1) { return !(second[0] == cur); } int n = second.size(); int check = 0; for (int i = 0; i < n / 2; i++) { check += (second[i] == cur); } int check2 = 0; for (int i = 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> using namespace std; const int N = 210003; double a[N], b[N]; int n; double checkMa(double x) { for (int i = 1; i <= n; i++) b[i] = a[i] - x; double ans = 0, tpans = 0; for (int i = 1; i <= n; i++) { tpans += b[i]; if (tpans < 0) tpans = 0; ans = max(ans,... |
#include <bits/stdc++.h> using namespace std; const int N = 1000005; char s[N], t[N], S[N]; int n, ch[N][26], fa[N]; int len[N], anc[N], dif[N], nd, la; int ans[N], _ans[N], from[N]; void extend(int n) { int c = S[n], p = la; for (; S[n - len[p] - 1] != c; p = fa[p]) ; if (!ch[p][c - a ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const int maxn = 505, maxm = 1005; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long powermod(long long a, long long b, long long c) { a = a % c; long long ans = 1; while (b) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n = 3, i, j, a, b; vector<pair<int, int> > v, v2; for (i = 0; i < 3; i++) { scanf( %d%d , &a, &b); v.push_back(make_pair(a, b)); v2.push_back(make_pair(b, a)); } int cnt, c2, c3; sort(v.begin(), v.end()); so... |
/*
--------------------------------------------------------------------------
Pegasus - Copyright (C) 2012 Gregory Matthew James.
This file is part of Pegasus.
Pegasus is free; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04/25/2016 09:12:30 AM
// Design Name:
// Module Name: Testbench_Sgf_multiplication
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dep... |
//Modules for conditional logical connection of digital signals
//with some security against fault attack and FIB attacks
//outputs are connected to inputs if the condition holds otherwise they are forced to 0
//sebastien riou, 20141003
//Connect inputs i_dat to outputs o_dat only if i_password==PASSWORD
//This provi... |
#include <bits/stdc++.h> using namespace std; const int N = 10100; int i, j, k, n, m, ch, c; int s[N], t[N]; long long ans, f[N]; void R(int &x) { x = 0; ch = getchar(); while (ch < 0 || 9 < ch) ch = getchar(); while ( 0 <= ch && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); } v... |
#include <bits/stdc++.h> using namespace std; vector<int> parent; vector<string> names; void parse(int par) { string str; char c; while (isalpha(cin.peek())) { cin >> c; str += c; } names.push_back(str); parent.push_back(par); int id = names.size() - 1; while (cin.pee... |
//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 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; struct Expr { char a[1010], b[1010]; int v; int op; }; Expr exps[5010]; char ansMin[1010], ansMax[1010]; char buf[10010]; map<string, int> varIndex; int calc(int a, int b, int op) { if (op == 1) return a & b; else if (op == 2) ... |
#include <bits/stdc++.h> using namespace std; int n; long long arr[5005], parent[5005], ans[5005]; long long dist[5005][5005]; vector<int> v[5005], order; priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pq[5005]; void dfs(int cur, int prev) { p... |
// (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 ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; const int INF = 2147483647; const long long LLINF = 9223372036854775807LL; const int maxn = 100010; const int mod = 1000000007; int psum[7][maxn]; int t[7][maxn * 4]; bool needset[7][maxn * 4]; int tset[7][maxn * 4]; int a[maxn]; inline int calcsum(int... |
/*****************************************************************************
* *
* Module: Altera_UP_RS232_In_Deserializer *
* Description: *
* ... |
#include <bits/stdc++.h> char s[100005]; std::vector<int> v; int main() { scanf( %s , s); int n = strlen(s); bool pc = 0; long long now = 0, pre = 0; bool first = true; for (int i = 0; i < n; i++) { if (s[i] <= 9 && s[i] >= 0 ) { now = now * 10 + s[i] - 0 ; } else {... |
/*
Copyright (c) 2016 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; const double EPS = 1e-9; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } template <typename t1> t1 gcd(t1 a, t1 b) { return b == 0 ? a : gcd(b, a % b); } template <typename t1> t1 lcm(t1 a, t1 b) { return a * (b / gcd(a... |
#include <bits/stdc++.h> const int inf = 0x3f3f3f3f; const int maxn = 500050; const int mod = 1e9 + 7; using namespace std; int main() { ios::sync_with_stdio(0); int n, a, b; cin >> n >> a >> b; int c = 0, ans = 0; for (int i = 1; i <= n; i++) { int x; cin >> x; if (x == ... |
#include <bits/stdc++.h> using namespace std; const long long PINF = 1E9; const long long NINF = -1E9; const long long M = 1E9 + 7; const double EPS = 1E-9; const double PI = 2 * acos(0); void print_arr(const vector<long long> &a) { for (int i = 0; i < (int)a.size(); i++) cout << a[i] << ; cout... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: RIT
// Engineer: Cody Cziesler, Nick Desaulniers
//
// Create Date: 10:58:44 04/07/2011
// Design Name: Omicron
// Module Name: omicron
// Project Name: Pipelined CPU
// Target Dev... |
// 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... |
// ==============================================================
// File 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
m... |
// (C) 2001-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 doc... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:34:54 11/17/2015
// Design Name:
// Module Name: Datapath1
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:50:37 03/16/2014
// Design Name:
// Module Name: Core_TB
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
// wasca_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 193
`timescale 1 ps / 1 ps
module wasca_mm_interconnect_0_avalon_st_adapter #(
parameter inBitsPerSymbo... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; char a[N], b[N]; string arrange(string s) { int n = s.size(); if (n & 1) return s; else { int m = n / 2; string s1 = s.substr(0, m), s2 = s.substr(m, m); s1 = arrange(s1); s2 = arrange(s2); if (s1... |
//////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE SD Card Controller IP Core ////
//// ////
//// sd_cmd_serial_host.v ... |
#include <bits/stdc++.h> using namespace std; long long mi, ma, n, d, k, l, r, mid, a[500007], b[500007], cnt[500007]; inline long long read() { long long s = 0, w = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) w = -1; for (; isdigit(c); c = getchar()) s = (s << 3)... |
#include <bits/stdc++.h> using namespace std; long long n, m; long long x[105]; double f[105][105525]; double sum[105525]; inline void read() { cin >> n >> m; for (long long i = 0; i <= n - 1; i++) { cin >> x[i]; } } inline void solve() { long long ms = n * m; if (m == 1) { ... |
#include <bits/stdc++.h> using namespace std; template <class II, class SZ, class OI> OI cpy_n(II _i, SZ _s, OI _o) { for (int_fast64_t _j = 1; _j <= _s; _j++) { *(_o++) = *_i; if (_j != _s) { _i++; } }; return _o; } template <class T> void slurp(vector<T>& v, int_least... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:
// Design Name:
// Module Name: GDA_St_N16_M4_P8
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
#include <bits/stdc++.h> using namespace std; template <typename T> T gcd(T a, T b) { return !b ? a : gcd(b, a % b); } template <typename T> T lcm(T a, T b) { return a * (b / gcd(a, b)); } template <typename T> T sqr(T a) { return a * a; } template <typename T> T cube(T a) { retu... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#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; const long long N = 2e5 + 77; string s; void sol() { long lo... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Adam LLC
// Engineer: Adam Michael
//
// Create Date: 15:33:44 09/17/2015
// Design Name: Key Encoder
// Module Name: KeyEncoderAJM
///////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; const int L = 0, R = 1, U = 2, D = 3; const int maxn = 5005; class Node { public: int dir, l, r, u, d; } a[maxn], b[maxn]; int n, m; char s[maxn]; inline int id(int x, int y) { return x * m + y; } inline void build(int x, int y) { Node &u = a[id... |
#include <bits/stdc++.h> using namespace std; const long long is_query = -(1LL << 62); struct Line { long long m, b; mutable function<const Line*()> succ; bool operator<(const Line& rhs) const { if (rhs.b != is_query) return m < rhs.m; const Line* s = succ(); if (!s) return 0; ... |
#include <bits/stdc++.h> using namespace std; const long long Inf = 1000000000000000000ll; const int inf = 1000000000; vector<long long> pri, fac; long long m, x, ans; void getpri(long long t, vector<long long>& v) { v.clear(); for (long long i = 2; i * i <= t; ++i) { if (t % i) continue; ... |
#include <bits/stdc++.h> using namespace std; template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p) { out << ( << p.first << , << p.second << ) ; return out; } template <typename T> ostream& operator<<(ostream& out, vector<T> const& v) { int l = v.size();... |
#include <bits/stdc++.h> using namespace std; template <class T> void in(T &x) { x = 0; bool f = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = 1; c = getchar(); } while ( 0 <= c && c <= 9 ) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(... |
// generated by gen_VerilogEHR.py using VerilogEHR.mako
// Copyright (c) 2019 Massachusetts Institute of Technology
// 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... |
#include <bits/stdc++.h> using namespace std; long long a, b, l[3001][3001], dp[3001][3001], mod = 1000000007; char cc; long long find(long long aa, long long bb, long long qq, long long ww) { if (l[aa][bb] == 2) return 0; memset(dp, 0, sizeof(dp)); dp[aa][bb] = 1; for (int i = aa; i <= qq; i++)... |
#include <bits/stdc++.h> using namespace std; int bits[32]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; vector<long long> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } for (int i = 0; i < m; i++) { int x; cin >> x; ... |
#include <bits/stdc++.h> using namespace std; vector<int> teams(200000); int main() { ios_base::sync_with_stdio(false); int N; cin >> N; for (int i = 0; i < N; i++) cin >> teams[i]; for (int i = 0; i < N; i++) { if (teams[i] == 0) { continue; } if (teams[i] >= 2) { ... |
/*
* 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; template <class T> void debug(T a, T b) { ; } template <class T> void chmin(T& a, const T& b) { if (a > b) a = b; } template <class T> void chmax(T& a, const T& b) { if (a < b) a = b; } namespace std { template <class S, class T> ostrea... |
/*******************************************************************************
* 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 ... |
// (c) Copyright 2012 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; long long inv(long long a, long long mod) { long long b = mod, p = 1, q = 0; while (b) { long long c = a / b, d = a; a = b; b = d % b; d = p; p = q; q = d - c * q; } return (p + mod) % mod; } map<tuple<long long, l... |
//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... |
#include <iostream> #include <vector> #include <numeric> #include <algorithm> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t; cin >> t; while(t--){ int n; cin >> n; vector<long lon... |
module sccu_dataflow(op, func, z, wmem, rmem, wreg, regrt, m2reg, aluc, shift, aluimm, pcsource, jal, sext, wpc);
input [5:0] op, func;
input z;
output wreg, regrt, m2reg,shift, aluimm, jal, sext, wmem, rmem, wpc;
output [3:0] aluc;
output [1:0] pcsource;
wire r_type = ~|op;
wire i_add = r_type & func[5]... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char **argv) { ios_base::sync_with_stdio(false); string s; cin >> s; int n = s.size(); long long maxDiff = 0; long long ans = 0; int x; if (n == 1) { cout << s << endl; return 0; } vector<pair<char, ... |
/**
* 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) 2016 Cedric Orban
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 program is distributed in the ho... |
// (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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/26/2016 08:52:29 AM
// Design Name:
// Module Name: Problem1Integrated
// 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(0); int t; cin >> t; while (t--) { long long a, b, c, d; cin >> a >> b >> c >> d; if (a > b * c) cout << -1 << n ; else { long long k = (a / (b * d)); ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Adam LLC
// Engineer: Adam Michael
//
// Create Date: 15:33:44 09/17/2015
// Design Name: Key Encoder
// Module Name: KeyEncoder
///////////////////////////////////////////////////////////////... |
/**
* 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; void optimizeIO() { ios_base::sync_with_stdio(false); cin.tie(NULL); } int32_t main() { optimizeIO(); long long tt = 1; cin >> tt; while (tt--) { long long n; cin >> n; vector<bool> v(65, 0); while (n) { long l... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: cpx_buf_pt.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or... |
#include <bits/stdc++.h> using namespace std; int euclid(int a, int b, int &x, int &y) { if (!a) { x = 0; y = 1; return b; } int _x, _y; int g = euclid(b % a, a, _x, _y); x = _y - b / a * _x; y = _x; return g; } void relax(int &obj, int C3, int C4, int C5, int _k3, ... |
#include <bits/stdc++.h> int main() { int a, b, c, count = 0, i, j; scanf( %d%d%d , &a, &b, &c); if ((a == c) || (b == c)) { count++; } else { for (i = 0; i <= c; i += a) { for (j = 0; j <= c; j += b) { if ((i + j) == c) { count++; break; ... |
// -*- Mode: Verilog -*-
// Filename : syscon.v
// Description : System Clock and Reset Controller
// Author : Philip Tracton
// Created On : Fri Nov 27 13:42:16 2015
// Last Modified By: Philip Tracton
// Last Modified On: Fri Nov 27 13:42:16 2015
// Update Count ... |
#include <bits/stdc++.h> using namespace std; int n, k; int main() { scanf( %d%d , &n, &k); if (k >= (n * (n - 1)) / 2) puts( no solution ); else { for (int i = 0, t = 1; t <= n; t++) printf( %d %d n , i, t); } return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string mat[n + 5]; int dp[n + 5][n + 5]; for (int i = 0; i < (n); i++) cin >> mat[i]; memset(dp, 0, sizeof(dp)); if (mat[0][0] == a ) dp[0][0] = 1; for (int i = 1; i < (n); i++) { dp[i][0] = dp... |
#include <bits/stdc++.h> using namespace std; int n, f[2][200]; int main() { f[0][0] = f[1][1] = 1; int t = 1; cin >> n; for (int i = 2; i <= n; ++i) { t = i & 1; for (int j = 1; j <= i; ++j) f[t][j] = (f[t][j] + f[t ^ 1][j - 1]) & 1; } printf( %d n , n); for (int i = 0; i ... |
module avr_interface(
input clk,
input rst,
input cclk,
output spi_miso,
input spi_mosi,
input spi_sck,
input spi_ss,
output [3:0] spi_channel,
output tx,
input rx,
input [3:0] channel,
output new_sample,
output [9:0] sample,
output [3:0] sample_channel,
input [7:0] tx_data,
input new_tx_data,... |
#include <bits/stdc++.h> using namespace std; int c[100001]; int w[100001]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> c[i]; } for (int i = 0; i < n; i++) { cin >> w[i]; } int ch = m; se... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vii; typedef vector<vi> vvi; typedef vector<pll> vll; typedef vector<vl> vvl; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.